←Select platform

Underlay Method

Summary
Combines two images so that one appears to be an underlying texture for the other.
Syntax
C#
VB
Objective-C
C++
Java
Public Sub Underlay( _ 
   ByVal underlayImage As RasterImage, _ 
   ByVal flags As RasterImageUnderlayFlags _ 
)  
- (BOOL)underlay:(LTRasterImage *)underlayImage  
           flags:(LTRasterImageUnderlayFlags)flags  
           error:(NSError **)error 
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.

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:

Underlay

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

For more information, refer to Applying Artistic Effects.

Example

This example draws an ellipse on the image.

C#
VB
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Core; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Dicom; 
using Leadtools.Drawing; 
using Leadtools.Controls; 
using Leadtools.Svg; 
 
 
public void UnderlayExample() 
{ 
	RasterCodecs codecs = new RasterCodecs(); 
	RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1.CMP")); 
 
	// Load underlay image 
	RasterImage underlayImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "ULAY1.BMP")); 
	// Use underlayImage as a tiled underlay for image 
	image.Underlay(underlayImage, RasterImageUnderlayFlags.None); 
 
	codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1_underlay.BMP"), RasterImageFormat.Bmp, 0); 
 
	image.Dispose(); 
	underlayImage.Dispose(); 
	codecs.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images"; 
} 
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.ImageProcessing 
Imports Leadtools.ImageProcessing.Core 
Imports Leadtools.ImageProcessing.Color 
Imports Leadtools.Controls 
Imports Leadtools.Dicom 
Imports Leadtools.Drawing 
Imports Leadtools.Svg 
 
Public Sub UnderlayExample() 
   Dim codecs As RasterCodecs = New RasterCodecs() 
   Dim image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1.CMP")) 
 
   ' Load underlay image 
   Dim underlayImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "ULAY1.BMP")) 
   ' Use underlayImage as a tiled underlay for image 
   image.Underlay(underlayImage, RasterImageUnderlayFlags.None) 
 
   codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1_underlay.BMP"), RasterImageFormat.Bmp, 0) 
 
   image.Dispose() 
   underlayImage.Dispose() 
   codecs.Dispose() 
End Sub 
 
Public NotInheritable Class LEAD_VARS 
   Public Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images" 
End Class 
Requirements

Target Platforms

Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

Leadtools Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.