Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
Delegates.cs
Go to the documentation of this file.
1 // ==========================================================
2 // FreeImage 3 .NET wrapper
3 // Original FreeImage 3 functions and .NET compatible derived functions
4 //
5 // Design and implementation by
6 // - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net)
7 // - Carsten Klein (cklein05@users.sourceforge.net)
8 //
9 // Contributors:
10 // - David Boland (davidboland@vodafone.ie)
11 //
12 // Main reference : MSDN Knowlede Base
13 //
14 // This file is part of FreeImage 3
15 //
16 // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
17 // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
18 // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
19 // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
20 // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
21 // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
22 // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
23 // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
24 // THIS DISCLAIMER.
25 //
26 // Use at your own risk!
27 // ==========================================================
28 
29 // ==========================================================
30 // CVS
31 // $Revision: 1.4 $
32 // $Date: 2009/09/15 11:39:10 $
33 // $Id: Delegates.cs,v 1.4 2009/09/15 11:39:10 cklein05 Exp $
34 // ==========================================================
35 
36 using System;
37 using System.IO;
38 using System.Runtime.InteropServices;
39 using FreeImageAPI.IO;
40 
41 namespace FreeImageAPI
42 {
43  // Delegates used by the FreeImageIO structure
44 
45  /// <summary>
46  /// Delegate for capturing FreeImage error messages.
47  /// </summary>
48  /// <param name="fif">The format of the image.</param>
49  /// <param name="message">The errormessage.</param>
50  // DLL_API is missing in the definition of the callbackfuntion.
51  [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi, ThrowOnUnmappableChar = false)]
52  public delegate void OutputMessageFunction(FREE_IMAGE_FORMAT fif, string message);
53 }
54 
55 namespace FreeImageAPI.IO
56 {
57  /// <summary>
58  /// Delegate to the C++ function <b>fread</b>.
59  /// </summary>
60  /// <param name="buffer">Pointer to read from.</param>
61  /// <param name="size">Item size in bytes.</param>
62  /// <param name="count">Maximum number of items to be read.</param>
63  /// <param name="handle">Handle/stream to read from.</param>
64  /// <returns>Number of full items actually read,
65  /// which may be less than count if an error occurs or
66  /// if the end of the file is encountered before reaching count.</returns>
67  public delegate uint ReadProc(IntPtr buffer, uint size, uint count, fi_handle handle);
68 
69  /// <summary>
70  /// Delegate to the C++ function <b>fwrite</b>.
71  /// </summary>
72  /// <param name="buffer">Pointer to data to be written.</param>
73  /// <param name="size">Item size in bytes.</param>
74  /// <param name="count">Maximum number of items to be written.</param>
75  /// <param name="handle">Handle/stream to write to.</param>
76  /// <returns>Number of full items actually written,
77  /// which may be less than count if an error occurs.
78  /// Also, if an error occurs, the file-position indicator cannot be determined.</returns>
79  public delegate uint WriteProc(IntPtr buffer, uint size, uint count, fi_handle handle);
80 
81  /// <summary>
82  /// Delegate to the C++ function <b>fseek</b>.
83  /// </summary>
84  /// <param name="handle">Handle/stream to seek in.</param>
85  /// <param name="offset">Number of bytes from origin.</param>
86  /// <param name="origin">Initial position.</param>
87  /// <returns>If successful 0 is returned; otherwise a nonzero value. </returns>
88  public delegate int SeekProc(fi_handle handle, int offset, SeekOrigin origin);
89 
90  /// <summary>
91  /// Delegate to the C++ function <b>ftell</b>.
92  /// </summary>
93  /// <param name="handle">Handle/stream to retrieve its currents position from.</param>
94  /// <returns>The current position.</returns>
95  public delegate int TellProc(fi_handle handle);
96 
97  // Delegates used by 'Plugin' structure
98 }
99 
100 namespace FreeImageAPI.Plugins
101 {
102  /// <summary>
103  /// Delegate to a function that returns a string which describes
104  /// the plugins format.
105  /// </summary>
106  public delegate string FormatProc();
107 
108  /// <summary>
109  /// Delegate to a function that returns a string which contains
110  /// a more detailed description.
111  /// </summary>
112  public delegate string DescriptionProc();
113 
114  /// <summary>
115  /// Delegate to a function that returns a comma seperated list
116  /// of file extensions the plugin can read or write.
117  /// </summary>
118  public delegate string ExtensionListProc();
119 
120  /// <summary>
121  /// Delegate to a function that returns a regular expression that
122  /// can be used to idientify whether a file can be handled by the plugin.
123  /// </summary>
124  public delegate string RegExprProc();
125 
126  /// <summary>
127  /// Delegate to a function that opens a file.
128  /// </summary>
129  public delegate IntPtr OpenProc(ref FreeImageIO io, fi_handle handle, bool read);
130 
131  /// <summary>
132  /// Delegate to a function that closes a previosly opened file.
133  /// </summary>
134  public delegate void CloseProc(ref FreeImageIO io, fi_handle handle, IntPtr data);
135 
136  /// <summary>
137  /// Delegate to a function that returns the number of pages of a multipage
138  /// bitmap if the plugin is capable of handling multipage bitmaps.
139  /// </summary>
140  public delegate int PageCountProc(ref FreeImageIO io, fi_handle handle, IntPtr data);
141 
142  /// <summary>
143  /// UNKNOWN
144  /// </summary>
145  public delegate int PageCapabilityProc(ref FreeImageIO io, fi_handle handle, IntPtr data);
146 
147  /// <summary>
148  /// Delegate to a function that loads and decodes a bitmap into memory.
149  /// </summary>
150  public delegate FIBITMAP LoadProc(ref FreeImageIO io, fi_handle handle, int page, int flags, IntPtr data);
151 
152  /// <summary>
153  /// Delegate to a function that saves a bitmap.
154  /// </summary>
155  public delegate bool SaveProc(ref FreeImageIO io, FIBITMAP dib, fi_handle handle, int page, int flags, IntPtr data);
156 
157  /// <summary>
158  /// Delegate to a function that determines whether the source defined
159  /// by <param name="io"/> and <param name="handle"/> is a valid image.
160  /// </summary>
161  public delegate bool ValidateProc(ref FreeImageIO io, fi_handle handle);
162 
163  /// <summary>
164  /// Delegate to a function that returns a string which contains
165  /// the plugin's mime type.
166  /// </summary>
167  public delegate string MimeProc();
168 
169  /// <summary>
170  /// Delegate to a function that returns whether the plugin can handle the
171  /// specified color depth.
172  /// </summary>
173  public delegate bool SupportsExportBPPProc(int bpp);
174 
175  /// <summary>
176  /// Delegate to a function that returns whether the plugin can handle the
177  /// specified image type.
178  /// </summary>
179  public delegate bool SupportsExportTypeProc(FREE_IMAGE_TYPE type);
180 
181  /// <summary>
182  /// Delegate to a function that returns whether the plugin can handle
183  /// ICC-Profiles.
184  /// </summary>
185  public delegate bool SupportsICCProfilesProc();
186 
187  /// <summary>
188  /// Callback function used by FreeImage to register plugins.
189  /// </summary>
190  public delegate void InitProc(ref Plugin plugin, int format_id);
191 }
delegate int PageCapabilityProc(ref FreeImageIO io, fi_handle handle, IntPtr data)
UNKNOWN
delegate FIBITMAP LoadProc(ref FreeImageIO io, fi_handle handle, int page, int flags, IntPtr data)
Delegate to a function that loads and decodes a bitmap into memory.
Structure for implementing access to custom handles.
Definition: FreeImageIO.cs:44
delegate void InitProc(ref Plugin plugin, int format_id)
Callback function used by FreeImage to register plugins.
_In_ size_t _In_ DXGI_FORMAT _In_ size_t _In_ DXGI_FORMAT _In_ DWORD flags
Definition: DirectXTexP.h:170
delegate string ExtensionListProc()
Delegate to a function that returns a comma seperated list of file extensions the plugin can read or ...
delegate uint ReadProc(IntPtr buffer, uint size, uint count, fi_handle handle)
Delegate to the C++ function fread.
delegate string MimeProc()
Delegate to a function that returns a string which contains the plugin's mime type.
delegate int SeekProc(fi_handle handle, int offset, SeekOrigin origin)
Delegate to the C++ function fseek.
delegate string RegExprProc()
Delegate to a function that returns a regular expression that can be used to idientify whether a file...
delegate void OutputMessageFunction(FREE_IMAGE_FORMAT fif, string message)
Delegate for capturing FreeImage error messages.
delegate bool SupportsExportTypeProc(FREE_IMAGE_TYPE type)
Delegate to a function that returns whether the plugin can handle the specified image type...
delegate bool SupportsExportBPPProc(int bpp)
Delegate to a function that returns whether the plugin can handle the specified color depth...
_In_ size_t count
Definition: DirectXTexP.h:174
delegate int TellProc(fi_handle handle)
Delegate to the C++ function ftell.
delegate string FormatProc()
Delegate to a function that returns a string which describes the plugins format.
delegate int PageCountProc(ref FreeImageIO io, fi_handle handle, IntPtr data)
Delegate to a function that returns the number of pages of a multipage bitmap if the plugin is capabl...
delegate IntPtr OpenProc(ref FreeImageIO io, fi_handle handle, bool read)
Delegate to a function that opens a file.
delegate bool SupportsICCProfilesProc()
Delegate to a function that returns whether the plugin can handle ICC-Profiles.
delegate uint WriteProc(IntPtr buffer, uint size, uint count, fi_handle handle)
Delegate to the C++ function fwrite.
delegate bool SaveProc(ref FreeImageIO io, FIBITMAP dib, fi_handle handle, int page, int flags, IntPtr data)
Delegate to a function that saves a bitmap.
Wrapper for a custom handle.
Definition: fi_handle.cs:83
delegate bool ValidateProc(ref FreeImageIO io, fi_handle handle)
Delegate to a function that determines whether the source defined by and is a valid image...
FREE_IMAGE_TYPE
Image types used in FreeImage.
FREE_IMAGE_FORMAT
I/O image format identifiers.
_In_ size_t _In_ size_t size
Definition: DirectXTexP.h:175
delegate string DescriptionProc()
Delegate to a function that returns a string which contains a more detailed description.
delegate void CloseProc(ref FreeImageIO io, fi_handle handle, IntPtr data)
Delegate to a function that closes a previosly opened file.