Community
Participate
Working Groups
I recently fixed Cocoa so it uses kCGBlendModeDifference for XOR drawing, just like Carbon does, and with the same results as Win32. Given that, I think we should remove the @deprecated tag, as it is no longer correct. This assumes, of course, that other platforms handle setXORMode properly, but the comment implies that Mac OS X was the only platform with an issue.
GTK/Motif when in advanced mode (running cairo) does not support XOR mode either. We would have to determine if cairo has added API for this. I had a quick look and it seems cairo_set_operator() with CAIRO_OPERATOR_XOR should do what we want, but we have to test. http://cairographics.org/manual/cairo-cairo-t.html#cairo-set-operator
The description of CAIRO_OPERATOR_XOR at http://cairographics.org/operators/ looks correct. They also have CAIRO_OPERATOR_DIFFERENCE, but there's no docs on what it does. Presumably it's the same as Carbon/Cocoa.
*** Bug 336167 has been marked as a duplicate of this bug. ***
No messages for one and a half years ... what is the state of affairs?
As far as I understand, we still do not have support for XOR mode on Linux with Cairo because the CAIRO_OPERATOR_XOR referred to in comment 1 does not provide a bit-wise XOR functionality. Bogdan/Silenio, can you please confirm? Thanks!
I think we implement XOR on linux not to long ago, but it only works with gtk 2.4.
I'm not sure if CAIRO_OPERATOR_DIFFERENCE is the right operator – is CAIRO_OPERATOR_XOR not the appropriate one? Does the topic only affect the cairo "path" of SWT on Linux
(In reply to comment #7) > I'm not sure if CAIRO_OPERATOR_DIFFERENCE is the right operator – is > CAIRO_OPERATOR_XOR not the appropriate one? > Does the topic only affect the cairo "path" of SWT on Linux I confirmed that we have implemented GC.setXORMode() on GTK. The implementation only works with cairo >= 1.10. I believe CAIRO_OPERATOR_DIFFERENCE is the right operator. We use kCGBlendModeDifference on cocoa. It should affect fillRectangle, fillArc, fillPath, drawRectangle, drawArc, etc, drawImage as well. This snippet works for me: import org.eclipse.swt.SWT; /* * example snippet: Hello World * * For a list of all SWT example snippets see * http://www.eclipse.org/swt/snippets/ */ import org.eclipse.swt.widgets.*; import org.eclipse.swt.graphics.*; public class Snippet1 { public static void main (String [] args) { final Display display = new Display (); Shell shell = new Shell(display); shell.addListener(SWT.Paint, new Listener() { public void handleEvent(Event event) { GC gc = event.gc; gc.setAdvanced(true); System.out.println(gc.getAdvanced()); gc.setBackground(display.getSystemColor(SWT.COLOR_RED)); gc.fillRectangle(10, 10, 200, 200); gc.setXORMode(true); gc.setBackground(display.getSystemColor(SWT.COLOR_BLUE)); gc.setForeground(display.getSystemColor(SWT.COLOR_BLUE)); Image image = new Image(display, 100, 100); GC gc2 = new GC(image); gc2.setForeground(display.getSystemColor(SWT.COLOR_BLUE)); gc2.setBackground(display.getSystemColor(SWT.COLOR_BLUE)); gc2.fillRectangle(0 ,0, 100, 100); gc2.dispose(); // gc.drawImage(image, 20, 20); image.dispose(); // gc.fillRectangle(20, 20, 100, 100); gc.drawRectangle(0, 20, 100, 100); } }); shell.open (); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); } }
Alright. What does that mean for the request?
still @deprecated?
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.
XOR is a basic graphics feature so for me there is no reason to keep the @deprecated tag just because this feature is not supported on older Linux resp. Cairo < 1.10.
(In reply to Andre Saibel from comment #12) > XOR is a basic graphics feature so for me there is no reason to keep the > @deprecated tag just because this feature is not supported on older Linux > resp. Cairo < 1.10. Agreed, we don't support GTK3 versions with Cairo < 1.12, so we can definitely remove this tag.
New Gerrit change created: https://git.eclipse.org/r/152338
Gerrit change https://git.eclipse.org/r/152338 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=1af84db9d9097f2c1d4b3b33cc3dc258334486cb
(In reply to Eclipse Genie from comment #15) > Gerrit change https://git.eclipse.org/r/152338 was merged to [master]. > Commit: > http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/ > ?id=1af84db9d9097f2c1d4b3b33cc3dc258334486cb In master now.
Verified in I20191119-0510.