RE: System.Drawing.Bitmap to java.awt.Image?
From: alex (alex_at_discussions.microsoft.com)
Date: 01/10/05
- Next message: George Birbilis [MVP J#] [9880]: "Re: System.Drawing.Bitmap to java.awt.Image?"
- Previous message: HB: "Re: bug in java.util.LinkedList"
- In reply to: alex: "System.Drawing.Bitmap to java.awt.Image?"
- Next in thread: Lars-Inge Tønnessen [VJ# MVP]: "Re: System.Drawing.Bitmap to java.awt.Image?"
- Reply: Lars-Inge Tønnessen [VJ# MVP]: "Re: System.Drawing.Bitmap to java.awt.Image?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 10 Jan 2005 07:17:10 -0800
Well here's one approach that works:
1. in the projects's .resx file, change the type of the .gif file from
System.Drawing.Bitmap to System.Byte[]
2. Use ResourceManager.GetObject() to get the .gif data as ubyte[]:
ubyte[] b = (ubyte[]) resMgr.GetObject("MyGif");
3. Create java.awt.Image from .gif data:
byte[] b2 = new byte[b.length];
for (int i=0; i < b.length; ++i)
b2[i] = (byte) b[i];
Image image = Toolkit.getDefaultToolkit().createImage(b2);
- Next message: George Birbilis [MVP J#] [9880]: "Re: System.Drawing.Bitmap to java.awt.Image?"
- Previous message: HB: "Re: bug in java.util.LinkedList"
- In reply to: alex: "System.Drawing.Bitmap to java.awt.Image?"
- Next in thread: Lars-Inge Tønnessen [VJ# MVP]: "Re: System.Drawing.Bitmap to java.awt.Image?"
- Reply: Lars-Inge Tønnessen [VJ# MVP]: "Re: System.Drawing.Bitmap to java.awt.Image?"
- Messages sorted by: [ date ] [ thread ]