1 /***************************************************************************/
5 /* Support for the FT_Outline type used to store glyph shapes of */
6 /* most scalable font formats (specification). */
8 /* Copyright 1996-2000 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 /***************************************************************************/
24 #include <freetype/freetype.h>
31 /*************************************************************************/
34 /* FT_Outline_Decompose */
37 /* Walks over an outline's structure to decompose it into individual */
38 /* segments and Bezier arcs. This function is also able to emit */
39 /* `move to' and `close to' operations to indicate the start and end */
40 /* of new contours in the outline. */
43 /* outline :: A pointer to the source target. */
45 /* interface :: A table of `emitters', i.e,. function pointers called */
46 /* during decomposition to indicate path operations. */
48 /* user :: A typeless pointer which is passed to each emitter */
49 /* during the decomposition. It can be used to store */
50 /* the state during the decomposition. */
53 /* FreeType error code. 0 means sucess. */
55 FT_EXPORT_DEF( FT_Error ) FT_Outline_Decompose(
57 FT_Outline_Funcs* interface,
61 /*************************************************************************/
67 /* Creates a new outline of a given size. */
70 /* library :: A handle to the library object from where the */
71 /* outline is allocated. Note however that the new */
72 /* outline will NOT necessarily be FREED, when */
73 /* destroying the library, by FT_Done_FreeType(). */
75 /* numPoints :: The maximal number of points within the outline. */
77 /* numContours :: The maximal number of contours within the outline. */
80 /* outline :: A handle to the new outline. NULL in case of */
84 /* FreeType error code. 0 means success. */
90 /* The reason why this function takes a `library' parameter is simply */
91 /* to use the library's memory allocator. */
93 FT_EXPORT_DEF( FT_Error ) FT_Outline_New( FT_Library library,
96 FT_Outline* outline );
99 FT_EXPORT_DEF( FT_Error ) FT_Outline_New_Internal(
103 FT_Outline* outline );
106 /*************************************************************************/
109 /* FT_Outline_Done */
112 /* Destroys an outline created with FT_Outline_New(). */
115 /* library :: A handle of the library object used to allocate the */
118 /* outline :: A pointer to the outline object to be discarded. */
121 /* FreeType error code. 0 means success. */
127 /* If the outline's `owner' field is not set, only the outline */
128 /* descriptor will be released. */
130 /* The reason why this function takes an `outline' parameter is */
131 /* simply to use FT_Free(). */
133 FT_EXPORT_DEF( FT_Error ) FT_Outline_Done( FT_Library library,
134 FT_Outline* outline );
137 FT_EXPORT_DEF( FT_Error ) FT_Outline_Done_Internal( FT_Memory memory,
138 FT_Outline* outline );
141 /*************************************************************************/
144 /* FT_Outline_Get_CBox */
147 /* Returns an outline's `control box'. The control box encloses all */
148 /* the outline's points, including Bezier control points. Though it */
149 /* coincides with the exact bounding box for most glyphs, it can be */
150 /* slightly larger in some situations (like when rotating an outline */
151 /* which contains Bezier outside arcs). */
153 /* Computing the control box is very fast, while getting the bounding */
154 /* box can take much more time as it needs to walk over all segments */
155 /* and arcs in the outline. To get the latter, you can use the */
156 /* `ftbbox' component which is dedicated to this single task. */
159 /* outline :: A pointer to the source outline descriptor. */
162 /* cbox :: The outline's control box. */
167 FT_EXPORT_DEF( void ) FT_Outline_Get_CBox( FT_Outline* outline,
171 /*************************************************************************/
174 /* FT_Outline_Translate */
177 /* Applies a simple translation to the points of an outline. */
180 /* outline :: A pointer to the target outline descriptor. */
182 /* xOffset :: The horizontal offset. */
184 /* yOffset :: The vertical offset. */
189 FT_EXPORT_DEF( void ) FT_Outline_Translate( FT_Outline* outline,
194 /*************************************************************************/
197 /* FT_Outline_Copy */
200 /* Copies an outline into another one. Both objects must have the */
201 /* same sizes (number of points & number of contours) when this */
202 /* function is called. */
205 /* source :: A handle to the source outline. */
208 /* target :: A handle to the target outline. */
211 /* FreeType error code. 0 means success. */
213 FT_EXPORT_DEF( FT_Error ) FT_Outline_Copy( FT_Outline* source,
214 FT_Outline* target );
217 /*************************************************************************/
220 /* FT_Vector_Transform */
223 /* Transforms a single vector through a 2x2 matrix. */
226 /* vector :: The target vector to transform. */
229 /* matrix :: A pointer to the source 2x2 matrix. */
235 /* The result is undefined if either `vector' or `matrix' is invalid. */
237 FT_EXPORT_DEF( void ) FT_Outline_Transform( FT_Outline* outline,
241 /*************************************************************************/
244 /* FT_Outline_Reverse */
247 /* Reverses the drawing direction of an outline. This is used to */
248 /* ensure consistent fill conventions for mirrored glyphs. */
251 /* outline :: A pointer to the target outline descriptor. */
254 /* This functions toggles the bit flag `ft_outline_reverse_fill' in */
255 /* the outline's `flags' field. */
257 /* It shouldn't be used by a normal client application, unless it */
258 /* knows what it is doing. */
260 FT_EXPORT_DEF( void ) FT_Outline_Reverse( FT_Outline* outline );
263 /*************************************************************************/
266 /* FT_Outline_Get_Bitmap */
269 /* Renders an outline within a bitmap. The outline's image is simply */
270 /* OR-ed to the target bitmap. */
273 /* library :: A handle to a FreeType library object. */
275 /* outline :: A pointer to the source outline descriptor. */
277 /* map :: A pointer to the target bitmap descriptor. */
280 /* FreeType error code. 0 means success. */
283 /* YES. Rendering is synchronized, so that concurrent calls to the */
284 /* scan-line converter will be serialized. */
287 /* This function does NOT CREATE the bitmap, it only renders an */
288 /* outline image within the one you pass to it! */
290 /* It will use the raster correponding to the default glyph format. */
292 FT_EXPORT_DEF( FT_Error ) FT_Outline_Get_Bitmap( FT_Library library,
297 /*************************************************************************/
300 /* FT_Outline_Render */
303 /* Renders an outline within a bitmap using the current scan-convert. */
304 /* This functions uses an FT_Raster_Params structure as an argument, */
305 /* allowing advanced features like direct composition, translucency, */
309 /* library :: A handle to a FreeType library object. */
311 /* outline :: A pointer to the source outline descriptor. */
313 /* params :: A pointer to a FT_Raster_Params structure used to */
314 /* describe the rendering operation. */
317 /* FreeType error code. 0 means success. */
320 /* YES. Rendering is synchronized, so that concurrent calls to the */
321 /* scan-line converter will be serialized. */
324 /* You should know what you are doing and how FT_Raster_Params works */
325 /* to use this function. */
327 /* The field `params.source' will be set to `outline' before the scan */
328 /* converter is called, which means that the value you give to it is */
329 /* actually ignored. */
331 FT_EXPORT_DEF( FT_Error ) FT_Outline_Render( FT_Library library,
333 FT_Raster_Params* params );
341 #endif /* FTOUTLN_H */