1 /***************************************************************************/
5 /* A small-bitmap cache (specification). */
7 /* Copyright 2000-2001, 2002 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
10 /* This file is part of the FreeType project, and may only be used, */
11 /* modified, and distributed under the terms of the FreeType project */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */
16 /***************************************************************************/
19 #ifndef __FTCSBITS_H__
20 #define __FTCSBITS_H__
25 #include FT_CACHE_IMAGE_H
31 /*************************************************************************/
36 /*************************************************************************/
39 /*************************************************************************/
45 /* A handle to a small bitmap descriptor. See the @FTC_SBitRec */
46 /* structure for details. */
48 typedef struct FTC_SBitRec_* FTC_SBit;
51 /*************************************************************************/
57 /* A very compact structure used to describe a small glyph bitmap. */
60 /* width :: The bitmap width in pixels. */
62 /* height :: The bitmap height in pixels. */
64 /* left :: The horizontal distance from the pen position to the */
65 /* left bitmap border (a.k.a. `left side bearing', or */
68 /* top :: The vertical distance from the pen position (on the */
69 /* baseline) to the upper bitmap border (a.k.a. `top */
70 /* side bearing'). The distance is positive for upwards */
73 /* format :: The format of the glyph bitmap (monochrome or gray). */
75 /* max_grays :: Maximum gray level value (in the range 1 to 255). */
77 /* pitch :: The number of bytes per bitmap line. May be positive */
80 /* xadvance :: The horizontal advance width in pixels. */
82 /* yadvance :: The vertical advance height in pixels. */
84 /* buffer :: A pointer to the bitmap pixels. */
86 typedef struct FTC_SBitRec_
104 /*************************************************************************/
110 /* A handle to a small bitmap cache. These are special cache objects */
111 /* used to store small glyph bitmaps (and anti-aliased pixmaps) in a */
112 /* much more efficient way than the traditional glyph image cache */
113 /* implemented by @FTC_ImageCache. */
115 typedef struct FTC_SBitCacheRec_* FTC_SBitCache;
118 /*************************************************************************/
124 /* DEPRECATED. Use @FTC_SBitCache instead. */
126 typedef FTC_SBitCache FTC_SBit_Cache;
129 /*************************************************************************/
132 /* FTC_SBitCache_New */
135 /* Creates a new cache to store small glyph bitmaps. */
138 /* manager :: A handle to the source cache manager. */
141 /* acache :: A handle to the new sbit cache. NULL in case of error. */
144 /* FreeType error code. 0 means success. */
146 FT_EXPORT( FT_Error )
147 FTC_SBitCache_New( FTC_Manager manager,
148 FTC_SBitCache *acache );
151 /*************************************************************************/
154 /* FTC_SBitCache_Lookup */
157 /* Looks up a given small glyph bitmap in a given sbit cache and */
158 /* "lock" it to prevent its flushing from the cache until needed */
161 /* cache :: A handle to the source sbit cache. */
163 /* type :: A pointer to the glyph image type descriptor. */
165 /* gindex :: The glyph index. */
168 /* sbit :: A handle to a small bitmap descriptor. */
170 /* anode :: Used to return the address of of the corresponding cache */
171 /* node after incrementing its reference count (see note */
175 /* FreeType error code. 0 means success. */
178 /* The small bitmap descriptor and its bit buffer are owned by the */
179 /* cache and should never be freed by the application. They might */
180 /* as well disappear from memory on the next cache lookup, so don't */
181 /* treat them as persistent data. */
183 /* The descriptor's `buffer' field is set to 0 to indicate a missing */
186 /* If "anode" is _not_ NULL, it receives the address of the cache */
187 /* node containing the bitmap, after increasing its reference count. */
188 /* This ensures that the node (as well as the image) will always be */
189 /* kept in the cache until you call @FTC_Node_Unref to "release" it. */
191 /* If "anode" is NULL, the cache node is left unchanged, which means */
192 /* that the bitmap could be flushed out of the cache on the next */
193 /* call to one of the caching sub-system APIs. Don't assume that it */
196 FT_EXPORT( FT_Error )
197 FTC_SBitCache_Lookup( FTC_SBitCache cache,
207 /*************************************************************************/
210 /* FTC_SBit_Cache_New */
213 /* DEPRECATED. Use @FTC_SBitCache_New instead. */
215 /* Creates a new cache to store small glyph bitmaps. */
218 /* manager :: A handle to the source cache manager. */
221 /* acache :: A handle to the new sbit cache. NULL in case of error. */
224 /* FreeType error code. 0 means success. */
226 FT_EXPORT( FT_Error )
227 FTC_SBit_Cache_New( FTC_Manager manager,
228 FTC_SBit_Cache *acache );
231 /*************************************************************************/
234 /* FTC_SBit_Cache_Lookup */
237 /* DEPRECATED. Use @FTC_SBitCache_Lookup instead. */
239 /* Looks up a given small glyph bitmap in a given sbit cache. */
242 /* cache :: A handle to the source sbit cache. */
244 /* desc :: A pointer to the glyph image descriptor. */
246 /* gindex :: The glyph index. */
249 /* sbit :: A handle to a small bitmap descriptor. */
252 /* FreeType error code. 0 means success. */
255 /* The small bitmap descriptor and its bit buffer are owned by the */
256 /* cache and should never be freed by the application. They might */
257 /* as well disappear from memory on the next cache lookup, so don't */
258 /* treat them as persistent data. */
260 /* The descriptor's `buffer' field is set to 0 to indicate a missing */
263 FT_EXPORT( FT_Error )
264 FTC_SBit_Cache_Lookup( FTC_SBit_Cache cache,
265 FTC_Image_Desc* desc,
272 #endif /* __FTCSBITS_H__ */