Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenftsystem.h
Go to the documentation of this file.
00001 /***************************************************************************/ 00002 /* */ 00003 /* ftsystem.h */ 00004 /* */ 00005 /* FreeType low-level system interface definition (specification). */ 00006 /* */ 00007 /* Copyright 1996-2001, 2002, 2005, 2010 by */ 00008 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 00009 /* */ 00010 /* This file is part of the FreeType project, and may only be used, */ 00011 /* modified, and distributed under the terms of the FreeType project */ 00012 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 00013 /* this file you indicate that you have read the license and */ 00014 /* understand and accept it fully. */ 00015 /* */ 00016 /***************************************************************************/ 00017 00018 00019 #ifndef __FTSYSTEM_H__ 00020 #define __FTSYSTEM_H__ 00021 00022 00023 #include <ft2build.h> 00024 00025 00026 FT_BEGIN_HEADER 00027 00028 00029 /*************************************************************************/ 00030 /* */ 00031 /* <Section> */ 00032 /* system_interface */ 00033 /* */ 00034 /* <Title> */ 00035 /* System Interface */ 00036 /* */ 00037 /* <Abstract> */ 00038 /* How FreeType manages memory and i/o. */ 00039 /* */ 00040 /* <Description> */ 00041 /* This section contains various definitions related to memory */ 00042 /* management and i/o access. You need to understand this */ 00043 /* information if you want to use a custom memory manager or you own */ 00044 /* i/o streams. */ 00045 /* */ 00046 /*************************************************************************/ 00047 00048 00049 /*************************************************************************/ 00050 /* */ 00051 /* M E M O R Y M A N A G E M E N T */ 00052 /* */ 00053 /*************************************************************************/ 00054 00055 00056 /************************************************************************* 00057 * 00058 * @type: 00059 * FT_Memory 00060 * 00061 * @description: 00062 * A handle to a given memory manager object, defined with an 00063 * @FT_MemoryRec structure. 00064 * 00065 */ 00066 typedef struct FT_MemoryRec_* FT_Memory; 00067 00068 00069 /************************************************************************* 00070 * 00071 * @functype: 00072 * FT_Alloc_Func 00073 * 00074 * @description: 00075 * A function used to allocate `size' bytes from `memory'. 00076 * 00077 * @input: 00078 * memory :: 00079 * A handle to the source memory manager. 00080 * 00081 * size :: 00082 * The size in bytes to allocate. 00083 * 00084 * @return: 00085 * Address of new memory block. 0~in case of failure. 00086 * 00087 */ 00088 typedef void* 00089 (*FT_Alloc_Func)( FT_Memory memory, 00090 long size ); 00091 00092 00093 /************************************************************************* 00094 * 00095 * @functype: 00096 * FT_Free_Func 00097 * 00098 * @description: 00099 * A function used to release a given block of memory. 00100 * 00101 * @input: 00102 * memory :: 00103 * A handle to the source memory manager. 00104 * 00105 * block :: 00106 * The address of the target memory block. 00107 * 00108 */ 00109 typedef void 00110 (*FT_Free_Func)( FT_Memory memory, 00111 void* block ); 00112 00113 00114 /************************************************************************* 00115 * 00116 * @functype: 00117 * FT_Realloc_Func 00118 * 00119 * @description: 00120 * A function used to re-allocate a given block of memory. 00121 * 00122 * @input: 00123 * memory :: 00124 * A handle to the source memory manager. 00125 * 00126 * cur_size :: 00127 * The block's current size in bytes. 00128 * 00129 * new_size :: 00130 * The block's requested new size. 00131 * 00132 * block :: 00133 * The block's current address. 00134 * 00135 * @return: 00136 * New block address. 0~in case of memory shortage. 00137 * 00138 * @note: 00139 * In case of error, the old block must still be available. 00140 * 00141 */ 00142 typedef void* 00143 (*FT_Realloc_Func)( FT_Memory memory, 00144 long cur_size, 00145 long new_size, 00146 void* block ); 00147 00148 00149 /************************************************************************* 00150 * 00151 * @struct: 00152 * FT_MemoryRec 00153 * 00154 * @description: 00155 * A structure used to describe a given memory manager to FreeType~2. 00156 * 00157 * @fields: 00158 * user :: 00159 * A generic typeless pointer for user data. 00160 * 00161 * alloc :: 00162 * A pointer type to an allocation function. 00163 * 00164 * free :: 00165 * A pointer type to an memory freeing function. 00166 * 00167 * realloc :: 00168 * A pointer type to a reallocation function. 00169 * 00170 */ 00171 struct FT_MemoryRec_ 00172 { 00173 void* user; 00174 FT_Alloc_Func alloc; 00175 FT_Free_Func free; 00176 FT_Realloc_Func realloc; 00177 }; 00178 00179 00180 /*************************************************************************/ 00181 /* */ 00182 /* I / O M A N A G E M E N T */ 00183 /* */ 00184 /*************************************************************************/ 00185 00186 00187 /************************************************************************* 00188 * 00189 * @type: 00190 * FT_Stream 00191 * 00192 * @description: 00193 * A handle to an input stream. 00194 * 00195 */ 00196 typedef struct FT_StreamRec_* FT_Stream; 00197 00198 00199 /************************************************************************* 00200 * 00201 * @struct: 00202 * FT_StreamDesc 00203 * 00204 * @description: 00205 * A union type used to store either a long or a pointer. This is used 00206 * to store a file descriptor or a `FILE*' in an input stream. 00207 * 00208 */ 00209 typedef union FT_StreamDesc_ 00210 { 00211 long value; 00212 void* pointer; 00213 00214 } FT_StreamDesc; 00215 00216 00217 /************************************************************************* 00218 * 00219 * @functype: 00220 * FT_Stream_IoFunc 00221 * 00222 * @description: 00223 * A function used to seek and read data from a given input stream. 00224 * 00225 * @input: 00226 * stream :: 00227 * A handle to the source stream. 00228 * 00229 * offset :: 00230 * The offset of read in stream (always from start). 00231 * 00232 * buffer :: 00233 * The address of the read buffer. 00234 * 00235 * count :: 00236 * The number of bytes to read from the stream. 00237 * 00238 * @return: 00239 * The number of bytes effectively read by the stream. 00240 * 00241 * @note: 00242 * This function might be called to perform a seek or skip operation 00243 * with a `count' of~0. A non-zero return value then indicates an 00244 * error. 00245 * 00246 */ 00247 typedef unsigned long 00248 (*FT_Stream_IoFunc)( FT_Stream stream, 00249 unsigned long offset, 00250 unsigned char* buffer, 00251 unsigned long count ); 00252 00253 00254 /************************************************************************* 00255 * 00256 * @functype: 00257 * FT_Stream_CloseFunc 00258 * 00259 * @description: 00260 * A function used to close a given input stream. 00261 * 00262 * @input: 00263 * stream :: 00264 * A handle to the target stream. 00265 * 00266 */ 00267 typedef void 00268 (*FT_Stream_CloseFunc)( FT_Stream stream ); 00269 00270 00271 /************************************************************************* 00272 * 00273 * @struct: 00274 * FT_StreamRec 00275 * 00276 * @description: 00277 * A structure used to describe an input stream. 00278 * 00279 * @input: 00280 * base :: 00281 * For memory-based streams, this is the address of the first stream 00282 * byte in memory. This field should always be set to NULL for 00283 * disk-based streams. 00284 * 00285 * size :: 00286 * The stream size in bytes. 00287 * 00288 * pos :: 00289 * The current position within the stream. 00290 * 00291 * descriptor :: 00292 * This field is a union that can hold an integer or a pointer. It is 00293 * used by stream implementations to store file descriptors or `FILE*' 00294 * pointers. 00295 * 00296 * pathname :: 00297 * This field is completely ignored by FreeType. However, it is often 00298 * useful during debugging to use it to store the stream's filename 00299 * (where available). 00300 * 00301 * read :: 00302 * The stream's input function. 00303 * 00304 * close :: 00305 * The stream's close function. 00306 * 00307 * memory :: 00308 * The memory manager to use to preload frames. This is set 00309 * internally by FreeType and shouldn't be touched by stream 00310 * implementations. 00311 * 00312 * cursor :: 00313 * This field is set and used internally by FreeType when parsing 00314 * frames. 00315 * 00316 * limit :: 00317 * This field is set and used internally by FreeType when parsing 00318 * frames. 00319 * 00320 */ 00321 typedef struct FT_StreamRec_ 00322 { 00323 unsigned char* base; 00324 unsigned long size; 00325 unsigned long pos; 00326 00327 FT_StreamDesc descriptor; 00328 FT_StreamDesc pathname; 00329 FT_Stream_IoFunc read; 00330 FT_Stream_CloseFunc close; 00331 00332 FT_Memory memory; 00333 unsigned char* cursor; 00334 unsigned char* limit; 00335 00336 } FT_StreamRec; 00337 00338 00339 /* */ 00340 00341 00342 FT_END_HEADER 00343 00344 #endif /* __FTSYSTEM_H__ */ 00345 00346 00347 /* END */ Generated on Sat May 26 2012 04:32:26 for ReactOS by
1.7.6.1
|