ReadLoadResolutions Example for C++ Builder
This example shows how to use the methods and properties for FlashPix files.
AnsiString TempStr, InfoStr; //For composing message strings
short i; //Loop counter
LEADRasterIO* pRasterIO= NULL;
CoCreateInstance(CLSID_LEADRasterIO, NULL, CLSCTX_ALL, IID_ILEADRasterIO, (void**)&pRasterIO);
//Initialize the display
LEADRasterView1->AutoScroll = False;
LEADRasterView1->AutoSetRects = True;
LEADRasterView1->PaintSizeMode = PAINTSIZEMODE_FIT;
pRasterIO->GetFileInfo ( LEADRasterView1->Raster, AnsiToOLESTR("v:\\images\\image5.fpx"), 0, 0 ) ;
//Update information about the available resolutions.
pRasterIO->ReadLoadResolutions ( AnsiToOLESTR("v:\\images\\image5.fpx") ) ;
//Display a message box that shows the available sizes.
InfoStr = "Available dimensions:\n";
for (i = 0; i < pRasterIO->LoadResolutionCount; i ++)
{
TempStr= IntToStr((int)pRasterIO->get_LoadResolutionWidth(i)) + " X " +
IntToStr((int)pRasterIO->get_LoadResolutionWidth (i)) + "\n";
InfoStr= InfoStr + TempStr;
}
ShowMessage (InfoStr);
// Set the size to load, the smallest size in this case
pRasterIO->SetLoadResolution (LEADRasterView1->Raster,
pRasterIO->InfoFormat,
pRasterIO->get_LoadResolutionWidth(0),
pRasterIO->get_LoadResolutionHeight (0));
//Get the dimensions that we just set and display them
pRasterIO->GetLoadResolution (pRasterIO->InfoFormat);
InfoStr = "Size that will be loaded:\n\n" ;
TempStr = IntToStr((int)pRasterIO->get_LoadResolutionWidth(0)) +
" X " + IntToStr ((int)pRasterIO->get_LoadResolutionWidth(0)) + "\n";
InfoStr = InfoStr + TempStr;
ShowMessage (InfoStr);
//Load the bitmap, keeping the bits per pixel of the file->
pRasterIO->Load (LEADRasterView1->Raster, AnsiToOLESTR("v:\\images\\image5.fpx"), 0, 0, 1);
pRasterIO-> Release( );