<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Hi ,<BR>
The way the new bitBlt mode works is as follows.<BR>
<BR>
The source bitmap is treated as a mask that contains the alpha values for each sub-pixel ( Red, Green, and Blue) individually.<BR>
There are 8 bits per sub-pixel, i.e. 24 bits per pixel.<BR>
<BR>
The text foreground color is specified separately.<BR>
<BR>
The alpha blending then takes place individually for each red, green & blue sub-pixel.<BR>
<BR>
The formula is this...<BR>
<BR>
dst.A = colorAlpha + (1 - colorAlpha) * dst.A<BR> dst.R = color.R * mask.R * colorAlpha + (1 - (mask.R * colorAlpha)) * dst.R<BR> dst.G = color.G * mask.G * colorAlpha + (1 - (mask.G* colorAlpha)) * dst.G<BR> dst.B = color.B * mask.B * colorAlpha + (1 - (mask.B* colorAlpha)) * dst.B<BR>
(color and colorAlpha are the text color, and its translucency, and apply to all pixels)<BR>
<BR>
<BR>
Using this formula, when black text is rendered on a white background, some of the pixels become 'coloured'. Typically, this results in red fringes on the left edges if a glyph, and blue fringes on the right. It is this colour fringing that 'fools the eye' into seeing sharper text on an LCD screen. <BR>
<BR>
It is possible to replicate this effect by storing these 'coloured' glyphs, and rendering them using the existing bitBlt rules, and, for black text on a white background, it will give the correct result.<BR>
<BR>
But, when these same glyphs are rendered to a black background (i.e. black text on a black background), the colour fringes in the resulting output are still visible. This is of course wrong; black text on a black background should result in a completely black result with no glyphs visible at all. <BR>
<BR>
It would be possible to use the existing bitBlt modes if the background colour was known in advance. In this case glyphs could be created and cached for each foreground/background combination.<BR>
But, this is usually not the case. The background might be a gradiant , or an image, or some other pattern.<BR>
<BR>
Furthermore, the text colour may not be black - it can be any colour with any level of translucency. <BR>
<BR>
I believe that the existing bitBlt rules are insufficient to cover all these circumstances, but I am happy to be proved wrong :)<BR>
<BR>
All the code I have written for the bitBlt mode and Freetype is MIT licensed.<BR>
<BR>
(In addition, the new bitBlt mode applies gamma correction and deals with destination depths of less than 32, but that is not really relevant to this discussion)<BR>
<BR>
Cheers,<BR>
Andy<BR>
<BR>
.<BR><BR><BR> <BR>> Date: Wed, 20 May 2009 13:32:11 -0700<BR>> From: andreas.raab@gmx.de<BR>> To: vm-dev@lists.squeakfoundation.org<BR>> Subject: Re: [Vm-dev] Fwd: [Pharo-project] New Pharo based on core 10309 with antialiased fonts<BR>> <BR>> <BR>> Bryce Kampjes wrote:<BR>> > On Tue, 2009-05-19 at 23:29 -0700, Andreas Raab wrote:<BR>> >> David T. Lewis wrote:<BR>> >>> I don't really know the background on this, but assuming that this is<BR>> >>> an incremental change to BitBltSimulation, and that the changes are<BR>> >>> MIT licensed, and also that they are in need of a home, then adding them<BR>> >>> to the VMMaker package would be the right thing to do.<BR>> >>><BR>> >>> Andreas should have veto rights, as I believe that he is the author<BR>> >>> of BitBltSimulation.<BR>> >> The original author of BBSim is of course Dan. My only question about <BR>> >> these changes is that I'm not sure what they're actually doing - it <BR>> >> looks like rgbMul:with: except that it's been unrolled for various <BR>> >> cases. Does anyone know what these changes are supposed to be doing, <BR>> >> where they are used, and why rgbMul:with: is not sufficient?<BR>> > <BR>> > The changes are Andy Tweens extensions for subpixel anti-aliassing for<BR>> > freetype. I'm not sure why rgbMul:with: isn't sufficient.<BR>> <BR>> Do you know if he's around to shed some light on it?<BR>> <BR>> Cheers,<BR>> - Andreas<BR><br /><hr />Get the New Internet Explore 8 Optimised for MSN. <a href='http://extras.uk.msn.com/internet-explorer-8/?ocid=T010MSN07A0716U' target='_new'>Download Now</a></body>
</html>