←Select platform

CombineFloater Method

Summary

Combines the floater of this item with the image of the same or another item.

Syntax
C#
C++/CLI
public virtual bool CombineFloater( 
   ImageViewerItem targetItem, 
   bool deleteFloater 
) 
public:  
   virtual bool CombineFloater( 
      ImageViewerItem^ targetItem, 
      bool deleteFloater 
   ) 

Parameters

targetItem

Target item. If this value is null, then the floater will be combined with the image of this same

item, otherwise; the floater will be combined with the image of targetItem.

deleteFloater

true to automatically delete the floater image from the item after combining, otherwise; false.

Remarks

This method is called by ImageViewer.CombineFloater.

The floater transformation (position, scale and rotation value) is stored in ImageViewerItem.FloaterTransform and this method will use this value during the combine operation.

Internally, the viewer will use the image in Floater transformed by FloaterTransform and combine the result into Image using CombineFastCommand.

After this method finishes, the ItemChanged event will fire with ImageViewerItemChangedReason.Image. If the floater is deleted, ImageViewerItemChangedReason.Floater will also occur.

When deleteFloater is true, then this method will delete the floater by setting the value of Floater to null.

Example
C#
using Leadtools; 
using Leadtools.Controls; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
 
 
public void ImageViewerFloater_Example() 
{ 
   ImageViewerItem item = null; 
   RasterImage image = null; 
 
   if (_imageViewer.Items.Count > 0) 
   { 
      item = _imageViewer.Items[0]; 
      image = item.Image; 
   } 
 
   if (image == null) 
   { 
      if (item == null) 
         item = _imageViewer.Items.AddFromImage(RasterImage.Create(400, 400, 24, 96, RasterColor.White), 1); 
      else 
         item.Image = RasterImage.Create(400, 400, 24, 96, RasterColor.White); 
   } 
 
   var xForm = RasterRegionXForm.Default; 
   image.AddRectangleToRegion(xForm, new LeadRect(10, 10, 400, 200), RasterRegionCombineMode.Set); 
 
   xForm = RasterRegionXForm.Default; 
   xForm.ViewPerspective = image.ViewPerspective; 
   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; 
      xForm.ViewPerspective = RasterViewPerspective.TopLeft; 
      xForm.XOffset = -rc.Left; 
      xForm.YOffset = -rc.Top; 
   } 
 
   image.MakeRegionEmpty(); 
   floater.MakeRegionEmpty(); 
 
   item.Floater = floater; 
   var transform = item.FloaterTransform; 
   transform.RotateAt(45, floater.ImageWidth / 2, floater.ImageHeight / 2); 
 
   item.FloaterTransform = transform; 
} 
Requirements

Target Platforms

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

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