Bug 4415 - Creating cursor with mask is backwards (1FRSOOR)
Summary: Creating cursor with mask is backwards (1FRSOOR)
Status: RESOLVED DUPLICATE of bug 4809
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: All Windows NT
: P5 normal (vote)
Target Milestone: ---   Edit
Assignee: Mike Wilson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-11 14:16 EDT by Andre Weinand CLA
Modified: 2002-03-20 14:17 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andre Weinand CLA 2001-10-11 14:16:24 EDT
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.
Comment 1 Mike Wilson CLA 2002-03-20 14:17:28 EST

*** This bug has been marked as a duplicate of 4809 ***