ImageViewer supports many operations that change how the view and items are transformed. These operations can be separated into view operations (those that affect the whole view or all the items in the view) or item operations (these specific to a certain item).
ImageViewer supports the following view operations:
Zooms in/out or changes the size mode used to control how the view is fitted inside the image viewer
Zooms the view to the specified rectangle
Centers the view display around the specified point
Flip the view vertically (upside-down)
Reverse (mirror) the view horizontally
Rotate the view around its center at any angle
Automatically reset the view transformation when a new item is set in the viewer
Reset the view transformation properties to default values
Temporally disable updating the transformation matrices
Re-enable updating the transformation matrices
Re-calculate all the transformation matrices
Event that occurs when any transformation inside the image viewer have changed
ImageViewer supports the following items operations:
|Zoom||Zooms in/out or changes the size mode used to control how the image is fitted inside its item|
|ResizeOnTransform||Automatically update the item size when the transformation of this item result in a larger or smaller size image|
|Flip||Flip the image inside this item vertically (upside-down)|
|Reverse||Reverse (mirror) the image in this item horizontally|
|RotateAngle||Rotate the image in this item around its center at any angle|
|Scale||Scale the image of the item horizontally and vertically|
|Offset||Translate the image of the item horizontally and vertically|
|OffsetBy||Translate the image of the item horizontally and vertically by a certain amount|
|Transform||The transformation matrix for this item|
|IsVisible||Sets the visibility of this item|
Each ImageViewerItem contain a Transform property. This matrix is used by the ViewLayout during layout calculation to translate, scale or rotate the item. The item image boundary is from 0,0 to ImageSize. This rectangle is multiplied by Transform to create the final position and size of the image inside its item and the image of each item can be transformed independently from other items or the view itself.
There are two ways to transform an item independently:
First, you can use the state values in Flip, Reverse, RotateAngle, Scale and Offset as well as the helper OffsetBy and Zoom methods. These allow you to easily modify the transformation of the item without having to update the matrix directly. The item will perform all the calculations necessary and store the final value in Transform. These are called "state" values because they keep the previous value passed by the user. If you set the value of Flip to true, then it will remain true. The item applies the transformation in a pre-determined order that will keep all these values in synch.
The other way to transform an item independently is to update the Transform property yourself with a custom value. Since it is not possible to obtain correct rotate, scale and translation value from a matrix, the item will reset all the state values back to their default values.
Generally, you should pick one of these two modes and use it throughout your application depending on your need. Mixing the two modes might end up with undesired results and is not supported.