Quantcast
Channel: Northwoods Software - Latest topics
Viewing all articles
Browse latest Browse all 7417

Compositing layers and alpha blending

$
0
0

@Luddy wrote:

Hi,

I have a diagram whose nodes consist of a Node with a Picture inside. The image is generated using WebGL, and drawImage is used to place it in the 2D context of the Picture’s element. I use zOrder to establish a relative layer order among nodes where that matters. Everything is basically working fine.

The images have an alpha component that is used to anti-alias the edges of what’s drawn. The issue I’m having is an unusual behavior as I drag images over one another, namely, where the upper layer has some transparency due to alpha, and if the colors (rbg components) of the layers are too similar in the region of transparency, then the pixels that should be alpha-blended instead become black, as if to enhance the edge contrast. I can see the behavior most clearly with this kind of test: I create say a green circle at zOrder = 0. I then create a gradient rectangle that changes from green to red, at zOrder = -1. As I drag the gradient behind the circle, when there is green/red overlap at the edge of the circle, the alpha blending works as expected. When there is red/red overlap at the edge of the circle, the pixels that are anti-aliased (have alpha less than full scale) turn black, so that the very edge of the circle turns black.

I can imagine this happening in response to overflow in the red component somehow (spilling over?) Or I can imagine a kind of color-dodging compositing mode being used on purpose. In any event, I’m wondering if (a) you know what might be causing this, and (b) how I might turn it off in favor of ordinary color-blind alpha blending.

Thanks,

-Luddy

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7417

Trending Articles