←Select platform

CombineFloater Method

Summary

Combines the floaters with the images for all items inside this ImageViewer.

Syntax
C#
C++/CLI
public virtual void CombineFloater( 
   bool deleteFloater 
) 
public:  
   virtual void CombineFloater( 
      bool deleteFloater 
   ) 

Parameters

deleteFloater

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

Remarks

This method will loop through all the items inside this ImageViewer and check if any has a floater image (the value of ImageViewerItem.Floater is not null) that is visible (the value of ImageViewerItem.FloaterOpacity is not 0). If so, it will try to combine this floater with the item images using ImageViewerItem.CombineFloater.

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

The floater transformation might result in it being layered on top of more than one item (its original or other) and this method will combine the floater with all the items that intersect with the final floater position and size.

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 ImageViewerFloaterExample() 
{ 
   // 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")); 
 
   ImageViewerItem item = null; 
   RasterImage image = null; 
 
   if (_imageViewer.Items.Count > 0) 
   { 
      item = _imageViewer.Items[0]; 
      image = item.Image; 
   } 
 
   if (image == null) 
   { 
      item.ImageRegionToFloater(); 
      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; 
      _imageViewer.FloaterOpacity = 1.0; 
   } 
 
   item.CombineFloater(null, true); 
   _imageViewer.CombineFloater(false); 
   image.MakeRegionEmpty(); 
   floater.MakeRegionEmpty(); 
 
   item.Floater = floater; 
   var transform = item.FloaterTransform; 
   transform.RotateAt(45, floater.ImageWidth / 2, floater.ImageHeight / 2); 
 
   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.