ReadLoadResolutions Example for C++ 5.0 and later
This example shows how to use the methods and properties for FlashPix files.
ILEADRasterIO *pRasterIO=NULL;
CString TempStr, InfoStr; // For composing message strings
int LoadResolutionCount; // Number of resolutions available
CoCreateInstance(CLSID_LEADRasterIO, NULL, CLSCTX_ALL,
IID_ILEADRasterIO, (void**)&pRasterIO);
// Initialize the display
m_LEADRasterView1.SetAutoScroll(FALSE);
m_LEADRasterView1.SetAutoSetRects(TRUE);
m_LEADRasterView1.SetPaintSizeMode(PAINTSIZEMODE_FIT);
pRasterIO->GetFileInfo(m_LEADRasterView1.GetRaster(),
"v:\\images\\image5.fpx", 0, 0 );
// Update information about the available resolutions.
pRasterIO->ReadLoadResolutions("v:\\images\\image5.fpx");
// Update a local variable with the number of resolutions.
LoadResolutionCount = pRasterIO->GetLoadResolutionCount();
// Display a message box that shows the available sizes.
InfoStr = TEXT("Available dimensions:\n");
for(int i = 0; i < LoadResolutionCount; ++i)
{
TempStr.Format(TEXT("%d X %d\n"),
(int)pRasterIO->GetLoadResolutionWidth(i),
(int)pRasterIO->GetLoadResolutionHeight(i));
InfoStr += TempStr;
}
MessageBox( InfoStr, TEXT("File Information"));
// Set the size to load, the smallest size in this case.
pRasterIO->SetLoadResolution(m_LEADRasterView1.GetRaster(),
pRasterIO->GetInfoFormat(),
pRasterIO->GetLoadResolutionWidth(0),
pRasterIO->GetLoadResolutionHeight(0));
// Get the dimensions that we just set and display them.
pRasterIO->GetLoadResolution(pRasterIO->GetInfoFormat());
InfoStr = TEXT("Size that will be loaded:\n\n");
TempStr.Format(TEXT("%d X %d\n"),
(int)pRasterIO->GetLoadResolutionWidth(0),
(int)pRasterIO->GetLoadResolutionHeight(0));
InfoStr += TempStr;
MessageBox(InfoStr, TEXT("File Information"));
// Load the bitmap, keeping the bits per pixel of the file.
pRasterIO->Load(m_LEADRasterView1.GetRaster(),
"v:\\images\\image5.fpx", 0, 0, 1);
pRasterIO->Release();