1 /***************************************************************************/
5 /* FreeType Image cache (body). */
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 /*************************************************************************/
21 /* Each image cache really manages FT_Glyph objects. */
23 /*************************************************************************/
26 #ifndef __FTCIMAGE_H__
27 #define __FTCIMAGE_H__
32 #include FT_CACHE_INTERNAL_GLYPH_H
38 /*************************************************************************/
43 /*************************************************************************/
46 /*************************************************************************/
47 /*************************************************************************/
48 /*************************************************************************/
50 /***** IMAGE CACHE OBJECT *****/
52 /*************************************************************************/
53 /*************************************************************************/
54 /*************************************************************************/
57 #define FTC_IMAGE_FORMAT( x ) ( (x) & 7 )
60 #define ftc_image_format_bitmap 0
61 #define ftc_image_format_outline 1
63 #define ftc_image_flag_monochrome 16
64 #define ftc_image_flag_unhinted 32
65 #define ftc_image_flag_autohinted 64
66 #define ftc_image_flag_unscaled 128
67 #define ftc_image_flag_no_sbits 256
69 /* monochrome bitmap */
70 #define ftc_image_mono ftc_image_format_bitmap | \
71 ftc_image_flag_monochrome
72 /* anti-aliased bitmap */
73 #define ftc_image_grays ftc_image_format_bitmap
75 #define ftc_image_outline ftc_image_format_outline
78 /*************************************************************************/
84 /* A simple structure used to describe a given glyph image category. */
87 /* size :: An FTC_SizeRec used to describe the glyph's face & */
90 /* image_type :: The glyph image's type. */
92 typedef struct FTC_Image_Desc_
100 /*************************************************************************/
103 /* FTC_Image_Cache */
106 /* A handle to an glyph image cache object. They are designed to */
107 /* hold many distinct glyph images, while not exceeding a certain */
108 /* memory threshold. */
110 typedef struct FTC_Image_CacheRec_* FTC_Image_Cache;
113 /*************************************************************************/
116 /* FTC_Image_Cache_New */
119 /* Creates a new glyph image cache. */
122 /* manager :: The parent manager for the image cache. */
125 /* acache :: A handle to the new glyph image cache object. */
128 /* FreeType error code. 0 means success. */
130 FT_EXPORT( FT_Error )
131 FTC_Image_Cache_New( FTC_Manager manager,
132 FTC_Image_Cache *acache );
135 /*************************************************************************/
138 /* FTC_Image_Cache_Lookup */
141 /* Retrieves a given glyph image from a glyph image cache. */
144 /* cache :: A handle to the source glyph image cache. */
146 /* desc :: A pointer to a glyph image descriptor. */
148 /* gindex :: The glyph index to retrieve. */
151 /* aglyph :: The corresponding FT_Glyph object. 0 in case of */
155 /* FreeType error code. 0 means success. */
158 /* The returned glyph is owned and managed by the glyph image cache. */
159 /* Never try to transform or discard it manually! You can however */
160 /* create a copy with FT_Glyph_Copy() and modify the new one. */
162 /* Because the glyph image cache limits the total amount of memory */
163 /* taken by the glyphs it holds, the returned glyph might disappear */
164 /* on a later invocation of this function! It's a cache after all... */
166 FT_EXPORT( FT_Error )
167 FTC_Image_Cache_Lookup( FTC_Image_Cache cache,
168 FTC_Image_Desc* desc,
178 #endif /* __FTCIMAGE_H__ */