GetItemImageTransform Method (original) (raw)

Summary

Transformation matrix of the image of an item.

Syntax

Parameters

item

The reference item, this value cannot be null.

Return Value

The transformation matrix of the image of an item.

Example

using Leadtools; using Leadtools.Controls; using Leadtools.Codecs; using Leadtools.Drawing; using Leadtools.ImageProcessing; using Leadtools.ImageProcessing.Color; public void ImageViewerItemTransform_Example(int dy, LeadPoint position) { double total = _imageViewer.GetItemViewBounds(_imageViewer.ActiveItem, ImageViewerItemPart.Item, false).Height; double factor; if (total > 0) factor = 1.0 - (dy * 2.0) / total; else factor = 1.0; // Get the origin in image coordinate var origin = _imageViewer.ConvertPoint(_imageViewer.ActiveItem, ImageViewerCoordinateType.Control, ImageViewerCoordinateType.Image, position).ToLeadPointD(); // Convert it to whatever the current transform is origin = _imageViewer.ActiveItem.Transform.Transform(origin); var transform = LeadMatrix.Identity; transform.ScaleAt(1 / factor, 1 / factor, origin.X, origin.Y); _imageViewer.ActiveItem.Transform = LeadMatrix.Multiply(_imageViewer.ActiveItem.Transform, transform); }