Community
Participate
Working Groups
AW (14.03.00 10:56:31) SWT 0.38: I want to create a custom cursor from a three color .gif image: black & white & transparency. I have to use this wad to get the desired appearance: private static Cursor loadCursor(Display display, String name, int hotx, int hoty) { InputStream is= PartDragger.class.getResourceAsStream("icons/" + name + ".gif"); ImageData data= new ImageData(is); RGB[] rgbs= data.getRGBs(); int tp= data.transparentPixel; PaletteData palette= new PaletteData(new RGB[] { new RGB(0, 0, 0), new RGB(255, 255, 255)}); ImageData image= new ImageData(data.width, data.height, 1, palette); for (int y= 0; y < image.height; y++) { for (int x= 0; x < image.width; x++) { int value= data.getPixel(x, y); if (value == tp) { image.setPixel(x, y, 1); } else { RGB c= rgbs[value]; if (c.red == 0) // invert black & white image.setPixel(x, y, 1); else image.setPixel(x, y, 0); } } } return new Cursor(display, image, data.getTransparencyMask(), hotx, hoty); } Why do I have to invert the colors in order to get the expected result? Why do I have to use white in the transparent areas? In Images I have to use black! In addition the black parts of the cursor are xor-ed with the background. Builtin cursors don't have this behavior! McQ (27/11/2000 2:27:02 PM) - Although there are apparently inconsistancies, it is clear that the customer is able to proceed as is. Low priority. Moving to inactive.
*** This bug has been marked as a duplicate of 4809 ***