Error processing SSI file
(Leadtools.Controls)

Show in webframe

Transform Property (ImageViewerItem)




Transformation of the item.
Syntax
public LeadMatrix Transform {get; set;}
'Declaration
 
Public Property Transform As LeadMatrix

Property Value

The transformation of the item. Default value is Identity.
Remarks

Transform will be used by ViewLayout during the calculation. The rectangle from 0,0 to ImageSize is multiplied by this value apply custom translation, scale and rotation on the item.

Modifying the state values will update this matrix automatically and setting the value of Transform manually will reset the state values to their default values. For more information, for more information, refer Image Viewer Transformation.

For more information, refer Image Viewer Items.

Example
Copy Code  
Imports Leadtools
Imports Leadtools.Controls
Imports Leadtools.Codecs
Imports Leadtools.Drawing
Imports Leadtools.ImageProcessing
Imports Leadtools.ImageProcessing.Color

Public Sub ImageViewerTransform_Example(ByVal dy As Integer, ByVal position As LeadPoint)
   Dim total As Double = _imageViewer.GetItemViewBounds(_imageViewer.ActiveItem, ImageViewerItemPart.Item, False).Height
   Dim factor As Double
   If total > 0 Then
      factor = 1.0 - (dy * 2.0) / total
   Else
      factor = 1.0
   End If

   ' Get the origin in image coordinate
   Dim origin As LeadPointD = _imageViewer.ConvertPoint(_imageViewer.ActiveItem, ImageViewerCoordinateType.Control, _
                                                        ImageViewerCoordinateType.Image, position).ToLeadPointD()
   ' Convert it to whatever the current transform is
   origin = _imageViewer.ActiveItem.Transform.Transform(origin)

   Dim transform As LeadMatrix = LeadMatrix.Identity
   transform.ScaleAt(1 / factor, 1 / factor, origin.X, origin.Y)
   _imageViewer.ActiveItem.Transform = LeadMatrix.Multiply(_imageViewer.ActiveItem.Transform, transform)
End Sub
using Leadtools;
using Leadtools.Controls;
using Leadtools.Codecs;
using Leadtools.Drawing;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;

public void ImageViewerTransform_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);
}
Requirements

Target Platforms

See Also

Reference

ImageViewerItem Class
ImageViewerItem Members

Error processing SSI file