[Vm-dev] BitBlt looking for rule blitting an alpha mask + constant
juan at jvuletich.org
Sun Jun 21 14:56:45 UTC 2009
Igor Stasenko wrote:
> 2009/6/20 Juan Vuletich <juan at jvuletich.org <mailto:juan at jvuletich.org>>
> Hi Folks,
> Andreas Raab wrote:
> It's utterly trivial to cache it. If you're using this for
> font display you'll only have a few colors to deal with so the
> cache won't be big.
> You can see how to do all this in Cuis. It is what I do for font
> rendering. Take a look at GrafPort >>
> installStrikeFont:foregroundColor: . This works ok with source
> forms of any depth. For 8 bpp (and lower), it is considered to
> hold opacity (i.e. 1-alpha). It is trivial to adjust the colormaps
> for alpha instead. Take a look at the execution path for
> "(Preferences subPixelRenderFonts and: [ foregroundColor = Color
> black or: [ Preferences subPixelRenderColorFonts ]]) ifTrue: [". I
> use two passes of bitblt. The first one is rgbMul, the second is
> rgbAdd. Together they do the proper AA as you specified it. This
> only works for destForm of 16 or 32 bpp. On 8bpp or less
> destination, I just use paint rule.
> If you want to test it with a soureForm that includes only
> opecity, evaluate
> StrikeFont allInstances do: [ :f | f
> setGlyphsDepthAtMost: 4 ].
> You'll see that it works ok for any font color / background color
> Thanks for reply, Juan.
> Yes, i did the color mapping and using rule 24 to blit the 8-bit
> opacity maps.
You're right. The 'extra' stuff in Cuis is for subpixel AA. Many people
feels it makes stuff look nicer, and FreeType does it nicely. It would
be great if you implemented it as an option.
> But i'm still unhappy with that: there is no reason for doing that ,
> if rule 41 would work as expected :(
Rule 41 needs a bmp with alpha (not opacity). That makes it impossible
to use the same form for any bitdepth, with or without subpixel or whole
My "two pass" approach is way more flexible. Play a bit with text
rendering in Cuis. Experiment with fonts of different bit depths, on
various Display depths, with the #subPixelRenderFonts and
#subPixelRenderColorFonts preferences, and with various fonts /
background colors. I believe I finally got it right, and that my
approach deserves being used for rendering FreeType fonts too. I believe
the flexibility outweighs the performance penalty of the second pass
(that is not needed for black text, btw).
More information about the Vm-dev