Resize Rectangles

Or, what the heck do those 10 values mean?
First, an explanation. Resizing is done with two rectangles, one for the source image to select the part of the image to be included in the result, and another for the destination canvas to determine where to place the result. The shapes of the rectangles can be different to account for different aspect ratios and/or to deform the result. Using different size rectangles causes zooming, using the same size for both rectangles but smaller than the source results in cropping.

The final four values presented to the resizer are what one would expect: X-coord, Y-coord, width, and height. But prior to that there are extra values that enable the visual editor to make changes to specific properties, and later change them without accumulating errors. Several operations reduce values to zero making undoing them difficult or impossible.
Here are the values used by Carbon:
Src Rect:X-coordY-coordsizecropsrc_bend
Dst Rect:X-coordY-coordsizesymmetrydst_bend

X-coord and Y-coord are the position of the center of the rectangle in virtual units.
For both rectangles 0,0 is the center of the image or canvas, and X increases from left to right. Y increases from bottom to top for the Dst rectangle, but from top to bottom for the Src rectangle.

Size is actually the width of the undeformed rectangle in virtual units. Negative size values result in the image being flipped horizontally and vertically (rotated 180 degrees).

Symmetry is used for reshaping the destination rectangle, it is not used for effects like squeezing. Here it is important to remember that the virtual size of the source image and destination canvas is always 8640 in height, and the width is determined by the aspect ratio. This results in a grid of virtual units that are square. (see virtual coordinate system)
The symmetry value forms a ratio to alter the 1:1 relationship of source and destination. The ratio is symmetry / canvas_width.

Dst_bend is a continuously variable value that squeezes and flips the rectangle (and therefore the image) first horizontally, then vertically. The value 0 causes no deformation, increasing the value up to 8192 squeezes horizontally, from 8193 to 16384 the rectangle is expanded again, but the sides are flipped. From 16385 to 24576 the rectangle, still flipped horizontally, is squeezed vertically. From 24577 to 32768 the rectangle expands again, you guessed it, flipped vertically and horizontally.
So, at 32768, which becomes -32768 if we continue, the rectangle is full size, but flipped both horizontally and vertically, resulting in a 180 degree rotation.
Continuing on the rectangle will be undone in the opposite order, that is it will be squeezed and flipped horizontally first. This allows a continuous range of deformation - go positive from 0 and the rectangle squeezes and flips horizontally, go negative from 0 and the rectangle squeezes and flips vertically.

Src_bend operates the same as dst_bend, but on the source rectangle. The visual editor does not currently use or set this value.

Crop affects the size of both rectangles to remove parts of the image. Cropping, in the sense of this value, is either horizontally or vertically, but never both. To crop both dimensions is the same as zooming, and is accomplished using the size values. Cropping is in parts-per-8192, positive values crop horizontally, negative values crop vertically. Prior to version 1.3.1 values greater than 8192 resulted in both rectangles being flipped horizontally and values less than -8192 resulted in both rectangles being flipped vertically. The net result was the image was not flipped. As of version 1.3.1 the destination rectangle is not flipped by Crop values, so values greater than 8192 or less than -8192 will flip the result.
Carbon home Copyright © 2005 - 2013 MPUCoder, all rights reserved. MuxMan home