[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform.swt] Saving TIFF images

There are some classes that suport TIFF images in SWT, but I'm confused about their implmentation. There is a funcion in TIFFDirectory that looks as if it supports some sort of TIFF saving, but the code is peculiar. Here's what I've found:

In the function writeToStream in TiffDirectory, the following check is done:

if (image.scanlinePad != 1) SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);

However, when getImageData the Image object mathces the SWT.BITMAP case and ends up getting to this line (on line 1392 of Image.class):

ImageData imageData = new ImageData(width, height, depth, palette, 4, data);

where the "4" is hard coded for the scalinePad.

So, when I try to use the following code to save a TIFF image, get an error:

ImageLoader imageLoader = new ImageLoader();
imageLoader.data = new ImageData[] {model.getImageData()};
imageLoader.save(ei.path.toOSString(), SWT.IMAGE_TIFF);

My first question is, with this setup, how can an image loaded from a TIFF into an SWT Image *ever* pass the check in TiffDirectory?

My second question is, how can I save a TIFF image?

I'm using eclipse 3.1M7.

Dan