Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] SWT ImageData -- How to obtain number of channels


Hi, all:

I'm wondering how I can obtain the number of channels for a loaded image, using SWT technology.

Let's have a look at the following website first.
www.eclipse.org/articles/Article-SWT-images/graphics-resources.html#ImageData

By using 

ImageData ideaImageData = new ImageData(
    getClass().getResourceAsStream("Idea.jpg"));

we loaded an image and stored in 
ImageData ideaImageDat

In Eclipse' documentation at
help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/overview-summary.html

Nothing can be found to tell "number of image channels", in the class "ImageData".

What I would like to find is something like a function getNbOfChannels();

If the loaded image "idea.jpg" is a color image, then, the function returns 3
If it is a gray image, then, the function returns 1.


Can anybody help to give me a hand ?

Cheers
JIA Pei


--
Welcome to Vision Open
http://www.visionopen.com

Back to the top