Leadtools.ImageProcessing.Effects Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
FeatherAlphaBlendCommand Class
See Also  Members   Example 
Leadtools.ImageProcessing.Effects Namespace : FeatherAlphaBlendCommand Class



Combines image data from two images with feathering. The two images can be combined with variable opacity applied by specifying the region of a fade mask image.

Syntax

Visual Basic (Declaration) 
Public Class FeatherAlphaBlendCommand 
   Inherits RasterCommand
   Implements IRasterCommand 
Visual Basic (Usage)Copy Code
Dim instance As FeatherAlphaBlendCommand
C# 
public class FeatherAlphaBlendCommand : RasterCommand, IRasterCommand  
C++/CLI 
public ref class FeatherAlphaBlendCommand : public RasterCommand, IRasterCommand  

Example

Run the FeatherAlphaBlendCommand on an image.

Visual BasicCopy Code
Public Sub FeatherAlphaBlendCommandExample()
   RasterCodecs.Startup()
   Dim codecs As New RasterCodecs()
   codecs.ThrowExceptionsOnInvalidImages = True

   Dim leadImage As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Master.jpg")

   Dim command As FeatherAlphaBlendCommand = New FeatherAlphaBlendCommand
   command.DestinationRectangle = New Rectangle(0, 0, leadImage.Width \ 2, leadImage.Height \ 2)
   command.MaskImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Image3.cmp", 24, CodecsLoadByteOrder.Bgr, 1, 1)
   command.SourceImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Image2.cmp", 24, CodecsLoadByteOrder.Bgr, 1, 1)
   command.SourcePoint = New Point(0, 0)
   command.Run(leadImage)
   codecs.Save(leadImage, LeadtoolsExamples.Common.ImagesPath.Path + "Result.jpg", RasterImageFormat.Jpeg, 24)

   command.SourceImage.Dispose()

   RasterCodecs.Shutdown()
End Sub
C#Copy Code
public void FeatherAlphaBlendCommandExample() 

   // Load an image 
   RasterCodecs.Startup(); 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Master.jpg"); 
 
   FeatherAlphaBlendCommand command = new FeatherAlphaBlendCommand(); 
   command.DestinationRectangle = new Rectangle(0, 0, image.Width / 2, image.Height / 2); 
   command.MaskImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Image3.cmp", 24, CodecsLoadByteOrder.Bgr, 1, 1); 
   command.SourcePoint = new Point(image.Width / 2, image.Height / 2); 
   command.SourceImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Image2.cmp", 24, CodecsLoadByteOrder.Bgr, 1, 1); 
   command.Run(image); 
   codecs.Save(image, LeadtoolsExamples.Common.ImagesPath.Path + "Result.jpg", RasterImageFormat.Jpeg, 24); 
 
   //FadeRegionImage.Dispose(); 
   command.SourceImage.Dispose(); 
 
   RasterCodecs.Shutdown(); 
}

Remarks

  • To combine two images with a fixed opacity, use the AlphaBlendCommand.
  • The FeatherAlphaBlendCommand achieves feathering between two images by using variable opacity values, obtained from the fade mask referenced by MaskImage. Use the MaskSourcePoint to specify a region of the mask image, these values are the coordinates of the origin of the mask rectangle.
  • To create an image that contains a fade mask, use FadedMaskCommand command.
  • This command supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.
  • This command does not support signed data images.
  • This command does not support 32-bit grayscale images.
For more information, refer to Introduction to Image Processing With LEADTOOLS.

Inheritance Hierarchy

System.Object
   Leadtools.ImageProcessing.RasterCommand
      Leadtools.ImageProcessing.Effects.FeatherAlphaBlendCommand

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also