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_
y >= loy AND y < oldymax - loy then new(x, y) = old(x - lox, y - loy) ELSE
Was this article helpful?