views:

335

answers:

1

Hi,

I have run into a small graphics glitch in Flash. It seems to be both in FP9 - Exported via Flash CS3, and FP10 - Exported via the Flex 4 beta SDK.

The glitch / problem manifests itself as embedded text at a small point size "blooming" under certian conditions. It basically looks like the antialiasing becomes fatter at some level of text brightness. I have made a small test case below. (Obviously) You will need to embed the Arial font in your compiled SWF for the below code to work.

var myText:TextField = new TextField();
myText.embedFonts = true;
myText.antiAliasType = AntiAliasType.ADVANCED;
myText.autoSize = TextFieldAutoSize.LEFT;
var myFormat:TextFormat = myText.getTextFormat();
myFormat.size = 8;
myFormat.font = 'Arial';
myFormat.color = 0x663300;
myText.defaultTextFormat = myFormat;
myText.text = 'Bloom Example';
addChild(myText);
var composit:ColorTransform = new ColorTransform();
var timestamp:Number = getTimer();
function enterFrame (event:Event):void{
    var n:Number = (getTimer() - timestamp) / 1000.0;
    composit.redMultiplier = 1-n;
    composit.greenMultiplier = 1-n;
    composit.blueMultiplier = 1-n;
    composit.redOffset = 250 * n;
    composit.greenOffset = 250 * n;
    composit.blueOffset = 0;
    myText.transform.colorTransform = composit;
    if ( n >= 1 ) removeEventListener(Event.ENTER_FRAME, enterFrame);
};
addEventListener(Event.ENTER_FRAME, enterFrame);

You can see an example of the problem by rolling over the graphical element here: http://bandcamp.fieldsofnoise.org/dump/bloom.swf

It's not really an option to change to AntiAliasType.NORMAL as it makes the text way less readable at this point size.

Any help finding an appropriate resolution to this problem would be appreciated.

A: 

I think when you change the brightness then you're maxing out the values for all pixels the font is rendered with including the anti-aliasing pixels. Have you tried changing the color rather than increasing the brightness? Or even applying a simple tint?

defmeta
The external SWF version that I link is a 'simple tint'. It's doing mathematically the equivilent of what I amd oing with the composit color transform.
Jotham