Indicates which method should be called when an overlay is detected inside a file.
public void StartOverlay(CodecsOverlayCallback callback,CodecsOverlayCallbackMode mode)
Public Sub StartOverlay( _ByVal callback As Leadtools.Codecs.CodecsOverlayCallback, _ByVal mode As Leadtools.Codecs.CodecsOverlayCallbackMode _)
public void StartOverlay(Leadtools.Codecs.CodecsOverlayCallback callback,Leadtools.Codecs.CodecsOverlayCallbackMode mode)
- (BOOL)startOverlay:(nullable LTCodecsOverlayCallback)callbackmode:(LTCodecsOverlayCallbackMode)modeerror:(NSError **)error
public void startOverlay(CodecsOverlayListener listener, CodecsOverlayCallbackMode mode) function Leadtools.Codecs.RasterCodecs.StartOverlay(callback ,mode)
public:void StartOverlay(Leadtools.Codecs.CodecsOverlayCallback^ callback,Leadtools.Codecs.CodecsOverlayCallbackMode mode)
callback
The method which should be called when an overlay is detected. Use a null reference to indicate that LEADTOOLS should handle overlays automatically.
mode
Indicates when this method should be called. See CodecsOverlayCallbackMode for possible values.
Currently, only PTOCA files are known to use such overlays.
PTOCA files contain file references (i.e. filenames) to external files that contain overlay bitmaps. (These files are typically in IOCA format)
These external overlay files will be resized and placed on the current page according to the information from the PTOCA files. By default, LEADTOOLS will load these external overlay files from disk. You should override this behavior if you load files that are not stored locally (for example, on a remote storage or in a database).
To load overlays stored on other storage, you have to pass your overlay callback to this method and load the overlays in your overlay callback.
The overlay callback will be used until StopOverlay is called.
This example will read a PTOKA file and overlays a TIF file on it
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Color;using Leadtools.Svg;using LeadtoolsExamples.Common;void PtokaOverlayExample(string ptokaFileName, string ptokaFilesPath){RasterCodecs codecs = new RasterCodecs();string destFileName = Path.Combine(LEAD_VARS.ImagesDir, "PtokaOverlay.tif");// Set up the private variables used in the callbackmyCodecs = codecs;myPtokaFilesPath = ptokaFilesPath;// Set the overlay callbackcodecs.StartOverlay(MyOverlayCallback, CodecsOverlayCallbackMode.CallLoad);// Load the PTOKA fileRasterImage image = codecs.Load(ptokaFileName);// Stop the overlay by resetting the old callback.codecs.StopOverlay();// Save the image as TIFFcodecs.Save(image, destFileName, RasterImageFormat.Tif, 1);image.Dispose();// Clean upcodecs.Dispose();}RasterCodecs myCodecs;string myPtokaFilesPath;void MyOverlayCallback(CodecsOverlayData data){// Show overlay informationConsole.WriteLine("File: {0}", data.FileName);Console.WriteLine("Page Number: {0}", data.PageNumber);Console.WriteLine("Info: {0}", data.Info);// Construct the overlay file namestring overlayFileName = Path.Combine(myPtokaFilesPath, data.FileName);if (data.Info){// Info, we only need to fill in the .InfoXXX members of the dataCodecsImageInfo 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 memberdata.Image = myCodecs.Load(overlayFileName);}}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessingImports Leadtools.ImageProcessing.ColorImports Leadtools.DrawingImports Leadtools.SvgPrivate Sub PtokaOverlayExample(ByVal ptokaFileName As String, ByVal ptokaFilesPath As String)Dim codecs As RasterCodecs = New RasterCodecs()Dim destFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "PtokaOverlay.tif")' Set up the private variables used in the callbackmyCodecs = codecsmyPtokaFilesPath = ptokaFilesPath' Set the overlay callbackcodecs.StartOverlay(AddressOf MyOverlayCallback, CodecsOverlayCallbackMode.CallLoad)' Load the PTOKA fileDim image As RasterImage = codecs.Load(ptokaFileName)' Stop the overlay by resetting the old callback.codecs.StopOverlay()' Save the image as TIFFcodecs.Save(image, destFileName, RasterImageFormat.Tif, 1)image.Dispose()' Clean upcodecs.Dispose()End SubPrivate myCodecs As RasterCodecsPrivate myPtokaFilesPath As StringPrivate Sub MyOverlayCallback(ByVal data As CodecsOverlayData)' Show overlay informationConsole.WriteLine("File: {0}", data.FileName)Console.WriteLine("Page Number: {0}", data.PageNumber)Console.WriteLine("Info: {0}", data.Info)' Construct the overlay file nameDim overlayFileName As String = Path.Combine(myPtokaFilesPath, data.FileName)If data.Info Then' Info, we only need to fill in the .InfoXXX members of the dataDim imageInfo As CodecsImageInfo = myCodecs.GetInformation(overlayFileName, False)data.InfoWidth = imageInfo.Widthdata.InfoHeight = imageInfo.Heightdata.InfoXResolution = imageInfo.XResolutiondata.InfoYResolution = imageInfo.YResolutionElse' We need to load the overlay image into the .Image memberdata.Image = myCodecs.Load(overlayFileName)End IfEnd SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
