←Select platform

FloaterTransform Property

Summary

Transformation matrix used by the floater image of this item.

Syntax
C#
C++/CLI
public LeadMatrix FloaterTransform { get; set; } 
public:  
   property LeadMatrix^ FloaterTransform 
   { 
      LeadMatrix^ get() 
      void set(LeadMatrix^ value) 
   } 

Property Value

The transformation matrix used by the floater image of this item. Default value is Identity.

Remarks

Use this transform to translate, scale or rotate the floater image. ImageViewerFloaterInteractiveMode will update this value when the user clicks and drags on the floater image.

Changing the value of this property will fire the ItemChanged event with ImageViewerItemChangedReason.FloaterTransform.

Example
C#
using Leadtools; 
using Leadtools.Controls; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
 
 
public ImageViewerForm _form = new ImageViewerForm(); 
public ImageViewer _imageViewer; 
 
public void ImageViewerFloaterTransformExample() 
{ 
   // Get the Form's ImageViewer control 
   _imageViewer = _form.ImageViewer; 
 
   // Load an image 
   using (var codecs = new RasterCodecs()) 
      _imageViewer.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp")); 
 
   var item = _imageViewer.Items[0]; 
   if (item == null) 
      return; 
 
   if (item.Floater == null) 
   { 
      var xForm = RasterRegionXForm.Default; 
      using (var image = item.Image.Clone()) 
      { 
         var width = image.ImageWidth / 2; 
         var height = image.ImageHeight / 2; 
         image.AddRectangleToRegion(xForm, new LeadRect(width, height, width, height), RasterRegionCombineMode.Set); 
 
         xForm = RasterRegionXForm.Default; 
         xForm.ViewPerspective = RasterViewPerspective.TopLeft; 
         var rc = image.GetRegionBounds(xForm); 
         var command = new CopyRectangleCommand(rc, RasterMemoryFlags.Conventional); 
         command.Run(image); 
         var floater = command.DestinationImage; 
 
         rc = image.RectangleFromImage(RasterViewPerspective.TopLeft, rc); 
 
         if (floater != null) 
         { 
            xForm.ViewPerspective = RasterViewPerspective.TopLeft; 
            var regionData = RasterRegionConverter.GetGdiPlusRegionData(image, xForm); 
            xForm.ViewPerspective = RasterViewPerspective.TopLeft; 
            xForm.XOffset -= rc.Left; 
            xForm.YOffset -= rc.Top; 
         } 
 
         floater.MakeRegionEmpty(); 
 
         var transform = item.FloaterTransform; 
         transform.Translate(-floater.ImageWidth, -floater.ImageHeight); 
         item.FloaterTransform = transform; 
 
         item.Floater = floater; 
      } 
   } 
   else 
   { 
      var floater = item.Floater; 
 
      var transform = item.FloaterTransform; 
      transform.Translate(-1, -1); 
      item.FloaterTransform = transform; 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Controls Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.