This commit was manufactured by cvs2svn to create branch 'captive'.
[reactos.git] / include / freetype / ftrender.h
1 /***************************************************************************/
2 /*                                                                         */
3 /*  ftrender.h                                                             */
4 /*                                                                         */
5 /*    FreeType renderer modules public interface (specification).          */
6 /*                                                                         */
7 /*  Copyright 1996-2000 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 FTRENDER_H
20 #define FTRENDER_H
21
22 #include <freetype/ftmodule.h>
23 #include <freetype/ftglyph.h>
24
25
26 #ifdef __cplusplus
27   extern "C" {
28 #endif
29
30
31   /* create a new glyph object */
32   typedef FT_Error  (*FT_Glyph_Init_Func)( FT_Glyph      glyph,
33                                            FT_GlyphSlot  slot );
34
35   /* destroys a given glyph object */
36   typedef void  (*FT_Glyph_Done_Func)( FT_Glyph  glyph );
37
38   typedef void  (*FT_Glyph_Transform_Func)( FT_Glyph    glyph,
39                                             FT_Matrix*  matrix,
40                                             FT_Vector*  delta );
41
42   typedef void  (*FT_Glyph_BBox_Func)( FT_Glyph  glyph,
43                                        FT_BBox*  abbox );
44
45   typedef FT_Error  (*FT_Glyph_Copy_Func)( FT_Glyph   source,
46                                            FT_Glyph   target );
47
48   typedef FT_Error  (*FT_Glyph_Prepare_Func)( FT_Glyph      glyph,
49                                               FT_GlyphSlot  slot );
50
51   struct  FT_Glyph_Class_
52   {
53     FT_UInt                  glyph_size;
54     FT_Glyph_Format          glyph_format;
55     FT_Glyph_Init_Func       glyph_init;
56     FT_Glyph_Done_Func       glyph_done;
57     FT_Glyph_Copy_Func       glyph_copy;
58     FT_Glyph_Transform_Func  glyph_transform;
59     FT_Glyph_BBox_Func       glyph_bbox;
60     FT_Glyph_Prepare_Func    glyph_prepare;
61   };
62
63
64   typedef FT_Error  (*FTRenderer_render)( FT_Renderer   renderer,
65                                           FT_GlyphSlot  slot,
66                                           FT_UInt       mode,
67                                           FT_Vector*    origin );
68
69   typedef FT_Error  (*FTRenderer_transform)( FT_Renderer   renderer,
70                                              FT_GlyphSlot  slot,
71                                              FT_Matrix*    matrix,
72                                              FT_Vector*    delta );
73
74   typedef void  (*FTRenderer_getCBox)( FT_Renderer   renderer,
75                                        FT_GlyphSlot  slot,
76                                        FT_BBox*      cbox );
77
78   typedef FT_Error  (*FTRenderer_setMode)( FT_Renderer  renderer,
79                                            FT_ULong     mode_tag,
80                                            FT_Pointer   mode_ptr );
81
82
83   /*************************************************************************/
84   /*                                                                       */
85   /* <Struct>                                                              */
86   /*    FT_Renderer_Class                                                  */
87   /*                                                                       */
88   /* <Description>                                                         */
89   /*    The renderer module class descriptor.                              */
90   /*                                                                       */
91   /* <Fields>                                                              */
92   /*    root         :: The root FT_Module_Class fields.                   */
93   /*                                                                       */
94   /*    glyph_format :: The glyph image format this renderer handles.      */
95   /*                                                                       */
96   /*    render_glyph :: A method used to render the image that is in a     */
97   /*                    given glyph slot into a bitmap.                    */
98   /*                                                                       */
99   /*    set_mode     :: A method used to pass additional parameters.       */
100   /*                                                                       */
101   /*    raster_class :: For `ft_glyph_format_outline' renderers only, this */
102   /*                    is a pointer to its raster's class.                */
103   /*                                                                       */
104   /*    raster       :: For `ft_glyph_format_outline' renderers only. this */
105   /*                    is a pointer to the corresponding raster object,   */
106   /*                    if any.                                            */
107   /*                                                                       */
108   typedef struct  FT_Renderer_Class_
109   {
110     FT_Module_Class       root;
111
112     FT_Glyph_Format       glyph_format;
113
114     FTRenderer_render     render_glyph;
115     FTRenderer_transform  transform_glyph;
116     FTRenderer_getCBox    get_glyph_cbox;
117     FTRenderer_setMode    set_mode;
118
119     FT_Raster_Funcs*      raster_class;
120
121   } FT_Renderer_Class;
122
123
124   /*************************************************************************/
125   /*                                                                       */
126   /* <Function>                                                            */
127   /*    FT_Get_Renderer                                                    */
128   /*                                                                       */
129   /* <Description>                                                         */
130   /*    Retrieves the current renderer for a given glyph format.           */
131   /*                                                                       */
132   /* <Input>                                                               */
133   /*    library :: A handle to the library object.                         */
134   /*                                                                       */
135   /*    format  :: The glyph format.                                       */
136   /*                                                                       */
137   /* <Return>                                                              */
138   /*    A renderer handle.  0 if none found.                               */
139   /*                                                                       */
140   /* <Note>                                                                */
141   /*    An error will be returned if a module already exists by that name, */
142   /*    or if the module requires a version of FreeType that is too great. */
143   /*                                                                       */
144   /*    To add a new renderer, simply use FT_Add_Module().  To retrieve a  */
145   /*    renderer by its name, use FT_Get_Module().                         */
146   /*                                                                       */
147   FT_EXPORT_DEF( FT_Renderer )  FT_Get_Renderer( FT_Library       library,
148                                                  FT_Glyph_Format  format );
149
150
151   /*************************************************************************/
152   /*                                                                       */
153   /* <Function>                                                            */
154   /*    FT_Set_Renderer                                                    */
155   /*                                                                       */
156   /* <Description>                                                         */
157   /*    Sets the current renderer to use, and set additional mode.         */
158   /*                                                                       */
159   /* <Input>                                                               */
160   /*    library    :: A handle to the library object.                      */
161   /*                                                                       */
162   /*    renderer   :: A handle to the renderer object.                     */
163   /*                                                                       */
164   /*    num_params :: The number of additional parameters.                 */
165   /*                                                                       */
166   /*    parameters :: Additional parameters.                               */
167   /*                                                                       */
168   /* <Return>                                                              */
169   /*    FreeType error code.  0 means success.                             */
170   /*                                                                       */
171   /* <Note>                                                                */
172   /*    In case of success, the renderer will be used to convert glyph     */
173   /*    images in the renderer's known format into bitmaps.                */
174   /*                                                                       */
175   /*    This doesn't change the current renderer for other formats.        */
176   /*                                                                       */
177   FT_EXPORT_DEF(FT_Error) FT_Set_Renderer( FT_Library     library,
178                                            FT_Renderer    renderer,
179                                            FT_UInt        num_params,
180                                            FT_Parameter*  parameters );
181
182
183 #ifdef __cplusplus
184   }
185 #endif
186
187
188 #endif /* FTRENDER_H */
189
190
191 /* END */