PageRenderTime 25ms CodeModel.GetById 16ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/src/FreeImage/Source/Plugin.h

https://bitbucket.org/cabalistic/ogredeps/
C++ Header | 142 lines | 72 code | 22 blank | 48 comment | 0 complexity | e05eb02a18c171912e9ffad1e1e61d0a MD5 | raw file
  1// ==========================================================
  2// FreeImage Plugin Interface
  3//
  4// Design and implementation by
  5// - Floris van den Berg (flvdberg@wxs.nl)
  6// - Rui Lopes (ruiglopes@yahoo.com)
  7//
  8// This file is part of FreeImage 3
  9//
 10// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
 11// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
 12// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
 13// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
 14// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
 15// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
 16// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
 17// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
 18// THIS DISCLAIMER.
 19//
 20// Use at your own risk!
 21// ==========================================================
 22
 23#ifdef _MSC_VER 
 24#pragma warning (disable : 4786) // identifier was truncated to 'number' characters
 25#endif 
 26
 27#ifndef PLUGIN_H
 28#define PLUGIN_H
 29
 30#include "FreeImage.h"
 31#include "Utilities.h"
 32
 33// ==========================================================
 34
 35struct Plugin;
 36
 37// =====================================================================
 38//  Plugin Node
 39// =====================================================================
 40
 41FI_STRUCT (PluginNode) {
 42	/** FREE_IMAGE_FORMAT attached to this plugin */
 43	int m_id;
 44	/** Handle to a user plugin DLL (NULL for standard plugins) */
 45	void *m_instance;
 46	/** The actual plugin, holding the function pointers */
 47	Plugin *m_plugin;
 48	/** Enable/Disable switch */
 49	BOOL m_enabled;
 50
 51	/** Unique format string for the plugin */
 52	const char *m_format;
 53	/** Description string for the plugin */
 54	const char *m_description;
 55	/** Comma separated list of file extensions indicating what files this plugin can open */
 56	const char *m_extension;
 57	/** optional regular expression to help	software identifying a bitmap type */
 58	const char *m_regexpr;
 59};
 60
 61// =====================================================================
 62//  Internal Plugin List
 63// =====================================================================
 64
 65class PluginList {
 66public :
 67	PluginList();
 68	~PluginList();
 69
 70	FREE_IMAGE_FORMAT AddNode(FI_InitProc proc, void *instance = NULL, const char *format = 0, const char *description = 0, const char *extension = 0, const char *regexpr = 0);
 71	PluginNode *FindNodeFromFormat(const char *format);
 72	PluginNode *FindNodeFromMime(const char *mime);
 73	PluginNode *FindNodeFromFIF(int node_id);
 74
 75	int Size() const;
 76	BOOL IsEmpty() const;
 77
 78private :
 79	std::map<int, PluginNode *> m_plugin_map;
 80	int m_node_count;
 81};
 82
 83// ==========================================================
 84//   Plugin Initialisation Callback
 85// ==========================================================
 86
 87void DLL_CALLCONV FreeImage_OutputMessage(int fif, const char *message, ...);
 88
 89// =====================================================================
 90// Reimplementation of stricmp (it is not supported on some systems)
 91// =====================================================================
 92
 93int FreeImage_stricmp(const char *s1, const char *s2);
 94
 95// ==========================================================
 96//   Internal functions
 97// ==========================================================
 98
 99extern "C" {
100	BOOL DLL_CALLCONV FreeImage_Validate(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle);
101    void * DLL_CALLCONV FreeImage_Open(PluginNode *node, FreeImageIO *io, fi_handle handle, BOOL open_for_reading);
102    void DLL_CALLCONV FreeImage_Close(PluginNode *node, FreeImageIO *io, fi_handle handle, void *data); // plugin.cpp
103    PluginList * DLL_CALLCONV FreeImage_GetPluginList(); // plugin.cpp
104}
105
106// ==========================================================
107//   Internal plugins
108// ==========================================================
109
110void DLL_CALLCONV InitBMP(Plugin *plugin, int format_id);
111void DLL_CALLCONV InitCUT(Plugin *plugin, int format_id);
112void DLL_CALLCONV InitICO(Plugin *plugin, int format_id);
113void DLL_CALLCONV InitIFF(Plugin *plugin, int format_id);
114void DLL_CALLCONV InitJPEG(Plugin *plugin, int format_id);
115void DLL_CALLCONV InitKOALA(Plugin *plugin, int format_id);
116void DLL_CALLCONV InitLBM(Plugin *plugin, int format_id);
117void DLL_CALLCONV InitMNG(Plugin *plugin, int format_id);
118void DLL_CALLCONV InitPCD(Plugin *plugin, int format_id);
119void DLL_CALLCONV InitPCX(Plugin *plugin, int format_id);
120void DLL_CALLCONV InitPNG(Plugin *plugin, int format_id);
121void DLL_CALLCONV InitPNM(Plugin *plugin, int format_id);
122void DLL_CALLCONV InitPSD(Plugin *plugin, int format_id);
123void DLL_CALLCONV InitRAS(Plugin *plugin, int format_id);
124void DLL_CALLCONV InitTARGA(Plugin *plugin, int format_id);
125void DLL_CALLCONV InitTIFF(Plugin *plugin, int format_id);
126void DLL_CALLCONV InitWBMP(Plugin *plugin, int format_id);
127void DLL_CALLCONV InitXBM(Plugin *plugin, int format_id);
128void DLL_CALLCONV InitXPM(Plugin *plugin, int format_id);
129void DLL_CALLCONV InitDDS(Plugin *plugin, int format_id);
130void DLL_CALLCONV InitGIF(Plugin *plugin, int format_id);
131void DLL_CALLCONV InitHDR(Plugin *plugin, int format_id);
132void DLL_CALLCONV InitG3(Plugin *plugin, int format_id);
133void DLL_CALLCONV InitSGI(Plugin *plugin, int format_id);
134void DLL_CALLCONV InitEXR(Plugin *plugin, int format_id);
135void DLL_CALLCONV InitJ2K(Plugin *plugin, int format_id);
136void DLL_CALLCONV InitJP2(Plugin *plugin, int format_id);
137void DLL_CALLCONV InitPFM(Plugin *plugin, int format_id);
138void DLL_CALLCONV InitPICT(Plugin *plugin, int format_id);
139void DLL_CALLCONV InitRAW(Plugin *plugin, int format_id);
140void DLL_CALLCONV InitJNG(Plugin *plugin, int format_id);
141
142#endif //!PLUGIN_H