[Vm-dev] BitBlt looking for rule blitting an alpha mask + constant color

Igor Stasenko siguctua at gmail.com
Sat Jun 20 10:38:09 UTC 2009


2009/6/20 Juan Vuletich <juan at jvuletich.org>

>
> Hi Folks,
>
> Andreas Raab wrote:
>
>>
>> Igor Stasenko wrote:
>>
>>> 2009/6/20 Andreas Raab <andreas.raab at gmx.de>:
>>>
>>>> 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.
>>>> ].
>>>>
>>>
>>> That is possible, but the price is generating a color map each time
>>> the color changes :(
>>> Much less price than converting/using 32 bpp, but still is not perfect :)
>>>
>>
>> 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
> combination.
>

Thanks for reply, Juan.
Yes, i did the color mapping and using rule 24 to blit the 8-bit opacity
maps.
But i'm still unhappy with that: there is no reason for doing that , if rule
41 would work as expected :(


>
> Cheers,
> Juan Vuletich
>



-- 
Best regards,
Igor Stasenko AKA sig.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20090620/34ed7c43/attachment.htm


More information about the Vm-dev mailing list