Definitions and Data Types

This section presents a mathematical model for Raster Graphics. The model formally defines the notions of pixels, raster images, and the primitive operations applicable to them, providing a framework with clean and unambiguous operational semantics in which to present and discuss various raster algorithms. Part of this framework is a notation for succinctly describing such algorithms.

A raster image, or more simply image, is an infinite two-dimensional array, each of whose elements is a bit, or pixel. When indexing pixels it will prove convenient to assume that their centers occupy a square lattice in the plane and are located at half-integer coordinates. The axes themselves we will label with the letters x and y, where x grows to the right and y downwards. A point (x, y) is a pair of integers and denotes the Euclidean point located x units to the right and y units down from the origin (0, 0). This is unfortunately a left-handed coordinate system, but is consistent with all existing implementations we know (the orientation of the y axis was inherited from the way in which text is addressed on paper and hence on terminals). If we think of the pixels as unit squares centered at the half-integer lattice points, then a point is a common corner of four adjacent pixels. All these concepts are illustrated in Figure 3.

[…]

Figure 3. Pixels, points and rectangles, x increases to the right, and y downwards. The squares are pixels, and the dots their centers. The point (x, y) labels the pixel centered at (x+tt, y+%). A rectangle is specified by two points, its origin and corner, and includes those pixels whose centers it contains.

If p is the point (k, /), then X[p] and Y[p] denote respectively the x and y components of p, that is, k and I. For brevity, we will sometimes write px and py for X[p] and Y[p]. A rectangle r is defined by a pair of points r=(o, c), the origin o and comer c, as shown in Figure 3. We assume that ox^cx and oy^Cy. We also write o =origin[r] and c=comer[r]. A non-empty rectangle is said to contain those pixels whose centers it contains. Since rectangles have sides positioned at integer coordinates and pixels are centered at half-integer coordinates, this notion is unambiguous. Another useful attribute of a rectangle is its extent, defined by […]