Results 1 to 4 of 4
Thread: Label image Question
- 12-09-2007, 11:24 AM #1
Member
- Join Date
- Dec 2007
- Posts
- 15
- Rep Power
- 0
- 12-09-2007, 12:55 PM #2
The easiest way is to use a GIF-image.
- 12-09-2007, 06:07 PM #3
removed the white part of images in label
Do you mean how to remove the color white from an image? You use something like this
Java Code:private BufferedImage convertToTransparent(BufferedImage src, Color transparentColor) { int w = src.getWidth(); int h = src.getHeight(); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration(); BufferedImage dest = gc.createCompatibleImage(w, h, Transparency.BITMASK); int trgb; if (transparentColor != null) { trgb = transparentColor.getRGB() | 0xff000000; } else { trgb = 0xffff00ff; } // Copy pixels a scan line at a time int buf[] = new int[w]; for (int y = 0; y < h; y++) { src.getRGB(0, y, w, 1, buf, 0, w); for (int x = 0; x < w; x++) { if (buf[x] == trgb) { buf[x] = 0; } } dest.setRGB(0, y, w, 1, buf, 0, w); } return dest; }
sdk1.5/src/com/sun/java/swing/plaf/windows/XPStyle
- 12-10-2007, 04:38 PM #4
Member
- Join Date
- Dec 2007
- Posts
- 15
- Rep Power
- 0
Similar Threads
-
Getting disk label
By Java Tip in forum Java TipReplies: 0Last Post: 02-05-2008, 10:07 AM -
Example of SWT Label
By Java Tip in forum Java TipReplies: 0Last Post: 01-09-2008, 01:02 PM -
Converting multiple banded image into single banded image... Image enhancement
By archanajathan in forum Advanced JavaReplies: 0Last Post: 01-08-2008, 06:29 PM -
How to set an Icon in a Label?
By Soda in forum New To JavaReplies: 2Last Post: 12-07-2007, 01:38 PM
Bookmarks