Premultiplied Colour Blending
Posted: Sat Dec 05, 2020 12:16 pm
Purebasic gives the possibility to display a sprite in a certain monochrome color.
The idea behind this (IMHO) must be to display it in combination with the same sprite in a certain blending mode to colorize.
Most of the time this works! So, I must be on the right track...
But something is weird and I think it has to do with the fact that the monochrome colored sprite's RGB component isn't premultiplied with it's alpha component.
Let me explain:
I draw the original sprite first like this
And then I layer the same sprite over it like this
I can also use this for the second sprite :
Both methods give different results depending on the ClearScreen(Color).
So my questions :
- Is it true that Purebasic monochrome colored sprites are ment to be used for color compositing?
- Why no premultiply?
Hope this makes sense...
A nice explanation what I try to achieve :
http://amindforeverprogramming.blogspot ... nding.html
Code: Select all
DisplayTransparentSprite(#Sprite, x, y [, Intensity [, Color]])Most of the time this works! So, I must be on the right track...
But something is weird and I think it has to do with the fact that the monochrome colored sprite's RGB component isn't premultiplied with it's alpha component.
Let me explain:
I draw the original sprite first like this
Code: Select all
SpriteBlendingMode(#PB_Sprite_BlendSourceAlpha,#PB_Sprite_BlendInvertSourceAlpha)
DisplayTransparentSprite(#Sprite,x,y,Alpha)
Code: Select all
SpriteBlendingMode(#PB_Sprite_BlendDestinationColor,#PB_Sprite_BlendInvertSourceAlpha)
DisplayTransparentSprite(#Sprite,x,y,255, Color)
Code: Select all
SpriteBlendingMode(#PB_Sprite_BlendDestinationColor,#PB_Sprite_BlendInvertDestinationAlpha)
DisplayTransparentSprite(#Sprite,x,y,255, Color)
So my questions :
- Is it true that Purebasic monochrome colored sprites are ment to be used for color compositing?
- Why no premultiply?
Hope this makes sense...
A nice explanation what I try to achieve :
http://amindforeverprogramming.blogspot ... nding.html