AnnSaveTag example for Delphi
Note: |
This topic is for Document/Medical only. |
//This sample saves all objects in Wang TIFF tag, clears the rasterview control, and reloads the image.
var
//Global declarations
RasterAnn: LEADRasterAnnotation;
procedure TForm1.Button1Click(Sender: TObject);
begin
RasterAnn:= CoLEADRasterAnnotation.Create ();
RasterAnn.AnnParentRasterView := LEADRasterView1.Raster;
LEADEventSink1.Connect (RasterAnn, _LEADRasterAnnotationEvents);
RasterAnn.AnnUserMode:= ANN_USERMODE_DESIGN;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
RasterIO: LEADRasterIO;
begin
RasterIO:= CreateComObject (CLASS_LEADRasterIO) as LEADRasterIO;
RasterAnn.AnnSaveTag (RasterIO, True, False);
RasterIO.Save (LEADRasterView1.Raster, 'c:\testwang.tif', FILE_CCITT_GROUP4, 1, 2, SAVE_OVERWRITE);
//clear the LEAD raster view control
LEADRasterView1.Raster.Bitmap := 0;
//Reload the image with the wang-compatible annotations
RasterIO.Load (LEADRasterView1.Raster, 'c:\testwang.tif', 0, 0, 1);
RasterAnn.AnnLoad ('c:\testwang.tif', 1);
RasterAnn.AnnUserMode := ANN_USERMODE_DESIGN;
end;