ReadLoadResolutions Example for Delphi
This example shows how to use the methods and properties for FlashPix files.
var
TempStr, InfoStr: String; //For composing message strings
i: Integer; //Loop counter
RasterIO: LEADRasterIO;
begin
RasterIO:= CreateComObject (CLASS_LEADRasterIO) As LEADRasterIO;
//Initialize the display
LEADRasterView1.AutoScroll := False;
LEADRasterView1.AutoSetRects := True;
LEADRasterView1.PaintSizeMode := PAINTSIZEMODE_FIT;
RasterIO.GetFileInfo ( LEADRasterView1.Raster, 'v:\images\image5.fpx', 0, 0 ) ;
//Update information about the available resolutions.
RasterIO.ReadLoadResolutions ( 'v:\images\image5.fpx' ) ;
//Display a message box that shows the available sizes.
InfoStr := 'Available dimensions:' + Chr(13);
for i := 0 to RasterIO.LoadResolutionCount - 1 do
begin
TempStr:= IntToStr(Trunc(RasterIO.LoadResolutionWidth [i])) + ' X ' +
IntToStr(Trunc(RasterIO.LoadResolutionWidth[i])) + Chr(13);
InfoStr:= InfoStr + TempStr;
end;
ShowMessage (InfoStr);
// Set the size to load, the smallest size in this case.
RasterIO.SetLoadResolution (LEADRasterView1.Raster,
RasterIO.InfoFormat,
RasterIO.LoadResolutionWidth [0],
RasterIO.LoadResolutionHeight [0]);
//Get the dimensions that we just set and display them.
RasterIO.GetLoadResolution (RasterIO.InfoFormat);
InfoStr := 'Size that will be loaded:' + Chr(13) + Chr(13);
TempStr := IntToStr(Trunc(RasterIO.LoadResolutionWidth[0])) +
' X ' + IntToStr (Trunc (RasterIO.LoadResolutionWidth [0])) + Chr (13);
InfoStr := InfoStr + TempStr;
ShowMessage (InfoStr);
//Load the bitmap, keeping the bits per pixel of the file.
RasterIO.Load (LEADRasterView1.Raster, 'v:\images\image5.fpx', 0, 0, 1);
end;