LEADTOOLS Image Processing (Leadtools.ImageProcessing.Effects assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.29
UnderlayImage Property
See Also 
Leadtools.ImageProcessing.Effects Namespace > TextureAlphaBlendCommand Class : UnderlayImage Property



Gets or sets an RasterImage object that references the image to be used as the underlying image.

Syntax

Visual Basic (Declaration) 
Public Property UnderlayImage As RasterImage
Visual Basic (Usage)Copy Code
Dim instance As TextureAlphaBlendCommand
Dim value As RasterImage
 
instance.UnderlayImage = value
 
value = instance.UnderlayImage
C# 
public RasterImage UnderlayImage {get; set;}
C++/CLI 
public:
property RasterImage^ UnderlayImage {
   RasterImage^ get();
   void set (    RasterImage^ value);
}

Property Value

RasterImage object that references the image to be used as the underlying image. The command will use this image to underlay the mask image. You could ignore this property effect by passing null.

Example

Run the Leadtools.ImageProcessing.Effects.TextureAlphaBlendCommand on an image.

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

   Dim leadImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Master.jpg"))

   ' Prepare the command
   Try
      Dim srcImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "ImageProcessingDemo\image3.cmp"), 4, CodecsLoadByteOrder.Bgr, 1, 1)

      'Load the fade mask image.
      Dim maskImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "ImageProcessingDemo\FadeMask.bmp"), 4, CodecsLoadByteOrder.Bgr, 1, 1)

      Dim command As TextureAlphaBlendCommand = New TextureAlphaBlendCommand
      command.DestinationRectangle = New LeadRect(leadImage.Width \ 2 - maskImage.Width \ 2, leadImage.Height \ 2 - maskImage.Height \ 2, maskImage.Width, maskImage.Height)
      command.MaskImage = maskImage
      command.Opacity = 100
      command.SourceImage = srcImage
      command.SourcePoint = New LeadPoint(0, 0)
      command.UnderlayImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "cannon.jpg"), 4, CodecsLoadByteOrder.Bgr, 1, 1)
      command.UnderlayOffset = New LeadPoint(150, 10)
      ' Combine ImageSource with the affected image, with MaskImage and a 100 opacity.
      command.Run(leadImage)
      codecs.Save(leadImage, Path.Combine(LEAD_VARS.ImagesDir, "Result.jpg"), RasterImageFormat.Jpeg, 24)

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

End Sub

Public NotInheritable Class LEAD_VARS
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
C#Copy Code
public void UnderlayImagePropertyExample()
   {
      // Load an image
      RasterCodecs codecs = new RasterCodecs();
      codecs.ThrowExceptionsOnInvalidImages = true;

      RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Master.jpg"));

      // Prepare the command
      RasterImage srcImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, @"ImageProcessingDemo\Image3.cmp"), 4, CodecsLoadByteOrder.Bgr, 1, 1);

      //Load the fade mask image.
      RasterImage maskImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, @"ImageProcessingDemo\FadeMask.bmp"), 4, CodecsLoadByteOrder.Bgr, 1, 1);

      TextureAlphaBlendCommand command = new TextureAlphaBlendCommand();
      command.DestinationRectangle = new LeadRect(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 LeadPoint(0, 0);
      command.UnderlayImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "cannon.jpg"), 4, CodecsLoadByteOrder.Bgr, 1, 1);
      command.UnderlayOffset = new LeadPoint(150, 10);
      // Combine ImageSource with the affected image, with MaskImage and a 100 opacity.
      command.Run(image);
      codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "Result.jpg"), RasterImageFormat.Jpeg, 24);

   }

static class LEAD_VARS
{
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
SilverlightCSharpCopy Code
SilverlightVBCopy Code

Requirements

Target Platforms: Silverlight 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only)

See Also