Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsImageLoader save()
https://www.eclipse.org/forums/index.php/mv/msg/148489/467167/#msg_467167
Originally posted by: john.brecht.sri.com
I am having trouble using ImageLoader to save images. My application
includes a basic sketching tool. When it is time to save the image they
have drawn, I render it to an offscreen GC/Image. Then I use the
following code to save it:
ImageLoader loader = new ImageLoader();
ImageData imgData = image.getImageData();
loader.data = new ImageData[]{imgData};
loader.save(fileName, SWT.IMAGE_JPEG);
When I do this with SWT.IMAGE_PNG, I get an exception that say PNG is
not supported. Interestingly enough, there does in fact exist a
PNGFileFormat class that is part of the stack trace of this exception.
Closer examination reveals the following:
void unloadIntoByteStream(ImageData p1) {
SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);
}
So, even though the implementation has been made as claimed in other
docs, it is incomplete in a critical way, so incomplete I can't
understand why it is part of the distribution.
When I do this with SWT.IMAGE_JPEG, my processor jacks up to 100% and
the application then hangs.
When I do this with SWT.IMAGE_GIF, I get an error that the depth is
unsupported. Apparently, the GC draw commands create 32 bit images.
So, is there any known working way to create and save images using SWT?
Is there some way to change the bit depth of ImageData so I can at least
use GIFs? (Assuming GIFs work once I get a low enough bit depth.)
thanks,
john]]>2006-01-26T00:57:57-00:00Re: ImageLoader save()
https://www.eclipse.org/forums/index.php/mv/msg/148489/467169/#msg_467169
Originally posted by: john.brecht.sri.com
Oops, actually JPEG works, the hanging was a side issue. Nonetheless,
JPEG is not an appropriate format for this application, so if anyone can
provide info on get PNG or GIF to work (preferably PNG), please let me know.
-john
John Brecht wrote:
> I am having trouble using ImageLoader to save images. My application
> includes a basic sketching tool. When it is time to save the image they
> have drawn, I render it to an offscreen GC/Image. Then I use the
> following code to save it:
>
> ImageLoader loader = new ImageLoader();
> ImageData imgData = image.getImageData();
> loader.data = new ImageData[]{imgData};
> loader.save(fileName, SWT.IMAGE_JPEG);
>
>
> When I do this with SWT.IMAGE_PNG, I get an exception that say PNG is
> not supported. Interestingly enough, there does in fact exist a
> PNGFileFormat class that is part of the stack trace of this exception.
> Closer examination reveals the following:
> void unloadIntoByteStream(ImageData p1) {
> SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);
> }
>
> So, even though the implementation has been made as claimed in other
> docs, it is incomplete in a critical way, so incomplete I can't
> understand why it is part of the distribution.
>
> When I do this with SWT.IMAGE_JPEG, my processor jacks up to 100% and
> the application then hangs.
>
> When I do this with SWT.IMAGE_GIF, I get an error that the depth is
> unsupported. Apparently, the GC draw commands create 32 bit images.
>
> So, is there any known working way to create and save images using SWT?
> Is there some way to change the bit depth of ImageData so I can at least
> use GIFs? (Assuming GIFs work once I get a low enough bit depth.)
>
> thanks,
> john]]>2006-01-26T01:21:44-00:00Re: ImageLoader save()
https://www.eclipse.org/forums/index.php/mv/msg/148489/467196/#msg_467196
https://bugs.eclipse.org/bugs/show_bug.cgi?id=24697 to track progress.
Carolyn
"John Brecht" <john.brecht@sri.com> wrote in message
news:dr9836$bq7$1@utils.eclipse.org...
> Oops, actually JPEG works, the hanging was a side issue. Nonetheless,
> JPEG is not an appropriate format for this application, so if anyone can
> provide info on get PNG or GIF to work (preferably PNG), please let me
know.
>
> -john
>
> John Brecht wrote:
> > I am having trouble using ImageLoader to save images. My application
> > includes a basic sketching tool. When it is time to save the image they
> > have drawn, I render it to an offscreen GC/Image. Then I use the
> > following code to save it:
> >
> > ImageLoader loader = new ImageLoader();
> > ImageData imgData = image.getImageData();
> > loader.data = new ImageData[]{imgData};
> > loader.save(fileName, SWT.IMAGE_JPEG);
> >
> >
> > When I do this with SWT.IMAGE_PNG, I get an exception that say PNG is
> > not supported. Interestingly enough, there does in fact exist a
> > PNGFileFormat class that is part of the stack trace of this exception.
> > Closer examination reveals the following:
> > void unloadIntoByteStream(ImageData p1) {
> > SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);
> > }
> >
> > So, even though the implementation has been made as claimed in other
> > docs, it is incomplete in a critical way, so incomplete I can't
> > understand why it is part of the distribution.
> >
> > When I do this with SWT.IMAGE_JPEG, my processor jacks up to 100% and
> > the application then hangs.
> >
> > When I do this with SWT.IMAGE_GIF, I get an error that the depth is
> > unsupported. Apparently, the GC draw commands create 32 bit images.
> >
> > So, is there any known working way to create and save images using SWT?
> > Is there some way to change the bit depth of ImageData so I can at least
> > use GIFs? (Assuming GIFs work once I get a low enough bit depth.)
> >
> > thanks,
> > john]]>Carolyn MacLeod2006-01-26T09:04:18-00:00