Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Loading ICO images(Loading ICO images with Graphics.getImage())
Loading ICO images [message #512906] Mon, 08 February 2010 10:30 Go to next message
Tiber Sept is currently offline Tiber SeptFriend
Messages: 32
Registered: February 2010
Member
Hi,

I am writing a RAP application and have a problem loading some ICO images. Unfortunately converting them to PNG or anything else does not seem to be an option.

Basically the following code in a RAP application:
 String imgNam = ...
 byte[] icoDat = ...
 ...
 Graphics.getImage( imgNam, new ByteArrayInputStream( icoDat ) );

throws the Exception:
java.lang.IllegalArgumentException: Empty region!
	at javax.imageio.ImageReader.computeRegions(Unknown Source)
	at com.sun.imageio.plugins.wbmp.WBMPImageReader.read(Unknown Source)
	at javax.imageio.ImageIO.read(Unknown Source)
	at javax.imageio.ImageIO.read(Unknown Source)

Loading the images in an SWT application with:
new Image(display, new ByteArrayInputStream( icoDat ) );

works just fine. I tried the same code in RAP but got the aforementioned exception.

Is the wrong JAI plug-in being picked here ? I guess that the ICO images are really partially corrupt, but they are still loaded by a legacy application and the SWT application, so I would like to be able to do the same in RAP.

I would be grateful for any help.




Re: Loading ICO images [message #512927 is a reply to message #512906] Mon, 08 February 2010 11:28 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 581
Registered: July 2009
Senior Member
if there weren't an exception, RAP would pass them through to the
browser. That means, the image is stored in a location on the server's
hard drive that is accessible from outside.
Ultimately it is the browser that displays images. Thus before you dig
deeper into resolving the exception you should make sure that you can
display the ICO images in all relevant browsers.

HTH
Rüdiger
--
Rüdiger Herrmann
http://eclipsesource.com


On 08.02.2010 11:30, tibersept wrote:
> Hi,
>
> I am writing a RAP application and have a problem loading some ICO
> images. Unfortunately converting them to PNG or anything else does not
> seem to be an option.
> Basically the following code in a RAP application:
>
> String imgNam = ...
> byte[] icoDat = ...
> ...
> Graphics.getImage( imgNam, new ByteArrayInputStream( icoDat ) );
>
> throws the Exception:
>
> java.lang.IllegalArgumentException: Empty region!
> at javax.imageio.ImageReader.computeRegions(Unknown Source)
> at com.sun.imageio.plugins.wbmp.WBMPImageReader.read(Unknown Source)
> at javax.imageio.ImageIO.read(Unknown Source)
> at javax.imageio.ImageIO.read(Unknown Source)
>
> Loading the images in an SWT application with:
>
> new Image(display, new ByteArrayInputStream( icoDat ) );
>
> works just fine. I tried the same code in RAP but got the aforementioned
> exception.
> Is the wrong JAI plug-in being picked here ? I guess that the ICO images
> are really partially corrupt, but they are still loaded by a legacy
> application and the SWT application, so I would like to be able to do
> the same in RAP.
> I would be grateful for any help.
>
>
>
>
Re: Loading ICO images [message #512939 is a reply to message #512927] Mon, 08 February 2010 12:02 Go to previous messageGo to next message
Tiber Sept is currently offline Tiber SeptFriend
Messages: 32
Registered: February 2010
Member
Hi Rüdiger,

I did check whether the browsers can display these ICO images and all of the relevant ones actually managed fine. So I assume that passing those images to the browser will be ok. Thanks for the tip.
Re: Loading ICO images [message #512981 is a reply to message #512939] Mon, 08 February 2010 13:55 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 581
Registered: July 2009
Senior Member
note that RAP currently uses a different mechanism to load images than
SWT. In SWT there is an ImageLoader, but RAP - for historic reasons -
uses javax.imageio.
This issue is covered here:
285539: Use SWT to determine image size
https://bugs.eclipse.org/bugs/show_bug.cgi?id=285539
Feel free to attach the non-working image to this bug or file a new bug.
In the meanwhile a JAI plug-in (AC.lib-ICO [1]?) might help.

[1] http://sourceforge.net/projects/aclibico


On 08.02.2010 13:02, tibersept wrote:
> Hi Rüdiger,
>
> I did check whether the browsers can display these ICO images and all of
> the relevant ones actually managed fine. So I assume that passing those
> images to the browser will be ok. Thanks for the tip.
Re: Loading ICO images [message #512998 is a reply to message #512981] Mon, 08 February 2010 14:29 Go to previous message
Tiber Sept is currently offline Tiber SeptFriend
Messages: 32
Registered: February 2010
Member
Ok, thank you for pointing out the bug. I will try finding a workaround.
Previous Topic:The usage of function setItemMetrics() in Table.js
Next Topic:enable AJP in jetty to force request to RAP in jetty over apache http
Goto Forum:
  


Current Time: Tue Oct 08 07:07:14 GMT 2024

Powered by FUDForum. Page generated in 0.04666 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top