Rasterization

from Wikipedia, the free encyclopedia
When rasterizing a vector graphic, in this example in SVG format, the pixel color values ​​of the resulting raster graphic must be determined.

In 2D computer graphics , rastering , also called rendering or scan conversion, is the conversion of a vector into a raster graphic .

Procedure

PDF renderer that converts vector fonts into pixel graphics. Above Sumatra PDF , below Adobe Reader .

There are a variety of algorithms for rasterizing graphic primitives such as lines, circles and the like, see:

A well-known problem with screening is the staircase effect . If a color depth of more than 1 bpp is available for the raster graphics to be generated , this effect can be reduced by means of " anti-aliasing " . There are several methods for this, some of which work unweighted and some of which use a special reconstruction filter. When rasterizing text, there are special problems that can be avoided by using hinting .

Screening of thick primitives

When rasterizing primitives with a certain thickness, there are several options, provided it is not already supported by the anti-aliasing algorithm used. In the case of polygons, the connection points between the individual line segments must also be taken into account, see Rasterization of Polygons .

Pixel repetition
One method is to draw several pixels vertically or horizontally instead of one when rasterizing. One problem is that curve ends appear “cut off” on thick curves. In addition, there can be noticeable gaps at the points where you switch from horizontal to vertical repetition or vice versa. In addition, similar to thin lines, such rasterized curves have a different thickness depending on the local slope.
brush
A certain raster graphic is moved along the curve as a “brush”, in the simplest case a square with the desired edge length. Here, too, the thickness varies depending on the gradient, but in contrast to pixel repetition, the line is thickest with diagonal steps. The workaround is to rotate the square according to the local slope of the curve, but it is easier to use a circle as a brush. A disadvantage of the method is that when you rasterize, you come across a large number of pixels that have already been colored in the previous steps. The thicker the curve, the greater this effect. Polygon-shaped brushes can be used to solve the problem of varying curve thickness.
Fill between edges
Another way to rasterize a thick curve is to draw its two edges some distance apart and fill in the space in between. A disadvantage is that with the two-color raster the curve may appear slightly shifted due to rounding errors. In the case of ellipses, it must be noted that the grid by drawing two confocal ellipses with semiaxes of different lengths is not geometrically correct.
Line segments
Finally, there is the option of drawing thick curves by stringing together short line segments. The same special features as when rasterizing polygons must be observed so that the line segments are correctly connected to one another.

Deletion of primitives

Figures that have already been drawn can be selectively deleted by drawing them again with the background color. However, this does not work if they overlap other figures, as unwanted parts of the image can also be deleted. An efficient way to avoid this is with minimax or boxing tests. Here, it is first checked whether there are other figures in the rectangle spanned by the figure to be deleted. Only if this is the case do you have to test for intersections and, if necessary, redraw the entire area.

literature

  • James D. Foley et al: Computer Graphics: Principles and Practice. Addison-Wesley, Reading 1995, ISBN 0-201-84840-6
  • David F. Rogers: Procedural Elements for Computer Graphics. WCB / McGraw-Hill, Boston 1998, ISBN 0-07-053548-5

Web links

Commons : Rasterization  - collection of images, videos and audio files

Individual evidence

  1. ^ John D. Hobby: Digitized Brush Trajectories. Dissertation, Stanford University, 1985 ( PDF, 30 MB ( Memento of the original from October 26, 2006 in the Internet Archive ) Info: The archive link has been inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this note. ) @1@ 2Template: Webachiv / IABot / cm.bell-labs.com