Graphics Reference
In-Depth Information
Special algorithms for generating parabolas and hyperbolas are also known. We
shall not describe any here but instead jump directly to the case of a general conic.
Every conic can be defined implicitly by an equation of the form
2
2
ax
+++++=.
bxy
cy
dx
ey
f
0
Given a starting pixel on the conic, one can determine which adjacent pixel to pick
next similar to what we did in the case of circles by looking at an error function. Each
possible move will have an error associated to it and we simply choose the move with
the least error. It is easy to show that the error functions have the same form as the
equation of the conic and that they can be computed incrementally. See [Blin88a] and
[Chan88] for more details.
Conics are a special case of implicitly defined curves and general algorithms for
generating such curves will be presented in Section 14.5.1.
2.10
Bit Map Graphics
There are lots of situations in graphics where one needs to map blocks of bits from
one location to another. Today's graphical user interfaces present a user with many
“windows” that pop on and off the screen. Animation techniques usually achieve their
motion effect by mapping a saved block of pixels to the current location of the moving
figure (thereby erasing it and restoring the background) and then mapping another
block containing the figure to its new location. This section looks at some rectangu-
lar bit map basics. The discussion is specific for the IBM PC, although most of it is
generic. For a more extensive discussion see [Miel91], [FVFH90], and [DeFL87].
First of all, what does it take to define a bit map? Rectangles are specified by the
upper left and lower right corner:
rectangle = record
integer x0, y0, { upper left corner }
x1, y1; { lower right corner }
end ;
A bit map specifies a rectangle in a possibly larger rectangle:
bitMap = record
pointer base; { start address in memory }
integer width; { width in number of words }
rectangle rect;
end ;
Bit maps are stored in row major form in memory. The width field refers to a possi-
ble larger bitmap that contains this rectangle. For example, the rectangle may be prop-
erly contained in a frame buffer whose pixels are stored in row major form. In that
case, the pixels of the rectangle do not form a contiguous sequence and one needs the
width of the bigger frame buffer to be able to access the pixels of the rectangle as one
moves from one row to the next. See Figure 2.20. Note that each row of a rectangle
is assumed to specify a contiguous chunk of bits in memory however.
Search WWH ::




Custom Search