*** Welcome to piglix ***

Java2D


In computing, Java 2D is an API for drawing two-dimensional graphics using the Java programming language. Every Java 2D drawing operation can ultimately be treated as filling a shape using a paint and compositing the result onto the screen.

The Java 2D API and its documentation are available for download as a part of JDK 6. Java 2D API classes are organised into the following packages in JDK 6:

These objects are a necessary part of every Java 2D drawing operation.

A shape in Java 2D is a boundary which defines an inside and an outside. Pixels inside the shape are affected by the drawing operation, those outside are not.

Trying to fill a straight line segment will result in no pixels being affected, as such a shape does not contain any pixels itself. Instead, a thin rectangle must be used so that the shape contains some pixels.

A paint generates the colors to be used for each pixel of the fill operation. The simplest paint is java.awt.Color, which generates the same color for all pixels. More complicated paints may produce gradients, images, or indeed any combination of colors. Filling a circular shape using the color yellow results in a solid yellow circle, while filling the same circular shape using a paint that generates an image produces a circular cutout of the image.

During any drawing operation, there is a source (the pixels being produced by the paint) and a destination (the pixels already onscreen). Normally, the source pixels simply overwrite the destination pixels, but the composite allows this behavior to be changed.

The composite, given the source and destination pixels, produces the final result that ultimately ends up onscreen. The most common composite is java.awt.AlphaComposite, which can treat the pixels being drawn as partially transparent, so that the destination pixels show through to some degree.


...
Wikipedia

...