1 /***************************************************************************/
5 /* Support for the FT_Outline type used to store glyph shapes of */
6 /* most scalable font formats (specification). */
8 /* Copyright 1996-2001 by */
9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
11 /* This file is part of the FreeType project, and may only be used, */
12 /* modified, and distributed under the terms of the FreeType project */
13 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
14 /* this file you indicate that you have read the license and */
15 /* understand and accept it fully. */
17 /***************************************************************************/
25 #include FT_FREETYPE_H
31 /*************************************************************************/
34 /* outline_processing */
37 /* Outline Processing */
40 /* Functions to create, transform, and render vectorial glyph images. */
43 /* This section contains routines used to create and destroy scalable */
44 /* glyph images known as `outlines'. These can also be measured, */
45 /* transformed, and converted into bitmaps and pixmaps. */
49 /* FT_Outline_Flags */
53 /* FT_Outline_Translate */
54 /* FT_Outline_Transform */
55 /* FT_Outline_Reverse */
57 /* FT_Outline_Get_CBox */
58 /* FT_Outline_Get_BBox */
60 /* FT_Outline_Get_Bitmap */
61 /* FT_Outline_Render */
63 /* FT_Outline_Decompose */
64 /* FT_Outline_Funcs */
65 /* FT_Outline_MoveTo_Func */
66 /* FT_Outline_LineTo_Func */
67 /* FT_Outline_ConicTo_Func */
68 /* FT_Outline_CubicTo_Func */
70 /*************************************************************************/
73 /*************************************************************************/
76 /* FT_Outline_Decompose */
79 /* Walks over an outline's structure to decompose it into individual */
80 /* segments and Bezier arcs. This function is also able to emit */
81 /* `move to' and `close to' operations to indicate the start and end */
82 /* of new contours in the outline. */
85 /* outline :: A pointer to the source target. */
87 /* interface :: A table of `emitters', i.e,. function pointers called */
88 /* during decomposition to indicate path operations. */
91 /* user :: A typeless pointer which is passed to each emitter */
92 /* during the decomposition. It can be used to store */
93 /* the state during the decomposition. */
96 /* FreeType error code. 0 means sucess. */
99 FT_Outline_Decompose( FT_Outline* outline,
100 const FT_Outline_Funcs* interface,
104 /*************************************************************************/
110 /* Creates a new outline of a given size. */
113 /* library :: A handle to the library object from where the */
114 /* outline is allocated. Note however that the new */
115 /* outline will NOT necessarily be FREED, when */
116 /* destroying the library, by FT_Done_FreeType(). */
118 /* numPoints :: The maximal number of points within the outline. */
120 /* numContours :: The maximal number of contours within the outline. */
123 /* anoutline :: A handle to the new outline. NULL in case of */
127 /* FreeType error code. 0 means success. */
130 /* The reason why this function takes a `library' parameter is simply */
131 /* to use the library's memory allocator. */
133 FT_EXPORT( FT_Error )
134 FT_Outline_New( FT_Library library,
137 FT_Outline *anoutline );
140 FT_EXPORT( FT_Error )
141 FT_Outline_New_Internal( FT_Memory memory,
144 FT_Outline *anoutline );
147 /*************************************************************************/
150 /* FT_Outline_Done */
153 /* Destroys an outline created with FT_Outline_New(). */
156 /* library :: A handle of the library object used to allocate the */
159 /* outline :: A pointer to the outline object to be discarded. */
162 /* FreeType error code. 0 means success. */
165 /* If the outline's `owner' field is not set, only the outline */
166 /* descriptor will be released. */
168 /* The reason why this function takes an `library' parameter is */
169 /* simply to use FT_Free(). */
171 FT_EXPORT( FT_Error )
172 FT_Outline_Done( FT_Library library,
173 FT_Outline* outline );
176 FT_EXPORT( FT_Error )
177 FT_Outline_Done_Internal( FT_Memory memory,
178 FT_Outline* outline );
181 /*************************************************************************/
184 /* FT_Outline_Get_CBox */
187 /* Returns an outline's `control box'. The control box encloses all */
188 /* the outline's points, including Bezier control points. Though it */
189 /* coincides with the exact bounding box for most glyphs, it can be */
190 /* slightly larger in some situations (like when rotating an outline */
191 /* which contains Bezier outside arcs). */
193 /* Computing the control box is very fast, while getting the bounding */
194 /* box can take much more time as it needs to walk over all segments */
195 /* and arcs in the outline. To get the latter, you can use the */
196 /* `ftbbox' component which is dedicated to this single task. */
199 /* outline :: A pointer to the source outline descriptor. */
202 /* acbox :: The outline's control box. */
205 FT_Outline_Get_CBox( FT_Outline* outline,
209 /*************************************************************************/
212 /* FT_Outline_Translate */
215 /* Applies a simple translation to the points of an outline. */
218 /* outline :: A pointer to the target outline descriptor. */
221 /* xOffset :: The horizontal offset. */
223 /* yOffset :: The vertical offset. */
226 FT_Outline_Translate( FT_Outline* outline,
231 /*************************************************************************/
234 /* FT_Outline_Copy */
237 /* Copies an outline into another one. Both objects must have the */
238 /* same sizes (number of points & number of contours) when this */
239 /* function is called. */
242 /* source :: A handle to the source outline. */
245 /* target :: A handle to the target outline. */
248 /* FreeType error code. 0 means success. */
250 FT_EXPORT( FT_Error )
251 FT_Outline_Copy( FT_Outline* source,
252 FT_Outline *target );
255 /*************************************************************************/
258 /* FT_Outline_Transform */
261 /* Applies a simple 2x2 matrix to all of an outline's points. Useful */
262 /* for applying rotations, slanting, flipping, etc. */
265 /* outline :: A pointer to the target outline descriptor. */
268 /* matrix :: A pointer to the transformation matrix. */
271 /* You can use FT_Outline_Translate() if you need to translate the */
272 /* outline's points. */
275 FT_Outline_Transform( FT_Outline* outline,
279 /*************************************************************************/
282 /* FT_Outline_Reverse */
285 /* Reverses the drawing direction of an outline. This is used to */
286 /* ensure consistent fill conventions for mirrored glyphs. */
289 /* outline :: A pointer to the target outline descriptor. */
292 /* This functions toggles the bit flag `ft_outline_reverse_fill' in */
293 /* the outline's `flags' field. */
295 /* It shouldn't be used by a normal client application, unless it */
296 /* knows what it is doing. */
299 FT_Outline_Reverse( FT_Outline* outline );
302 /*************************************************************************/
305 /* FT_Outline_Get_Bitmap */
308 /* Renders an outline within a bitmap. The outline's image is simply */
309 /* OR-ed to the target bitmap. */
312 /* library :: A handle to a FreeType library object. */
314 /* outline :: A pointer to the source outline descriptor. */
317 /* abitmap :: A pointer to the target bitmap descriptor. */
320 /* FreeType error code. 0 means success. */
323 /* This function does NOT CREATE the bitmap, it only renders an */
324 /* outline image within the one you pass to it! */
326 /* It will use the raster correponding to the default glyph format. */
328 FT_EXPORT( FT_Error )
329 FT_Outline_Get_Bitmap( FT_Library library,
331 FT_Bitmap *abitmap );
334 /*************************************************************************/
337 /* FT_Outline_Render */
340 /* Renders an outline within a bitmap using the current scan-convert. */
341 /* This functions uses an FT_Raster_Params structure as an argument, */
342 /* allowing advanced features like direct composition, translucency, */
346 /* library :: A handle to a FreeType library object. */
348 /* outline :: A pointer to the source outline descriptor. */
351 /* params :: A pointer to a FT_Raster_Params structure used to */
352 /* describe the rendering operation. */
355 /* FreeType error code. 0 means success. */
358 /* You should know what you are doing and how FT_Raster_Params works */
359 /* to use this function. */
361 /* The field `params.source' will be set to `outline' before the scan */
362 /* converter is called, which means that the value you give to it is */
363 /* actually ignored. */
365 FT_EXPORT( FT_Error )
366 FT_Outline_Render( FT_Library library,
368 FT_Raster_Params* params );
376 #endif /* __FTOUTLN_H__ */