1 /***************************************************************************/
5 /* A small-bitmap cache (specification). */
7 /* Copyright 2000-2001 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_INTERNAL_CHUNK_H
26 #include FT_CACHE_IMAGE_H
32 /*************************************************************************/
37 /*************************************************************************/
40 /*************************************************************************/
46 /* A handle to a small bitmap descriptor. See the FTC_SBitRec */
47 /* structure for details. */
49 typedef struct FTC_SBitRec_* FTC_SBit;
52 /*************************************************************************/
58 /* A handle to a small bitmap cache. These are special cache objects */
59 /* used to store small glyph bitmaps (and anti-aliased pixmaps) in a */
60 /* much more efficient way than the traditional glyph image cache */
61 /* implemented by FTC_Image_Cache. */
63 typedef struct FTC_SBit_CacheRec_* FTC_SBit_Cache;
66 /*************************************************************************/
72 /* A very compact structure used to describe a small glyph bitmap. */
75 /* width :: The bitmap width in pixels. */
77 /* height :: The bitmap height in pixels. */
79 /* left :: The horizontal distance from the pen position to the */
80 /* left bitmap border (a.k.a. `left side bearing', or */
83 /* top :: The vertical distance from the pen position (on the */
84 /* baseline) to the upper bitmap border (a.k.a. `top side */
85 /* bearing'). The distance is positive for upwards */
88 /* format :: The format of the glyph bitmap (monochrome or gray). */
90 /* pitch :: The number of bytes per bitmap line. May be positive */
93 /* xadvance :: The horizontal advance width in pixels. */
95 /* yadvance :: The vertical advance height in pixels. */
97 /* buffer :: A pointer to the bitmap pixels. */
99 typedef struct FTC_SBitRec_
116 /*************************************************************************/
119 /* FTC_SBit_Cache_New */
122 /* Creates a new cache to store small glyph bitmaps. */
125 /* manager :: A handle to the source cache manager. */
128 /* acache :: A handle to the new sbit cache. NULL in case of error. */
131 /* FreeType error code. 0 means success. */
133 FT_EXPORT( FT_Error )
134 FTC_SBit_Cache_New( FTC_Manager manager,
135 FTC_SBit_Cache *acache );
138 /*************************************************************************/
141 /* FTC_SBit_Cache_Lookup */
144 /* Looks up a given small glyph bitmap in a given sbit cache. */
147 /* cache :: A handle to the source sbit cache. */
148 /* desc :: A pointer to the glyph image descriptor. */
149 /* gindex :: The glyph index. */
152 /* sbit :: A handle to a small bitmap descriptor. */
155 /* FreeType error code. 0 means success. */
158 /* The small bitmap descriptor and its bit buffer are owned by the */
159 /* cache and should never be freed by the application. They might */
160 /* as well disappear from memory on the next cache lookup, so don't */
161 /* treat them as persistent data. */
163 /* The descriptor's `buffer' field is set to 0 to indicate a missing */
166 FT_EXPORT( FT_Error )
167 FTC_SBit_Cache_Lookup( FTC_SBit_Cache cache,
168 FTC_Image_Desc* desc,
178 #endif /* __FTCSBITS_H__ */