Java 2D Graphics The better method for filling
Java 2D Graphics each pixel in the upper left corner of the same shape. The grid lines and the ideal shape are superimposed for clarity. You can tell that the rasterizer used antialiasing because there is a range of values between 0.0 and 1.0. Figure 2.5. The rasterizer produces an alpha value for every pixel The rasterizer produces alpha values from ideal shapes, but that’s only part of the story. Rendering is the process of determining the color for pixels. A technique called compositing is used to decide how to translate alpha values into color information. 2.4 Compositing Once the rasterizer has generated alpha values for an ideal shape, there are several ways to use them to modify the drawing surface of a Graphics2D. A compositing rule determines how the colors of a new graphics primitive are combined with the existing colors on a drawing surface, as shown in Figure 2.6. In Figure 2.6, the alpha values are used to blend colors between the background color, white, and the color that is used to fill the shape, black. This is probably the most intuitive compositing rule, but there are other possibilities. Conceptually, at least, the rasterizer produces a set of alpha values for the new shape that is the same size as the drawing surface on which the shape will be rendered. Then this set of alpha values and the desired color of the new shape are combined, pixel by pixel, with the drawing surface. The equation that is used to combine these values is the compositing rule. Figure 2.6. Adding to a drawing surface page 23
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services