Graphics Reference
In-Depth Information
Simple image rotation (that is, rotation through a multiple of 90 degrees)
can be done similarly. If you want to rotate an image by 90 degrees counter-
clockwise, for example, you can simply replace the s -coordinate of the tex-
ture by the original texture t -coordinate, and the t -coordinate of the texture
by one minus the s -coordinate. (See if you can quickly figure out why the
“one minus” is needed.) In terms of functions of two variables, the function
f  ( st ) = ( t, 1 − s ) captures this operation. The other simple rotations are simi-
larly easy. More general rotations are straightforward applications of the usual
graphics rotation operations, but are complicated by the need to preserve
the rectangular form factor in the domain and are thus not considered here.
Filling a pixel with a pixel from somewhere else in the image is more
interesting. You can apply any function or procedure that you like to manip-
ulate the address of any particular pixel, so long as it stays within the unit
Figure 11.16. The grid (above) and cherry blossom image (below), manipulated to magnify
(left) or compress (right) the center part of the image.
Search WWH ::




Custom Search