Community
Participate
Working Groups
Attached you'll find a project which demonstrates an SWT for an image which opens perfectly in other image programs but fails on SWT. There's only one image loading implementation which allows to load the image which is the purely native one new Image(Display,String) but because I need to show an animated give this doesn't help me a lot. You'll have to adjust the path to the image for to make new Image(Display,String) work for you
Created attachment 176543 [details] Example project
Carolyn owns image loader bugs. I verified this fails on Cocoa in HEAD. Exception is: Loading image with stream failed. org.eclipse.swt.SWTException: Invalid image at org.eclipse.swt.SWT.error(SWT.java:4083) at org.eclipse.swt.SWT.error(SWT.java:3998) at org.eclipse.swt.SWT.error(SWT.java:3969) at org.eclipse.swt.internal.image.GIFFileFormat.getExtensions(GIFFileFormat.java:156) at org.eclipse.swt.internal.image.GIFFileFormat.loadFromByteStream(GIFFileFormat.java:124) at org.eclipse.swt.internal.image.FileFormat.loadFromStream(FileFormat.java:48) at org.eclipse.swt.internal.image.FileFormat.load(FileFormat.java:84) at org.eclipse.swt.graphics.ImageLoader.load(ImageLoader.java:130) at org.eclipse.swt.graphics.ImageDataLoader.load(ImageDataLoader.java:22) at org.eclipse.swt.graphics.ImageData.<init>(ImageData.java:331) at org.eclipse.swt.graphics.Image.<init>(Image.java:502) at ImageLoaderTest.main(ImageLoaderTest.java:19)
Cool GIF. 74 images. I can comment out one line (the one that throws the error), and get it to (mostly) work. There seems to be an unknown extension in the final image that has an id of "254". I am out of time to look at this today, so I will get back to it on Friday.
Fixed > 20120625 for 4.3 M1 Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=ff9c15961deba7f09d9b58b96d5ee00c19a9ff6f (Re: comment 3): OK, "Friday" was a while ago... sorry about that. It turns out that the attached gif does not conform to the GIF spec, and even Firefox and Windows Picture Viewer fail to read the entire file. However, since they both salvage the gif by reading in as much as they can, and they can still animate the images up to the point where it is broken (image #74 of the animation), I decided to do the same thing. So this patch makes our gif loading code a little more lenient, and your gif will (mostly) load.