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