The BIG graph update
[rrdtool.git] / libraries / freetype-2.0.5 / include / freetype / cache / ftcimage.h
1 /***************************************************************************/
2 /*                                                                         */
3 /*  ftcimage.h                                                             */
4 /*                                                                         */
5 /*    FreeType Image cache (body).                                         */
6 /*                                                                         */
7 /*  Copyright 2000-2001 by                                                 */
8 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
9 /*                                                                         */
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.                                        */
15 /*                                                                         */
16 /***************************************************************************/
17
18
19   /*************************************************************************/
20   /*                                                                       */
21   /* Each image cache really manages FT_Glyph objects.                     */
22   /*                                                                       */
23   /*************************************************************************/
24
25
26 #ifndef __FTCIMAGE_H__
27 #define __FTCIMAGE_H__
28
29
30 #include <ft2build.h>
31 #include FT_CACHE_H
32 #include FT_CACHE_INTERNAL_GLYPH_H
33
34
35 FT_BEGIN_HEADER
36
37
38   /*************************************************************************/
39   /*                                                                       */
40   /* <Section>                                                             */
41   /*    cache_subsystem                                                    */
42   /*                                                                       */
43   /*************************************************************************/
44
45
46   /*************************************************************************/
47   /*************************************************************************/
48   /*************************************************************************/
49   /*****                                                               *****/
50   /*****                       IMAGE CACHE OBJECT                      *****/
51   /*****                                                               *****/
52   /*************************************************************************/
53   /*************************************************************************/
54   /*************************************************************************/
55
56
57 #define FTC_IMAGE_FORMAT( x )  ( (x) & 7 )
58
59
60 #define ftc_image_format_bitmap      0
61 #define ftc_image_format_outline     1
62
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
68
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
74   /* scaled outline */
75 #define ftc_image_outline          ftc_image_format_outline
76
77
78   /*************************************************************************/
79   /*                                                                       */
80   /* <Struct>                                                              */
81   /*    FTC_Image_Desc                                                     */
82   /*                                                                       */
83   /* <Description>                                                         */
84   /*    A simple structure used to describe a given glyph image category.  */
85   /*                                                                       */
86   /* <Fields>                                                              */
87   /*    size       :: An FTC_SizeRec used to describe the glyph's face &   */
88   /*                  size.                                                */
89   /*                                                                       */
90   /*    image_type :: The glyph image's type.                              */
91   /*                                                                       */
92   typedef struct  FTC_Image_Desc_
93   {
94     FTC_FontRec  font;
95     FT_UInt      image_type;
96
97   } FTC_Image_Desc;
98
99
100   /*************************************************************************/
101   /*                                                                       */
102   /* <Type>                                                                */
103   /*    FTC_Image_Cache                                                    */
104   /*                                                                       */
105   /* <Description>                                                         */
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.                                                  */
109   /*                                                                       */
110   typedef struct FTC_Image_CacheRec_*  FTC_Image_Cache;
111
112
113   /*************************************************************************/
114   /*                                                                       */
115   /* <Function>                                                            */
116   /*    FTC_Image_Cache_New                                                */
117   /*                                                                       */
118   /* <Description>                                                         */
119   /*    Creates a new glyph image cache.                                   */
120   /*                                                                       */
121   /* <Input>                                                               */
122   /*    manager :: The parent manager for the image cache.                 */
123   /*                                                                       */
124   /* <Output>                                                              */
125   /*    acache  :: A handle to the new glyph image cache object.           */
126   /*                                                                       */
127   /* <Return>                                                              */
128   /*    FreeType error code.  0 means success.                             */
129   /*                                                                       */
130   FT_EXPORT( FT_Error )
131   FTC_Image_Cache_New( FTC_Manager       manager,
132                        FTC_Image_Cache  *acache );
133
134
135   /*************************************************************************/
136   /*                                                                       */
137   /* <Function>                                                            */
138   /*    FTC_Image_Cache_Lookup                                             */
139   /*                                                                       */
140   /* <Description>                                                         */
141   /*    Retrieves a given glyph image from a glyph image cache.            */
142   /*                                                                       */
143   /* <Input>                                                               */
144   /*    cache  :: A handle to the source glyph image cache.                */
145   /*                                                                       */
146   /*    desc   :: A pointer to a glyph image descriptor.                   */
147   /*                                                                       */
148   /*    gindex :: The glyph index to retrieve.                             */
149   /*                                                                       */
150   /* <Output>                                                              */
151   /*    aglyph :: The corresponding FT_Glyph object.  0 in case of         */
152   /*              failure.                                                 */
153   /*                                                                       */
154   /* <Return>                                                              */
155   /*    FreeType error code.  0 means success.                             */
156   /*                                                                       */
157   /* <Note>                                                                */
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.         */
161   /*                                                                       */
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... */
165   /*                                                                       */
166   FT_EXPORT( FT_Error )
167   FTC_Image_Cache_Lookup( FTC_Image_Cache  cache,
168                           FTC_Image_Desc*  desc,
169                           FT_UInt          gindex,
170                           FT_Glyph        *aglyph );
171
172
173   /* */
174
175
176 FT_END_HEADER
177
178 #endif /* __FTCIMAGE_H__ */
179
180
181 /* END */