←Select platform

ImageRegionToFloater Method


Converts the image region to a floater.

public virtual bool ImageRegionToFloater() 
   virtual bool ImageRegionToFloater() 

Return Value

true if the floater was created successfully, otherwise; false.


This method will return false if the value of Image is null or if the raster image does not have a valid region (the value of HasRegion is false).

Call this method to convert the current region inside RasterImage to a floater. FloaterTransform is automatically updated with values obtained from the region transformation after you call this method. The result image is set in Floater.

This method will not delete the region from Image. If you need to do that, call RasterImage.MakeRegionEmpty after you call this method.

ImageViewerAddRegionInteractiveMode will perform exactly that when the value of AutoRegionToFloater is true.

For more information, refer to Image Viewer Items.

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); 
         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); 
   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; 
   item.Floater = floater; 
   var transform = item.FloaterTransform; 
   transform.RotateAt(45, floater.ImageWidth / 2, floater.ImageHeight / 2); 
   item.FloaterTransform = transform; 

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.