I’m trying to use setMaskLevel in Ming, to mask a jpeg, unfortunately I can’t find anything useful on the subject. Best bet was gazb’s site, but so far I can’t understand anything. I don’t think this function does what I need it to, I think it simply allows you to set a mask shape from a sprite, but has nothing to do with bitmaps.

Thankfully, Flash 8 has the power. I’ve been hacking away at it for awhile, getting totally stumped by the 16 and 32 bit color value syntax. Here are a couple of examples:

32-bit hexadecimal

0x00000000 - transparent value

0xFFFFFFFFF - white

0xFF000000 - black

0xFFFFCC00 - red

24-bit hexadecimal

0xFFCC00 - yellow

16-bit hexadecimal#FFFFFF - white

In the 32-bit hexadecimal color syntax used by Flash 8’s bitmap api, the first two characters 0x are just a flag identifier. The next 8 characters are alpha (transparency), red, green, and blue; two characters for each index.

Adobe’s Flash API article on pixel color.

Wikipedia Web Colors Guide

Reducing JPEG Artifacts when using transparenct

I’m really excited about the new bitmap features in Flash. Very cool stuff. One thing I like is the ability to convert a jpeg into a generic bitmap, and then set the alpha channel of the pixels within it. This works very well, but due to the way jpegs optimize images, they do not mesh well with alpha layers. To work around this, I’ve devised a strategy for images on white backgrounds with the goal of making the white transparent.

  1. Make all the pure white fully transparent.

  2. Create a loop to scroll through several “close to white” values, setting the alpha layer for each color value.

  3. Starting at 100%, reduce the transparency the further away from pure white the values go.

This doesn’t result in a perfect anti-aliased solution, but it does work well for its simplicity.