The BIG graph update
[rrdtool.git] / libraries / freetype-2.0.5 / include / freetype / cache / ftcsbits.h
1 /***************************************************************************/
2 /*                                                                         */
3 /*  ftcsbits.h                                                             */
4 /*                                                                         */
5 /*    A small-bitmap cache (specification).                                */
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 #ifndef __FTCSBITS_H__
20 #define __FTCSBITS_H__
21
22
23 #include <ft2build.h>
24 #include FT_CACHE_H
25 #include FT_CACHE_INTERNAL_CHUNK_H
26 #include FT_CACHE_IMAGE_H
27
28
29 FT_BEGIN_HEADER
30
31
32   /*************************************************************************/
33   /*                                                                       */
34   /* <Section>                                                             */
35   /*    cache_subsystem                                                    */
36   /*                                                                       */
37   /*************************************************************************/
38
39
40   /*************************************************************************/
41   /*                                                                       */
42   /* <Type>                                                                */
43   /*    FTC_SBit                                                           */
44   /*                                                                       */
45   /* <Description>                                                         */
46   /*    A handle to a small bitmap descriptor.  See the FTC_SBitRec        */
47   /*    structure for details.                                             */
48   /*                                                                       */
49   typedef struct FTC_SBitRec_*  FTC_SBit;
50
51
52   /*************************************************************************/
53   /*                                                                       */
54   /* <Type>                                                                */
55   /*    FTC_SBit_Cache                                                     */
56   /*                                                                       */
57   /* <Description>                                                         */
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.                                    */
62   /*                                                                       */
63   typedef struct FTC_SBit_CacheRec_*  FTC_SBit_Cache;
64
65
66   /*************************************************************************/
67   /*                                                                       */
68   /* <Struct>                                                              */
69   /*    FTC_SBitRec                                                        */
70   /*                                                                       */
71   /* <Description>                                                         */
72   /*    A very compact structure used to describe a small glyph bitmap.    */
73   /*                                                                       */
74   /* <Fields>                                                              */
75   /*    width    :: The bitmap width in pixels.                            */
76   /*                                                                       */
77   /*    height   :: The bitmap height in pixels.                           */
78   /*                                                                       */
79   /*    left     :: The horizontal distance from the pen position to the   */
80   /*                left bitmap border (a.k.a. `left side bearing', or     */
81   /*                `lsb').                                                */
82   /*                                                                       */
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       */
86   /*                Y coordinates.                                         */
87   /*                                                                       */
88   /*    format   :: The format of the glyph bitmap (monochrome or gray).   */
89   /*                                                                       */
90   /*    pitch    :: The number of bytes per bitmap line.  May be positive  */
91   /*                or negative.                                           */
92   /*                                                                       */
93   /*    xadvance :: The horizontal advance width in pixels.                */
94   /*                                                                       */
95   /*    yadvance :: The vertical advance height in pixels.                 */
96   /*                                                                       */
97   /*    buffer   :: A pointer to the bitmap pixels.                        */
98   /*                                                                       */
99   typedef struct  FTC_SBitRec_
100   {
101     FT_Byte   width;
102     FT_Byte   height;
103     FT_Char   left;
104     FT_Char   top;
105
106     FT_Byte   format;
107     FT_Char   pitch;
108     FT_Char   xadvance;
109     FT_Char   yadvance;
110
111     FT_Byte*  buffer;
112
113   } FTC_SBitRec;
114
115
116   /*************************************************************************/
117   /*                                                                       */
118   /* <Function>                                                            */
119   /*    FTC_SBit_Cache_New                                                 */
120   /*                                                                       */
121   /* <Description>                                                         */
122   /*    Creates a new cache to store small glyph bitmaps.                  */
123   /*                                                                       */
124   /* <Input>                                                               */
125   /*    manager :: A handle to the source cache manager.                   */
126   /*                                                                       */
127   /* <Output>                                                              */
128   /*    acache  :: A handle to the new sbit cache.  NULL in case of error. */
129   /*                                                                       */
130   /* <Return>                                                              */
131   /*    FreeType error code.  0 means success.                             */
132   /*                                                                       */
133   FT_EXPORT( FT_Error )
134   FTC_SBit_Cache_New( FTC_Manager      manager,
135                       FTC_SBit_Cache  *acache );
136
137
138   /*************************************************************************/
139   /*                                                                       */
140   /* <Function>                                                            */
141   /*    FTC_SBit_Cache_Lookup                                              */
142   /*                                                                       */
143   /* <Description>                                                         */
144   /*    Looks up a given small glyph bitmap in a given sbit cache.         */
145   /*                                                                       */
146   /* <Input>                                                               */
147   /*    cache  :: A handle to the source sbit cache.                       */
148   /*    desc   :: A pointer to the glyph image descriptor.                 */
149   /*    gindex :: The glyph index.                                         */
150   /*                                                                       */
151   /* <Output>                                                              */
152   /*    sbit   :: A handle to a small bitmap descriptor.                   */
153   /*                                                                       */
154   /* <Return>                                                              */
155   /*    FreeType error code.  0 means success.                             */
156   /*                                                                       */
157   /* <Note>                                                                */
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.                                     */
162   /*                                                                       */
163   /*    The descriptor's `buffer' field is set to 0 to indicate a missing  */
164   /*    glyph bitmap.                                                      */
165   /*                                                                       */
166   FT_EXPORT( FT_Error )
167   FTC_SBit_Cache_Lookup( FTC_SBit_Cache   cache,
168                          FTC_Image_Desc*  desc,
169                          FT_UInt          gindex,
170                          FTC_SBit        *sbit );
171
172
173   /* */
174
175
176 FT_END_HEADER
177
178 #endif /* __FTCSBITS_H__ */
179
180
181 /* END */