Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] SWT getImageData().type always -1


Please open a bug report, and give as much detail as you can, including attaching problem image files.
If possible, provide a snippet that shows the problem.
Thank-you,
Carolyn



Eric Zimmerman <eric@xxxxxxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx

11/24/2004 12:55 PM

Please respond to
platform-swt-dev

To
platform-swt-dev@xxxxxxxxxxx
cc
Subject
Re: [platform-swt-dev] SWT getImageData().type always -1





Carolyn MacLeod wrote:

>
> If you care about the type of file an Image was read from, you need to
> read it into an ImageData first, and then create your Image from that.
> (as opposed to reading directly from file into an Image). Image class
> does not retain information about where the Image originally came
> from. Only ImageData class does that.
>
>         ImageData data = "" ImageData("C:\\graphic.bmp");
>         Image image = new Image(device, data);
>         // At this point, data.type will be SWT.IMAGE_BMP
>         // and image.getImageData().type will be -1 (SWT.IMAGE_UNDEFINED)
>
> See org.eclipse.swt.examples.imageanalyzer.ImageAnalyzer (available in
> the eclipse examples zip on the eclipse download page) for an example
> that reads from file into an ImageData and then gets the Image from
> the ImageData.
>
> Carolyn

One more note on the subject of imagedata....I have found that ImageData
returns a bit depth of 8 for any image with less than this bit depth.  
The correct number of colors in the pallette is given by the length of
the colors array in pallette.  This bug/problem can cause some serious
issues when attempting to convert index - direct color pallettes.  I
have not had time to search the bug database but thought I would make
you aware of it since you are working with image data.

Ez
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top