Java 2D Graphics compositing rule A compositing rule
Java 2D Graphics Let’s walk through the pipeline. It can be described in five steps, where the first step depends heavily on which primitive is being rendered. 1. Determine the shape to be rendered. This is different for each of the rendering operations. For shapes that will be filled, the shape is simply transformed using the Graphics2D’s current transformation. For shapes whose outlines are drawn using draw(), the current stroke is used to turn the outline into a shape. Then the stroked outline is transformed, just like any other filled shape. Text is displayed by translating characters to shapes using the current font. The resulting shapes are transformed, just like any other filled shape. For images, the outline of the image is transformed using the current transformation. As you can see, the rendering engine knows only how to fill shapes and draw images. Although drawing shape outlines and drawing text appear to be distinct operations, they are really special cases of filling shapes. 2. Rasterize the shape. Rasterizing is the process of converting an ideal shape to a set of pixel coverage values. I’ll explain more about this later. In the case of images, it’s the outline of the image that is rasterized. Rendering hints are used to control the behavior of the rasterization. 3. Clip the results using the current clipping shape. 4. Determine the colors to be used. For a filled shape, use the current paint object to determine what colors should be used to fill the shape. For an image, the colors are taken from the image itself. 5. Combine the colors with the existing drawing using the current compositing rule. 2.3 All About Alpha Rendering is an approximation. When you ask to have an ideal shape filled, the rendering engine figures out how the pixels of an output device should be colored to best approximate the shape. For example, suppose the rendering engine is asked to fill a shape with some color. There’s a fast way to do it, and then there’s a good way to do it. 2.3.1 Aliasing and Antialiasing The fast method is to color the pixels whose centers fall within the shape. Using this algorithm, pixels are either fully colored or left unchanged. Figure 2.3 shows an example of this technique with a single letter shown on some device with very large pixels. The ideal outline of the shape is also shown. The filled shape exhibits unattractive jaggies, or ragged edges. Images produced using this algorithm are said to be aliased. Figure 2.3. Aliased rendering page 21
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Java Web Hosting services