From: Toby D. <tj...@sf...> - 2005-05-15 04:14:22
|
Daryl, Yes it, would be good to fix this. If I recall correctly, the status of alpha values for basic graphic file formats are: JPEG: no alpha information stored GIF: 1 bit per pixel of alpha information PNG: 8 bits per pixel of alpha information So storing 8-bit alpha values will use up a little more memory in the case of JPEG and GIF images, but it's probably not a big deal. It might be best to make the default TYPE_INT_ARGB, and then provide a constructor option that lets you set it to TYPE_INT_RGB in case someone wants to conserve memory. If you do want add these alpha values, then you should start with a demo program that shows how different alpha values will be displayed in TheMatrix. Indeed, a set of carefully created examples will probably help explain and clarify these tricky alpha value issues. I'll add the alpha values issue as a feature for you ... Toby On 5/14/05 9:55 AM, "Daryl Van Humbeck" <dva...@sf...> wrote: > I just realized that TheMatrix isn't saving Alpha values that it's given. > > When the BufferedImage is created in utils.Utilities.java, it's created > with type TYPE_INT_RGB, which doesn't save Alpha values, instead of > TYPE_INT_ARGB, which does. > > Also, to create a Color object from an RGBA packed integer, using new > Color(int) ignores the Alpha value, when you use new Color(int, boolean > true) it actually copies it. > > Another thing is when you're drawing an image with transparent pixels > onto another image (see utils.Utilites.java, method BufferedImage > makeBufferedImage(Image image, int image_type)) it doesn't copy the > Alpha values, it just blends the pixels with alpha values with the color > that's already there (usually black), which probably isn't what we want, > is it? > > I found this out by reading the JavaDocs, looking for information for > another project I'm working on (if you want to know, NQL, Not Quite Liero). > > If you want these problems fixed, I think I'd like to volunteer (unless > you think I'm working on too much already). > > Daryl. > -- Dr. Toby Donaldson School of Computing Science Simon Fraser University |