PCDRes example for Delphi

This example checks for a high-resolution image and loads it if possible.

var
   Msg: string;
   sRet: Smallint;
   myfile: string;
   RasterIO: LEADRasterIO;

begin
   RasterIO:= CreateComObject(CLASS_LEADRasterIO)as LEADRasterIO;
   myfile:= 'v:\images\pcd\_aiwanit.pcd'; //No PCD sample image is included with LEADTOOLS
   RasterIO.GetFileInfo (LEADRasterView1.Raster, myfile, 0, 0 ) ;
   if (RasterIO.InfoPCDRes [PCDRES_4BASE] = True )then
   begin
       RasterIO.PCDRes:= PCDRES_4BASE;
       Msg:= 'Loading 1024 x 1536 resolution';
   end
   else
   begin
      RasterIO.PCDRes:= PCDRES_BASE;
       Msg:= 'Loading 512 x 768 resolution';
   end;

   ShowMessage(Msg);
   Cursor:= crHourGlass;
   //Turn on the automatic display rectangles and the scroll bars.
   LEADRasterView1.AutoSetRects:= True;
   LEADRasterView1.AutoScroll:= True;
   //Load the file.
   RasterIO.Load (LEADRasterView1.Raster, myfile, 0, 0, 1);
   LEADRasterView1.ForceRepaint (sRet);
   Cursor:= crDefault;
end;