GC plot: exclusive or (XOR) and advanced mode

Source: Internet
Author: User

The setxormode (true) method is used to make the target color the result value of the XOR operation of the source and target colors.

When the parameter is false, the difference or effect of the drawing is canceled.

Before using setxormode, you should use setbackground/setforeground to set the background color or foreground color.

In addition, we cannot use setantialias or settransform with this method. Otherwise, you will be surprised to find that using setxormode does not achieve the desired effect. Why? This is because the advanced image mode is automatically called after setantialias or settransform. You can use setadvance (false) to switch the mode to normal mode and then call the setxormode method.
Eg:

XOR failure example:

GC. setbackground (display. getsystemcolor (SWT. color_blue); GC. fillrectangle (0, 0, 60, 60); GC. setantialias (SWT. off); // setantialiasgc is called. setxormode (true); GC. setbackground (display. getsystemcolor (SWT. color_yellow); GC. fillrectangle (20, 20, 80, 80); GC. dispose ();
GC. setbackground (display. getsystemcolor (SWT. color_blue); GC. fillrectangle (0, 0, 60, 60); GC. setantialias (SWT. off); // setantialias GC is called. setxormode (true); GC. setbackground (display. getsystemcolor (SWT. color_yellow); GC. fillrectangle (20, 20, 80, 80); GC. dispose ();

It is worth noting that setxormode is not supported on some platforms, soExercise caution when developing portable programsSetxormode.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.