End Procedure Crop

Floating is the complement of cropping: to float an image, you copy the entire old one into a new larger image. Floating is useful when you want to rotate an image without losing its corners; the added lines and columns provide a place for the corners to go. The procedure below requires lox and hix, the number of columns that you want to add to the left and right side, and 1 oy and h iy, the number of lines that you want to add to the top and bottom.

PROCEDURE FLOAT (lox, hix, loy, hiy) xmax = lox + oldxmax + hix ymax = loy + oldymax + hiy REDIMENSION new (0 TO xmax, 0 TO ymax) FOR y = 0 to ymax FOR x = 0 TO xmax if x >= lox AND x < oldxmax - loy AND_

Figure 12.8 This image of the Horsehead Nebula has been floated, translated, rotated, and scaled. Floating added space around the image, translation moved it a few pixels up and to the left, and the rotation and scaling were carried out relative to the center of the image.

y >= loy AND y < oldymax - loy then new(x, y) = old(x - lox, y - loy) ELSE

NEXT y

Was this article helpful?

0 0
Telescopes Mastery

Telescopes Mastery

Through this ebook, you are going to learn what you will need to know all about the telescopes that can provide a fun and rewarding hobby for you and your family!

Get My Free Ebook


Post a comment