Jump to content

Layer blending

Recommended Posts

I’m very curious how the layers blending engine works in Paint.NET. If I have 10 layers that all use non-normal blend operators and if I change one bottom layer with a different blending operator, all the layers above need to be recalculated and rendered again. Is it how it works ? How can layers see through each other if they are blended using non-normal blending operators but with 100% opacity ? Should two non-transparent layers are blended, the result becomes a non-transparent layer ?


Link to comment
Share on other sites

We use a 32-bit pixel model, BGRA. Blue, green, red, alpha. The alpha component specifies how transparent a pixel is, or rather, how much that pixel contributes to the composition. A pixel with an alpha value of 0 is essentially a pixel that does not exist, and therefore it follows that it would make no contribution to the rendering at that stage, and thus everything below it would "see through" regardless of the blending modes.

Since any new layer is initialized such that every pixel has an alpha of 0, it thus follows that all new layers are completely transparent regardless of blending mode.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html


Link to comment
Share on other sites

Thanks Rick. I understand that each new layer added is transparent so that layers below can be seen through. However, when you create a layer by duplicating a background with 255 opacity but non-normal blending, I do not understand how the layers below can be seen through unless the blending occurs when the layers are being rendered. In that is case, layers are no seen through. But since the blending occurs for each layer during rendering , the top layer reflects the layers below. If that is case, how can you manage to get the pretty good performance since if you have 10 layers, each layer needs to be blended with the layer below while it is being rendered? Is this how it works?

For ( each layer in layer list)


Render layer using blend op with layer below


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...