#include "ltwrappr.h"
virtual L_INT LFile::CreateThumbnail(pThumbOptions, pLoadOptions, pFileInfo)
const pTHUMBOPTIONS pThumbOptions; |
pointer to a structure |
pLOADFILEOPTION pLoadOptions; |
pointer to optional extended load options |
pFILEINFO pFileInfo; |
pointer to a structure |
Creates a thumbnail from the specified image file.
Parameter |
Description |
pThumbOptions |
Pointer to a structure containing thumbnail generation options. Pass NULL to get the default options. |
pLoadOptions |
Pointer to optional extended load options. Pass NULL to use the default load options. |
pFileInfo |
Pointer to a FILEINFO structure. This structure may contain file information used in loading an image, or it may be updated with information about the file being loaded. |
|
If nothing is known about the file, pass NULL for this parameter, or declare a variable of type FILEINFO and set the FILEINFO. Flags to 0, then pass the address of the FILEINFO structure in this parameter. In this case, if the address of a FILEINFO structure is passed, the FILEINFO structure will be updated with the results of LFile::GetInfo. |
|
If only the file type is known, set pFileInfo.Format to the file type and set pFileInfo.Flags to FILEINFO_FORMATVALID. This can also be done if LFile::GetInfo.has been called previously, but values that affect the size of the image loaded have been changed (for example, by calling LFileSettings::SetPCDResolution or LFileSettings::SetWMFResolution). In this case the FILEINFO structure pointed to by pFileInfo will be updated with the results of LFile::GetInfo. |
|
If LFile::GetInfo.has been called prior to calling this function, and no changes have been made to the contents of the structure filled by LFile::GetInfo., then the address of the filled FILEINFO structure can be passed for this parameter. In this case, the FILEINFO.Flags member should be set to FILEINFO_INFOVALID. The LFile::GetInfo.function will set the FILEINFO.Flags to FILEINFO_INFOVALID. In this case the load will be faster since this function does not have to query the file filters for the file type. |
|
Note: Local variables are not initialized (since they are placed on the stack). So if you have a FILEINFO structure as a local variable, the value of its Flags parameter is undefined, possibly having FILEINFO_INFOVALID or FILEINFO_FORMATVALID set. That is why it is important to initialize FILEINFO.Flags before passing the address of the FILEINFO structure to the function. |
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
This function is used internally by LFile::BrowseDir to create/load the thumbnails for each file that is enumerated. You can use this function to manually create the thumbnail for a specified image file.
Since the function allocates storage to hold the image, it is up to you to free this storage by calling LBitmapBase::Free.
The default thumbnail options are:
DefThumbOpt.nWidth |
= 80; |
DefThumbOpt.nHeight |
= 80; |
DefThumbOpt.nBits |
= 0; |
DefThumbOpt.uCRFlags |
= 0; |
DefThumbOpt.bMaintainAspect |
= TRUE; |
DefThumbOpt.bForceSize |
= FALSE; |
DefThumbOpt.crBackColor |
= RGB(0,0,0); |
DefThumbOpt.bLoadStamp |
= TRUE; |
DefThumbOpt.bResample |
= FALSE; |
Note: More options are available in the LOADFILEOPTION structure.
Note: You should never pass an uninitialized FILEINFO structure to this function.
Required DLLs and Libraries
LTFIL For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Win32, x64.
Functions: |
LFile::LoadFile, LFile::BrowseDir, Class Members, LFileSettings::SetWMFResolution |
Topics: |
|
|
|
|
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
class MyFileClass : public LFile
{
public:
L_INT CreateThumbnailCallBack(pFILEINFO pFileInfo,
LBitmapBase* pLBitmap,
LBuffer* pLBuffer,
L_UINT uFlags,
L_INT nRow,
L_INT nLines);
};
L_INT MyFileClass::CreateThumbnailCallBack(pFILEINFO pFileInfo,
LBitmapBase* pLBitmap,
LBuffer* pLBuffer,
L_UINT uFlags,
L_INT nRow,
L_INT nLines)
{
UNREFERENCED_PARAMETER(pFileInfo);
UNREFERENCED_PARAMETER(pLBitmap);
UNREFERENCED_PARAMETER(pLBuffer);
UNREFERENCED_PARAMETER(uFlags);
UNREFERENCED_PARAMETER(nRow);
UNREFERENCED_PARAMETER(nLines);
// Write Your Code here.
return SUCCESS;
}
L_INT LFile__CreateThumbnailExample()
{
LBitmap LeadBitmap;
L_INT nRet;
THUMBOPTIONS opt;
nRet = LeadBitmap.Load (MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")));
if(nRet != SUCCESS)
return nRet;
//Create a thumbnail with default options, and no callback
nRet = LeadBitmap.File()->CreateThumbnail(NULL, NULL, NULL );
if(nRet != SUCCESS)
return nRet;
if(nRet == SUCCESS)
{
nRet = LeadBitmap.Free ();
if(nRet != SUCCESS)
return nRet;
}
//Create a thumbnail with some options, and no callback
MyFileClass *Tmp = new MyFileClass();
Tmp->SetFileName(MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")));
memset(&opt, 0, sizeof(THUMBOPTIONS));
opt.uStructSize = sizeof(THUMBOPTIONS);
opt.bLoadStamp = FALSE;
opt.nHeight = 40;
opt.nWidth = 80;
opt.bForceSize = TRUE;
opt.bMaintainAspect = TRUE;
opt.crBackColor = RGB(255,0,0);
Tmp->EnableCallBack(TRUE);
nRet = Tmp->CreateThumbnail(&opt, NULL, NULL);
if(nRet != SUCCESS)
return nRet;
return SUCCESS;
}
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET