Leadtools Namespace > RasterImage Class : Underlay Method |
public void Underlay( RasterImage underlayImage, RasterImageUnderlayFlags flags )
'Declaration Public Sub Underlay( _ ByVal underlayImage As RasterImage, _ ByVal flags As RasterImageUnderlayFlags _ )
'Usage Dim instance As RasterImage Dim underlayImage As RasterImage Dim flags As RasterImageUnderlayFlags instance.Underlay(underlayImage, flags)
public void Underlay( RasterImage underlayImage, RasterImageUnderlayFlags flags )
function Leadtools.RasterImage.Underlay( underlayImage , flags )
public: void Underlay( RasterImage^ underlayImage, RasterImageUnderlayFlags flags )
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.
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:\Users\Public\Documents\LEADTOOLS Images" End Class
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:\Users\Public\Documents\LEADTOOLS Images"; }
RasterImageExamples.prototype.UnderlayExample = function () { Tools.SetLicense(); with (Leadtools) { with (Leadtools.Codecs) { var codecs = new RasterCodecs(); var srcFileName = "Assets\\Image1.cmp"; var image; var underlayImage; return Tools.AppInstallFolder().getFileAsync(srcFileName).then(function (loadFile) { return codecs.loadAsync(LeadStreamFactory.create(loadFile)) }) .then(function (img) { image = img; // Load underlay image srcFileName = "Assets\\ULAY1.BMP"; return Tools.AppInstallFolder().getFileAsync(srcFileName) }) .then(function (loadFile) { return codecs.loadAsync(LeadStreamFactory.create(loadFile)) }) .then(function (underlayImg) { underlayImage = underlayImg; // Use underlayImage as a tiled underlay for image image.underlay(underlayImage, RasterImageUnderlayFlags.none); return Tools.AppLocalFolder().createFileAsync("IMAGE1_underlay.BMP") }) .then(function (saveFile) { var saveStream = LeadStreamFactory.create(saveFile); return codecs.saveAsync(image, saveStream, RasterImageFormat.bmp, 0) }) .then(function () { image.close(); underlayImage.close(); codecs.close(); }); } } }
[TestMethod] public async Task UnderlayExample() { RasterCodecs codecs = new RasterCodecs(); string srcFileName = @"Assets\Image1.cmp"; StorageFile loadFile = await Tools.AppInstallFolder.GetFileAsync(srcFileName); RasterImage image = await codecs.LoadAsync(LeadStreamFactory.Create(loadFile)); // Load underlay image srcFileName = @"Assets\ULAY1.BMP"; loadFile = await Tools.AppInstallFolder.GetFileAsync(srcFileName); RasterImage underlayImage = await codecs.LoadAsync(LeadStreamFactory.Create(loadFile)); // Use underlayImage as a tiled underlay for image image.Underlay(underlayImage, RasterImageUnderlayFlags.None); StorageFile saveFile = await Tools.AppLocalFolder.CreateFileAsync("IMAGE1_underlay.BMP"); ILeadStream saveStream = LeadStreamFactory.Create(saveFile); await codecs.SaveAsync(image, saveStream, RasterImageFormat.Bmp, 0); image.Dispose(); underlayImage.Dispose(); codecs.Dispose(); }
public void UnderlayExample(RasterImage image, RasterImage underlayImage, Stream destStream) { // Use underlayImage as a tiled underlay for image image.Underlay(underlayImage, RasterImageUnderlayFlags.None); RasterCodecs codecs = new RasterCodecs(); codecs.Save(image, destStream, RasterImageFormat.Bmp, 0); image.Dispose(); underlayImage.Dispose(); }
Public Sub UnderlayExample(ByVal image As RasterImage, ByVal underlayImage As RasterImage, ByVal destStream As Stream)
' Use underlayImage as a tiled underlay for image
image.Underlay(underlayImage, RasterImageUnderlayFlags.None)
Dim codecs As RasterCodecs = New RasterCodecs()
codecs.Save(image, destStream, RasterImageFormat.Bmp, 0)
image.Dispose()
underlayImage.Dispose()
End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2