[Vm-dev] BitBlt looking for rule blitting an alpha mask + constant
andreas.raab at gmx.de
Sat Jun 20 00:01:25 UTC 2009
Easy. Make a color map that is set up such that
cmap := Bitmap new: 256.
0 to: 255 do:[:i|
cmap at: i+1 put: (constColor alpha: i/255.0) pixelValue32.
Then BitBlt with that color map and Form blend. If you have more than 8
bit input, first create a ColorMap which extracts only the alpha component.
Igor Stasenko wrote:
> to what i see, there is no rule, which can use following formula:
> result = constanColor * srcAlpha + (destColor * ( 1-srcAlpha))
> where scrAlpha is taken from source form, and if source form is 8 bit
> depth, it is assumed that form contains no RGB data, only alpha
> A rule 41 is more generic, but requires to convert a source form to
> 32bpp before blitting :(
> Maybe it worth modifying rule 41 to allow 8bit forms?
> Or maybe its worth introducing a new one?
> What you think?
> This new rule is essentially useful for freetype plugin, which
> receives an opacity mask from freetype library.
> But unfortunately, because we don't have such rule, we can't use a
> bitmap, produced by freetype, directly unless converting it to 32bpp.
> Or maybe we can, but looking at freetype font cache code, it seems
> that every form is converted to 32bpp before placing in cache.
> Being able to operate with 8bpp alpha-masks will reduce a memory
> footprint & increase rendering speed considerably.
More information about the Vm-dev