Home » Eclipse Projects » Standard Widget Toolkit (SWT) » ImageLoader save()
ImageLoader save() [message #467167] |
Thu, 26 January 2006 00:57 |
Eclipse User |
|
|
|
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
|
|
|
Re: ImageLoader save() [message #467169 is a reply to message #467167] |
Thu, 26 January 2006 01:21 |
Eclipse User |
|
|
|
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
|
|
|
Re: ImageLoader save() [message #467196 is a reply to message #467169] |
Thu, 26 January 2006 09:04 |
Carolyn MacLeod Messages: 149 Registered: July 2009 |
Senior Member |
|
|
Please cc yourself to this bug report:
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
|
|
|
Goto Forum:
Current Time: Fri Apr 19 00:13:40 GMT 2024
Powered by FUDForum. Page generated in 0.01985 seconds
|