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




Combines image data from two images with feathering and constant opacity; by combining the two images with a variable opacity that depends on a fade mask then combine the result with the destination image with a constant opacity. This command is available in the Raster Pro and above toolkits.

Syntax

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

Example

Visual BasicCopy Code
ImageProcessing.Effects.TextureAlphaBlendCommand
   Public Sub TextureAlphaBlendCommandExample()
      RasterCodecs.Startup()
      Dim codecs As New RasterCodecs()
      codecs.ThrowExceptionsOnInvalidImages = True

      Dim leadImage As RasterImage = codecs.Load("C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Master.jpg")

      ' Prepare the command
      Try
         Dim SrcImage As RasterImage
         Dim MaskImage As RasterImage
         Dim underlayImage As RasterImage
         SrcImage = codecs.Load("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 15\\Images\\image2.cmp", 24, CodecsLoadByteOrder.Bgr, 1, 1)
         'Load the fade mask image.
         MaskImage = codecs.Load("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 15\\Images\\image3.cmp", 24, CodecsLoadByteOrder.Bgr, 1, 1)
         underlayImage = codecs.Load("C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Slave.jpg", 4, CodecsLoadByteOrder.Bgr, 1, 1)
         Dim command As TextureAlphaBlendCommand = New TextureAlphaBlendCommand
         command.DestinationRectangle = New Rectangle(0, 0, leadImage.Width, leadImage.Height)
         command.MaskImage = MaskImage
         command.Opacity = 100
         command.SourceImage = SrcImage
         command.UnderlayImage = underlayImage
         command.SourcePoint = New Point(0, 0)
         ' Combine ImageSource with the affected image, with MaskImage and a 100 opacity.
         command.Run(leadImage)
         codecs.Save(leadImage, "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Result.jpg", RasterImageFormat.Jpeg, 24)

      Catch ex As Exception
         MessageBox.Show(ex.Message, "TextureAlphaBlendTest", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
      End Try

      RasterCodecs.Shutdown()
   End Sub
C#Copy Code
ImageProcessing.Effects.TextureAlphaBlendCommand 
      public void TextureAlphaBlendCommandExample() 
      { 
         // Load an image 
         RasterCodecs.Startup(); 
         RasterCodecs codecs = new RasterCodecs(); 
         codecs.ThrowExceptionsOnInvalidImages = true; 
 
         RasterImage image = codecs.Load(@"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Master.jpg"); 
 
         // Prepare the command 
         RasterImage SrcImage; 
         RasterImage MaskImage; 
         RasterImage underlayImage; 
 
         SrcImage = codecs.Load(@"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Image3.cmp", 4, CodecsLoadByteOrder.Bgr, 1, 1); 
         //Load the fade mask image. 
         MaskImage = codecs.Load(@"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\FadeMask.bmp", 4, CodecsLoadByteOrder.Bgr, 1, 1); 
 
         underlayImage = codecs.Load(@"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Slave.jpg", 4, CodecsLoadByteOrder.Bgr, 1, 1); 
 
         TextureAlphaBlendCommand command = new TextureAlphaBlendCommand(); 
         command.DestinationRectangle = new Rectangle(image.Width / 2 - MaskImage.Width / 2, image.Height / 2  - MaskImage.Height / 2, MaskImage.Width, MaskImage.Height); 
         command.MaskImage = MaskImage; 
         command.Opacity = 100; 
         command.SourceImage = SrcImage; 
         command.SourcePoint = new Point(0, 0); 
         command.UnderlayImage = underlayImage; 
         // Combine ImageSource with the affected image, with MaskImage and a 100 opacity. 
         command.Run(image); 
         codecs.Save(image, @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Result.jpg", RasterImageFormat.Jpeg, 24); 
 
         RasterCodecs.Shutdown(); 
      }

Remarks

  • To combine two images with a fixed opacity, use the AlphaBlendCommand.
  • To combine two images with a feather, use the FeatherAlphaBlendCommand.
  • The TextureAlphaBlendCommand does the two operations; first it combines the two images with feathering using the fade mask image, then combines the result with the destination image with a fixed opacity.
  • To create an image that contains a fade mask, use FadedMaskCommand.
  • This command can also underlay the fade mask image with the underlay image before using it in the feather combine operation.
  • This command also combines the fade mask image with the underlay image so that it appears to be an underlying texture for the fade mask image.
  • The following is an example for the resulted image using this commands with the following characteristics:
    • The source image is a red image.
    • The destination image is a white image.
    • The opacity is set to 255.
    • The right image is the result of applying the method without texture image.
    • The left image is the result of applying the method with texture image.
  • 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 Processing an Image.
For more information, refer to Applying Artistic Effects.

Inheritance Hierarchy

System.Object
   Leadtools.ImageProcessing.RasterCommand
      Leadtools.ImageProcessing.Effects.TextureAlphaBlendCommand

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