diff options
Diffstat (limited to 'lib/Thumbnail/thumbnail.h')
-rw-r--r-- | lib/Thumbnail/thumbnail.h | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/lib/Thumbnail/thumbnail.h b/lib/Thumbnail/thumbnail.h index b2be2239..307fc7cc 100644 --- a/lib/Thumbnail/thumbnail.h +++ b/lib/Thumbnail/thumbnail.h @@ -30,34 +30,49 @@ PREREQUISITES: /*-------------- |declarations| --------------*/ -typedef void* HICON; +struct ImageData //consider alignment! +{ + unsigned char* rgb; //rgb-byte order for use with wxImage + unsigned char* alpha; + int width; + int height; +}; DLL_FUNCTION_DECLARATION -HICON getThumbnail(const wchar_t* filename, int requestedSize); //return 0 on failure, caller takes ownership! -//Note: not all file types support thumbnails! make sure to implement fallback to file icon! +const ImageData* getThumbnail(const wchar_t* filename, int requestedSize); //return nullptr on failure, release after use +//Note: not all file types support thumbnails! implement fallback to file icon! +enum IconSizeType +{ + ICON_SIZE_16, + ICON_SIZE_32, + ICON_SIZE_48, + ICON_SIZE_128, + ICON_SIZE_256, +}; +//"iconIndex" as returned by ::SHGetFileInfo() DLL_FUNCTION_DECLARATION -HICON getIconByIndex(int iconIndex, int shilIconType); //return 0 on failure, caller takes ownership! -/* -"iconType" refers to parameter "iImageList" of ::SHGetImageList(); sample values: - SHIL_SMALL - 16x16, but the size can be customized by the user. - SHIL_EXTRALARGE - 48x48, but the size can be customized by the user. - SHIL_JUMBO - 256x256 pixels; Vista and later only -"iconIndex" as returned by ::SHGetFileInfo() -*/ +const ImageData* getIconByIndex(int iconIndex, IconSizeType st); //return nullptr on failure, release after use + +DLL_FUNCTION_DECLARATION +void releaseImageData(const ImageData* id); + /*---------- |typedefs| ----------*/ -typedef HICON (*FunType_getThumbnail )(const wchar_t* filename, int requestedSize); -typedef HICON (*FunType_getIconByIndex)(int iconIndex, int shilIconType); +typedef const ImageData* (*FunType_getThumbnail )(const wchar_t* filename, int requestedSize); +typedef const ImageData* (*FunType_getIconByIndex )(int iconIndex, IconSizeType st); +typedef void (*FunType_releaseImageData)(const ImageData* id); + /*-------------- |symbol names| --------------*/ //(use const pointers to ensure internal linkage) -const char funName_getThumbnail [] = "getThumbnail"; -const char funName_getIconByIndex[] = "getIconByIndex"; +const char funName_getThumbnail [] = "getThumbnail"; +const char funName_getIconByIndex [] = "getIconByIndex"; +const char funName_releaseImageData[] = "releaseImageData"; /*--------------- |library names| |