Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[gef-dev] Ghost shape, Mac OS X xor issue, and a possible solution

Hi,

I've already posted an article on the newsgroup, but probably this was the wrong place.

I'm running Eclipse with Mac OS X. There is an issue with the XOR mode, which is not (and will never) be supported by Mac OS X (i.e. Quarz). This is already documented in the SWT bugzilla and SWT's xor- methods are all deprecated. Thus, IMHO GEF's xor methods should be deprecated, too.

I've implemented a possible solution:

1) Add a new property "alpha" to Shape: int alpha, with appropriate setter and getter, propagate alpha setting to graphics in Shape.paint (), this must be done before fillShape() and outlineShape() is called:
	if (alpha!=255) {
		graphics.setAlpha(alpha);
	}


2) Change FigureUtilities.makeGhostShape(..):
public static Shape makeGhostShape(Shape s) {
	s.setBackgroundColor(ghostFillColor);
	//s.setFillXOR(true);
	//s.setOutlineXOR(true);
	s.setAlpha(100); // or s.setAlpha(ghostAlpha)
	return s;
}

This is working fine. Maybe it would be nice to make the ghostFillColor (and maybe a ghostAlpha) mutable? Using alpha,
	ghostFillColor = ColorConstants.blue;
looks very nice ;)

Shape.setXORMode() and all other draw2d.*.setXORMode() should be marked deprecated.

Jens


Back to the top