O'Reilly logo

Graphic Java™ 1.2, Volume I: AWT, Third Edition by David M. Geary

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Graphics Modes

java.awt.Graphics provides two graphics modes: paint and XOR. Paint mode is the default; graphical operations performed in paint mode simply overwrite existing graphics. XOR mode, on the other hand, allows graphical operations to be performed over existing graphics without disturbing the affected areas. Until Up until now, all of the rendering in this chapter has been done in paint mode, so we will concentrate on XOR mode in this section.

The documentation for Graphics.setXORMode(Color) describes XOR mode as follows:

When drawing operations are performed, pixels which are the current color are changed to the specified color, and vice versa.

Pixels that are of colors other than those two colors are changed in an unpredictable but ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required