Leadtools Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
Underlay Method
See Also  Example
Leadtools Namespace > RasterImage Class : Underlay Method



underlayImage
The image that will be used as the underlying image. This is the image that appears to be on bottom and is grayscaled as it is combined with the target image.
flags
Indicators of how the underlying image is to be positioned.
Combines two images so that one appears to be an underlying texture for the other.

Syntax

Visual Basic (Declaration) 
Public Sub Underlay( _
   ByVal underlayImage As RasterImage, _
   ByVal flags As RasterImageUnderlayFlags _
) 
Visual Basic (Usage)Copy Code
Dim instance As RasterImage
Dim underlayImage As RasterImage
Dim flags As RasterImageUnderlayFlags
 
instance.Underlay(underlayImage, flags)
C# 
public void Underlay( 
   RasterImage underlayImage,
   RasterImageUnderlayFlags flags
)
C++/CLI 
public:
void Underlay( 
   RasterImage^ underlayImage,
   RasterImageUnderlayFlags flags
) 

Parameters

underlayImage
The image that will be used as the underlying image. This is the image that appears to be on bottom and is grayscaled as it is combined with the target image.
flags
Indicators of how the underlying image is to be positioned.

Example

This example draws an ellipse on the image.

Visual BasicCopy Code
Public Sub UnderlayExample()
   RasterCodecs.Startup()
   Dim codecs As RasterCodecs = New RasterCodecs()
   Dim image As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "IMAGE1.CMP")

   ' Load underlay image
   Dim underlayImage As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "ULAY1.BMP")
   ' Use underlayImage as a tiled underlay for image
   image.Underlay(underlayImage, RasterImageUnderlayFlags.None)

   codecs.Save(image, LeadtoolsExamples.Common.ImagesPath.Path + "IMAGE1_underlay.BMP", RasterImageFormat.Bmp, 0)

   image.Dispose()
   underlayImage.Dispose()
   codecs.Dispose()
   RasterCodecs.Shutdown()
End Sub
C#Copy Code
public void UnderlayExample() 

   RasterCodecs.Startup(); 
   RasterCodecs codecs = new RasterCodecs(); 
   RasterImage image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "IMAGE1.CMP"); 
 
   // Load underlay image 
   RasterImage underlayImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "ULAY1.BMP"); 
   // Use underlayImage as a tiled underlay for image 
   image.Underlay(underlayImage, RasterImageUnderlayFlags.None); 
 
   codecs.Save(image, LeadtoolsExamples.Common.ImagesPath.Path + "IMAGE1_underlay.BMP", RasterImageFormat.Bmp, 0); 
 
   image.Dispose(); 
   underlayImage.Dispose(); 
   codecs.Dispose(); 
   RasterCodecs.Shutdown(); 
}

Remarks

This is most effective when the underlying image is a filtered one, such as an embossed image.

This method changes the colors of the underlay to grayscale as it combines the images. It updates this RasterImage, leaving the underlayImage unchanged. underlayImage can either be stretched or tiled to fill the image, as shown in the following illustration:

For more information, refer to Introduction to Image Processing With LEADTOOLS.

For more information, refer to Applying Artistic Effects.

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family

See Also