[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mac 32 bit color depth?



Hey guys,

OK, this has come up for a few people recently, here is what is up.

Pavel is correct when he states that the Mac only has 32bit modes for both
the screen and offsceen buffers. The fourth byte is commonly termed the
Alpha component of the color and is often used as a transparency value.

The standard mac format for a "true color" pixel is then ARGB, this
denotes the layout of the pixel in memory (ie: if you look at the raw
frame buffer for the screen, the first byte is the alpha value, the second
byte is the red component of the color, the third the green component, the
fourth the blue, the next the alpha component of the second pixel and so
on).

In the classic QuickDraw 2d graphic system found on all color Macs since
the MacII, the alpha value is not used or preserved by any of the
QuickDraw routines however, it does aid in aligning the pixels to word
boundaries which modern processors prefer. In MacOS X, the new Quartz 2d
system, does use and preserve the alpha byte for all of it's cool
transparency effects. There again, "true color" uses 32bit pixels.

Now, for the IDL GR1 programmer, this information is not that useful since
IDL's RGB model does not support the alpha byte (which is unfortunate
since under OS X it would allow for some very cool transparency effects).
So in effect you are dealing with a 24bit color model.

I am not averse to returning the "usable" (from an IDL standpoint) visual
depth from get_visual_depth which would be 24 (essentially ignoring the
fact that on the Mac, all "true color" buffers are in fact 32bits) for the
sake of portability.

--
Thierry Faucounau
Research Systems, Inc.

In article <3AB8E61F.687DA6FD@noaa.gov>, "Pavel A. Romashkin"
<pavel.romashkin@noaa.gov> wrote:

> I hope that Thierry answeres this one.
> I for one can say that yes, on the Mac you seem to only have a 32 bit
> color depth as your true color option, unlike PCs where you can choose
> between 24 and 32 bit.
> I have had different information for what the fourth bit is used for. It
> may be used for transparency calculations, this is what all new hot 3D
> game accelerators do (I may be wrong in the exact terms). Photoshop help
> says the following:
> "In most cases, Lab, RGB, grayscale, and CMYK images contain 8 bits of
> data per color channel. This translates to a 24-bit Lab bit depth (8
> bits x 3 channels); a 24-bit RGB bit depth (8 bits x 3 channels); an
> 8-bit grayscale bit depth (8 bits x 1 channel); and a 32-bit CMYK bit
> depth (8 bits x 4 channels). Photoshop can also read and import Lab,
> RGB, CMYK, and grayscale images that contain 16 bits of data per color
channel."
> I am not sure how does Photoshop use the four available screen bytes, as
> all I can imagine the monitor can do is RGB. Maybe Photoshop calculates
> the approximate CMYK and does not use the other byte. But TV and TVRD do
> not work properly on a 32 bit screen, and I think it is because a blank
> fourth byte is being read by TVRD.
> Hope this helps.
> Pavel
> 
> Wayne Landsman wrote:
> > 
> > I have a simple program that tries to reset the default value of
> > !P.COLOR for the current (Mac, Win or X) device using the following
> > code:
> > 
> > device, get_visual_depth=depth
> > !P.Color = 256L^(depth/8) - 1
> > 
> > I am told that this fails on IDL V5.4 on a Mac since
> > device,/get_visual_depth returns a value of 32 (whereas !P.COLOR is
> > 256L^24 -1).   Can other Mac users verify this?      What is the meaning
> > of a 32 bit  visual depth?
> > 
> > Thanks,  --Wayne
> > 
> > Wayne
> > Landsman
> > landsman@mpb.gsfc.nasa.gov