Transparency and drop-shadow
james.graham at oracle.com
Fri Mar 28 23:12:57 UTC 2014
This is one of the earliest bugs filed against the effects package:
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
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...)
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):
> 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,
More information about the openjfx-dev