public delegate void CodecsOverlayCallback(
CodecsOverlayData data
)
typedef void (^LTCodecsOverlayCallback)(LTCodecsOverlayData *data)
public void onOverlay(CodecsOverlayData data)
public delegate void CodecsOverlayCallback(
CodecsOverlayData^ data
)
data
A CodecsOverlayData object that contains information about the callback. Some members of this object are for input, some are for output. For more information, refer to CodecsOverlayData.
The CodecsOverlayCallback delegate is passed to RasterCodecs.StartOverlay to get the overlay image and other information from the user when loading a file containing an overlay.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;
using Leadtools.Svg;
void PtokaOverlayExample(string ptokaFileName, string ptokaFilesPath)
{
RasterCodecs codecs = new RasterCodecs();
// Set up the private variables used in the callback
myCodecs = codecs;
myPtokaFilesPath = ptokaFilesPath;
// Set the overlay callback
codecs.StartOverlay(CodecsOverlayCallback, CodecsOverlayCallbackMode.CallLoad);
// Load the PTOKA file
RasterImage image = codecs.Load(ptokaFileName);
// Stop the overlay by resetting the old callback.
codecs.StopOverlay();
// Save the image as TIFF
string destFileName = Path.Combine(LEAD_VARS.ImagesDir, "PtokaOverlay.tif");
codecs.Save(image, destFileName, RasterImageFormat.Tif, 1);
image.Dispose();
// Clean up
codecs.Dispose();
}
RasterCodecs myCodecs;
string myPtokaFilesPath;
void CodecsOverlayCallback(CodecsOverlayData data)
{
// Show overlay information
Debug.WriteLine("File: {0}", data.FileName);
Debug.WriteLine("Page Number: {0}", data.PageNumber);
Debug.WriteLine("Info: {0}", data.Info);
// Construct the overlay file name
string overlayFileName = Path.Combine(myPtokaFilesPath, data.FileName);
if (data.Info)
{
// Info, we only need to fill in the .InfoXXX members of the data
CodecsImageInfo imageInfo = myCodecs.GetInformation(overlayFileName, false);
data.InfoWidth = imageInfo.Width;
data.InfoHeight = imageInfo.Height;
data.InfoXResolution = imageInfo.XResolution;
data.InfoYResolution = imageInfo.YResolution;
}
else
{
// We need to load the overlay image into the .Image member
data.Image = myCodecs.Load(overlayFileName);
}
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document