plugins:viewer_plugins:loading_bitmap_images_the_bitmap_method:dvp_loadbitmap

DVP_LoadBitmap(
     HWND:hWnd,
     LPTSTR:lpszName,
     LPVIEWERPLUGINFILEINFO:lpVPFileInfo,
     LPSIZE:lpszDesiredSize,
     HANDLE:hAbortEvent
)
→ HBITMAP

Arguments

hWnd

This parameter specifies the parent window handle that should be used to display any error messages if appropriate.

lpszName

Supplies the name of the file, including the full path.

lpVPFileInfo

This points to a VIEWERPLUGINFILEINFO structure that contains the data that you returned in the call to DVP_IdentifyFile, including the contents of the dwPrivateData field. You can use this field to pass your own data between the DVP_IdentifyFile function and this one.

lpszDesiredSize

If this parameter is non-NULL and the size it contains is also non-NULL, then it represents the "suggested size" for the image that you are returning. It is quite safe to ignore this field if you are not able to use it to easily control the size of the image that you return.

hAbortEvent

This parameter specifies an event object that Directory Opus uses to abort your plugin during a lengthy operation. Please see the description of the DVP_IdentifyFile function for information on how to use this parameter.

Return value

The bitmap image, as a standard Windows HBITMAP handle. Alternatively, a raw JPEG or PNG data stream can be returned - see Loading Bitmap Images (the "bitmap method").

Description

The DVP_LoadBitmap function is called to load a bitmap from a disk file.

Your DVP_LoadBitmap function must access the specified file and generate a bitmap image, which must be formatted and returned as a standard Windows HBITMAP handle (for example, created by a call to CreateCompatibleBitmap() or CreateDIBSection()). The size, bit depth and format of this bitmap are not restricted. However, in the case of thumbnail images, Directory Opus may pass a "suggested" size to your function. If you are able to generate scaled images you may wish to use this suggested size to speed up any image scaling that Directory Opus has to perform to reduce the size of the bitmap that you return to that specified by the user in their Thumbnail Preferences. For example, the JPEG file format lends itself to very quick image scaling by factors of ½, ¼, etc. If you ignore the suggested size parameter then Directory Opus will do its own scaling if necessary.