[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    Re: Transparency and drop-shadow
From:       Jim Graham <james.graham () oracle ! com>
Date:       2014-03-28 23:12:57
Message-ID: 533601F9.3080703 () oracle ! com
[Download RAW message or body]

This is one of the earliest bugs filed against the effects package:

https://javafx-jira.kenai.com/browse/RT-381

I can understand the concept, but since our effects are pixel-based, it 
is hard to figure out "where the foreground drawing would have rendered 
opaquely if it didn't have an alpha fill".  We end up with conditions like:

- How to tell the difference between the 25% interior alpha and an edge 
pixel shaded 25% due to antialiasing coverage calculations.  The former 
would be excluded by the concept, but the latter should blend over the 
dropshadow.  If we force pixels to blot out the shadow based on "alpha > 
0" then the AA edge pixels would blot out the drop shadow as well and 
leave a halo between the object and the drop shadow.

- How to tell the difference between 0% alpha due to a gradient that 
cycles through transparency and an area where "the shape didn't even try 
to draw"?

Basically, if dropshadow were a property directly on a small list of 
shapes, then we could implement it by calculating coverage on the shapes 
independently and using it as a mask against the dropshadow, but our 
dropshadow is a pixel effect on an arbitrary node, or group of nodes and 
so it can only deal with pixels.

We might be able to eventually work out a system whereby a group of 
nodes can calculate coverage independently of rendered colors and then 
we could use that in the effects, but that is not an easy solution to 
add to our architecture...

(I should copy this additional info into the Jira...)

			...jim

On 3/28/14 7:21 AM, Robert Fisher wrote:
> Hi everyone,
> 
> I'm have some problems mixing transparency and drop-shadow together. Suppose I want \
> to create a transparent white rectangle with a subtle drop-shadow effect. If I \
> create a rectangle with a transparent white fill and a light grey drop-shadow, I \
> get something like in the left picture (with a red rectangle added to show the \
> transparency): 
> http://i.imgur.com/DSAPckE.png
> 
> What I want is something like in the right picture, i.e. the drop-shadow is just \
> around the outside and doesn't colour the entire rectangle grey. 
> In the right picture I "fixed" things by splitting the rectangle into two \
> rectangles in the same position, one with a null fill and drop-shadow, and one with \
> a transparent white fill and no drop-shadow. 
> The problem is when I have a large group of shapes and other nodes that I want to \
> apply a single drop-shadow to, this kind of "fix" becomes impossible or at least \
> extremely inelegant. 
> Is there any nice way to apply a drop-shadow only to the edges of an object?
> 
> Thanks in advance,
> Rob
> 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic