ThumbsPlus - Plug-in API

 

 

A ThumbsPlus Plug-in is a DLL designed to expose a common interface for ThumbsPlus to use to load image file.data for file types that are not supported internally. It is a standard DLL (named with a .TPP file extension) with only two exported functions. These functions are defined as follows:

 

BOOL __declspec(dllexport) WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID resrvd)

BOOL __declspec(dllexport) WINAPI PI_PluginInfo(PPI_CONFIG ppc, PPI_PLUGINFO pinfo)

 

DllMain is the standard Windows DLL entry point function called when LoadLibrary and FreeLibrary .platform SDK calls are made.

 

PI_PluginInfo is the plug-in initialization function that ThumbsPlus calls to connect to the plug-in. The two parameters passed are:

PPI_CONFIG (a pointer to structure containing function pointers into ThumbsPlus) and PPI_PLUGINFO (a pointer to a structure containing the plug-in's information, loading and option function pointers as well as other necessary information about the file type and the plug-in version). These structures are defined in plugin.h.

 

Your Plug-in should save the PI_CONFIG structure pointer for use by it's loading and information routines. The PI_PLUGINFO structure should be filled in by assigning appropriate values to the pi_version, multipage, name, extensions and version attributes and by assigining the relevant routine addresses (in your plug-in) to the function pointers pGetInfo, pGetImage and pGetOptions. The pSaveImage, pSaveOptions function pointers and savetype attribute are reserved for future use.

 

Example 1:

 

BOOL __declspec(dllexport) WINAPI PI_PluginInfo(PPI_CONFIG ppc, PPI_PLUGINFO pinfo)

{

       pi_config = *ppc;

 

       pinfo->pi_version = PI_VERSION;

       pinfo->name = "My Custom File Type";

       pinfo->extensions = ".abc.xyz.";

       pinfo->version = "1.0.0.0";

       pinfo->multipage = FALSE;

       pinfo->pGetImage = MyGetImage;        // Plug-in's rountine to load the image and any other file info

       pinfo->pGetInfo = MyGetInfo;        // Plug-in's routine to report image info (type,dimensions, etc)

       pinfo->pGetOptions = MyOptions;        // Plug-in's routine to open a loading options dialog.

       MyReadOptions();        // Read any saved loading options

       return TRUE;

}

 

Your Plug-in's loading routine should use the malloc_image and malloc_comment function pointers to call ThumbsPlus functions to allocate image and other file information related data memory. During file loading, your plug-in should use the progress and abort function pointers to periodically report progress back to ThumbsPlus and to allow the ThumbsPlus user to abort the file load by pressing Escape, respectively. If an error is encountered, your plug-in should use the free_image and free_comment function pointers to free any allocated memory and return FALSE.

 

Click here to download plugin.h and sample source code for loading windows bitmap file format, including a project for building it in Microsoft Visual Studio.