<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>
&nbsp;<BR>
The source bitmap is treated as a mask that contains the alpha values for each sub-pixel ( Red, Green, and&nbsp;Blue) individually.<BR>
There are 8 bits per sub-pixel, i.e. 24 bits per pixel.<BR>
&nbsp;<BR>
The text foreground color is specified separately.<BR>
&nbsp;<BR>
The alpha blending then takes place individually for each red, green &amp;&nbsp;blue sub-pixel.<BR>
&nbsp;<BR>
The formula is this...<BR>
&nbsp;<BR>
&nbsp;dst.A =&nbsp; colorAlpha + (1 - colorAlpha) * dst.A<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dst.R = color.R * mask.R * colorAlpha + (1 - (mask.R * colorAlpha)) * dst.R<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dst.G = color.G * mask.G * colorAlpha + (1 - (mask.G* colorAlpha)) * dst.G<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dst.B = color.B * mask.B * colorAlpha + (1 - (mask.B* colorAlpha)) * dst.B<BR>
(color and colorAlpha are the text color, and&nbsp;its translucency, and apply to all pixels)<BR>
&nbsp;<BR>
&nbsp;<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>
&nbsp;<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>
&nbsp;<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>
&nbsp;<BR>
It&nbsp;would be possible to use the existing bitBlt modes&nbsp;if the background colour was known in advance.&nbsp;In this case glyphs could be created and cached for each foreground/background combination.<BR>
But, this is usually not the case. The background&nbsp;might be a gradiant , or an image, or some other pattern.<BR>
&nbsp;<BR>
Furthermore, the text colour may not be black - it can be any colour with any level of translucency. <BR>
&nbsp;<BR>
I believe that the existing bitBlt rules are insufficient to cover all these circumstances, but I am happy to be proved wrong :)<BR>
&nbsp;<BR>
All the code I have written for the bitBlt&nbsp;mode and Freetype is MIT licensed.<BR>
&nbsp;<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>
&nbsp;<BR>
Cheers,<BR>
Andy<BR>
&nbsp;<BR>
.<BR><BR><BR>&nbsp;<BR>&gt; Date: Wed, 20 May 2009 13:32:11 -0700<BR>&gt; From: andreas.raab@gmx.de<BR>&gt; To: vm-dev@lists.squeakfoundation.org<BR>&gt; Subject: Re: [Vm-dev] Fwd: [Pharo-project] New Pharo based on core 10309 with antialiased fonts<BR>&gt; <BR>&gt; <BR>&gt; Bryce Kampjes wrote:<BR>&gt; &gt; On Tue, 2009-05-19 at 23:29 -0700, Andreas Raab wrote:<BR>&gt; &gt;&gt; David T. Lewis wrote:<BR>&gt; &gt;&gt;&gt; I don't really know the background on this, but assuming that this is<BR>&gt; &gt;&gt;&gt; an incremental change to BitBltSimulation, and that the changes are<BR>&gt; &gt;&gt;&gt; MIT licensed, and also that they are in need of a home, then adding them<BR>&gt; &gt;&gt;&gt; to the VMMaker package would be the right thing to do.<BR>&gt; &gt;&gt;&gt;<BR>&gt; &gt;&gt;&gt; Andreas should have veto rights, as I believe that he is the author<BR>&gt; &gt;&gt;&gt; of BitBltSimulation.<BR>&gt; &gt;&gt; The original author of BBSim is of course Dan. My only question about <BR>&gt; &gt;&gt; these changes is that I'm not sure what they're actually doing - it <BR>&gt; &gt;&gt; looks like rgbMul:with: except that it's been unrolled for various <BR>&gt; &gt;&gt; cases. Does anyone know what these changes are supposed to be doing, <BR>&gt; &gt;&gt; where they are used, and why rgbMul:with: is not sufficient?<BR>&gt; &gt; <BR>&gt; &gt; The changes are Andy Tweens extensions for subpixel anti-aliassing for<BR>&gt; &gt; freetype. I'm not sure why rgbMul:with: isn't sufficient.<BR>&gt; <BR>&gt; Do you know if he's around to shed some light on it?<BR>&gt; <BR>&gt; Cheers,<BR>&gt; - 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>