Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Color depths in images

Hi,

Can anyone tell me about maximum color depths for indexed images.
According to the ImageData javadoc for depth.

"Note that a depth of 8 or less does not necessarily mean that the image
is palette indexed, or conversely that a depth greater than 8 means that
the image is direct color."

But when I attempt to save a 16 bit indexed ImageData to an Image I get
an Unsupported" color depth" SWTException and when I read the code for
Image where the crash occurred I get the following:

	if (!(((image.depth == 1 || image.depth == 2 || image.depth == 4 ||
image.depth == 8) && !palette.isDirect) ||
		((image.depth == 8) || (image.depth == 16 || image.depth == 24 ||
image.depth == 32) && palette.isDirect)))
			SWT.error (SWT.ERROR_UNSUPPORTED_DEPTH);

which if I get my precedence and brackets correct says that 

IF (depth = 1-8 and indirect) OR depth = 8 OR (depth = 16-32 and direct)
THEN go ahead 
ELSE throw error

which tends to contradict the javadoc.

Can anyone confirm/deny this as I am developing an XPMFileFormat class
and theoretically you can have images of any supportable depth although
only an idiot would actually use an XPM image of depths above 256 as
they are horribly inefficient. If the above is true I will have to throw
an unsupported depth for large XPM images but I would rather not if
possible.

Thanks
Simon Meaden





Back to the top