/***************************************************************************/ /* */ /* ftoutln.h */ /* */ /* Support for the FT_Outline type (used to store glyph shapes of */ /* most scalable font formats) */ /* */ /* Copyright 1996-2000 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ /* modified and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTOUTLN_H #define FTOUTLN_H /*************************************************************************/ /* */ /* */ /* FT_Outline_Decompose */ /* */ /* */ /* Walks over an outline's structure to decompose it into individual */ /* segments and Bezier arcs. This function is also able to emit */ /* `move to' and `close to' operations to indicate the start and end */ /* of new contours in the outline. */ /* */ /* */ /* outline :: A pointer to the source target. */ /* */ /* funcs :: A table of `emitters', i.e,. function pointers called */ /* during decomposition to indicate path operations. */ /* */ /* user :: A typeless pointer which is passed to each emitter */ /* during the decomposition. It can be used to store */ /* the state during the decomposition. */ /* */ /* */ /* FreeType error code. 0 means sucess. */ /* */ FT_EXPORT_DEF(FT_Error) FT_Outline_Decompose( FT_Outline* outline, FT_Outline_Funcs* funcs, void* user ); /*************************************************************************/ /* */ /* */ /* FT_Outline_New */ /* */ /* */ /* Creates a new outline of a given size. */ /* */ /* */ /* library :: A handle to the library object from where the */ /* outline is allocated. Note however that the new */ /* outline will NOT necessarily be FREED when */ /* destroying the library, by FT_Done_FreeType(). */ /* */ /* numPoints :: The maximal number of points within the outline. */ /* */ /* numContours :: The maximal number of contours within the outline. */ /* */ /* */ /* outline :: A handle to the new outline. NULL in case of */ /* error. */ /* */ /* */ /* FreeType error code. 0 means success. */ /* */ /* */ /* No. */ /* */ /* */ /* The reason why this function takes a `library' parameter is simply */ /* to use the library's memory allocator. You can copy the source */ /* code of this function, replacing allocations with `malloc()' if */ /* you want to control where the objects go. */ /* */ FT_EXPORT_DEF(FT_Error) FT_Outline_New( FT_Library library, FT_UInt numPoints, FT_Int numContours, FT_Outline* outline ); /*************************************************************************/ /* */ /* */ /* FT_Outline_Done */ /* */ /* */ /* Destroys an outline created with FT_Outline_New(). */ /* */ /* */ /* library :: A handle of the library object used to allocate the */ /* outline. */ /* */ /* outline :: A pointer to the outline object to be discarded. */ /* */ /* */ /* FreeType error code. 0 means success. */ /* */ /* */ /* No. */ /* */ /* */ /* If the outline's `owner' field is not set, only the outline */ /* descriptor will be released. */ /* */ /* The reason why this function takes an `outline' parameter is */ /* simply to use FT_Alloc()/FT_Free(). You can copy the source code */ /* of this function, replacing allocations with `malloc()' in your */ /* application if you want something simpler. */ /* */ FT_EXPORT_DEF(FT_Error) FT_Outline_Done( FT_Library library, FT_Outline* outline ); /*************************************************************************/ /* */ /* */ /* FT_Outline_Get_CBox */ /* */ /* */ /* Returns an outline's `control box'. The control box encloses all */ /* the outline's points, including Bezier control points. Though it */ /* coincides with the exact bounding box for most glyphs, it can be */ /* slightly larger in some situations (like when rotating an outline */ /* which contains Bezier outside arcs). */ /* */ /* Computing the control box is very fast, while getting the bounding */ /* box can take much more time as it needs to walk over all segments */ /* and arcs in the outline. To get the latter, you can use the */ /* `ftbbox' component which is dedicated to this single task. */ /* */ /* */ /* outline :: A pointer to the source outline descriptor. */ /* */ /* */ /* cbox :: The outline's control box. */ /* */ /* */ /* Yes. */ /* */ FT_EXPORT_DEF(void) FT_Outline_Get_CBox( FT_Outline* outline, FT_BBox* cbox ); /*************************************************************************/ /* */ /* */ /* FT_Outline_Translate */ /* */ /* */ /* Applies a simple translation to the points of an outline. */ /* */ /* */ /* outline :: A pointer to the target outline descriptor. */ /* xOffset :: The horizontal offset. */ /* yOffset :: The vertical offset. */ /* */ /* */ /* Yes. */ /* */ FT_EXPORT_DEF(void) FT_Outline_Translate( FT_Outline* outline, FT_Pos xOffset, FT_Pos yOffset ); /*************************************************************************/ /* */ /* */ /* FT_Outline_Copy */ /* */ /* */ /* Copies an outline into another one. Both objects must have the */ /* same sizes (number of points & number of contours) when this */ /* function is called. */ /* */ /* */ /* source :: A handle to the source outline. */ /* target :: A handle to the target outline. */ /* */ /* */ /* FreeType error code. 0 means success. */ /* */ FT_EXPORT_DEF(FT_Error) FT_Outline_Copy( FT_Outline* source, FT_Outline* target ); /*************************************************************************/ /* */ /* */ /* FT_Outline_Transform */ /* */ /* */ /* Applies a simple 2x2 matrix to all of an outline's points. Useful */ /* for applying rotations, slanting, flipping, etc. */ /* */ /* */ /* outline :: A pointer to the target outline descriptor. */ /* matrix :: A pointer to the transformation matrix. */ /* */ /* */ /* Yes. */ /* */ /* */ /* You can use FT_Outline_Translate() if you need to translate the */ /* outline's points. */ /* */ FT_EXPORT_DEF(void) FT_Outline_Transform( FT_Outline* outline, FT_Matrix* matrix ); /*************************************************************************/ /* */ /* */ /* FT_Outline_Reverse */ /* */ /* */ /* Reverse the drawing direction of an outline. This is used to */ /* ensure consistent fill conventions for mirrored glyphs.. */ /* */ /* */ /* outline :: A pointer to the target outline descriptor. */ /* */ /* */ /* This functions toggles the bit flag ft_outline_reverse_fill in */ /* the outline's "flags" field.. */ /* */ /* It shouldn't be used by a normal client application, unless it */ /* knows what it's doing.. */ /* */ FT_EXPORT_DEF(void) FT_Outline_Reverse( FT_Outline* outline ); /*************************************************************************/ /* */ /* */ /* FT_Outline_Get_Bitmap */ /* */ /* */ /* Renders an outline within a bitmap. The outline's image is simply */ /* or-ed to the target bitmap. */ /* */ /* */ /* */ /* library :: A handle to a FreeType library object. */ /* outline :: A pointer to the source outline descriptor. */ /* map :: A pointer to the target bitmap descriptor. */ /* */ /* */ /* FreeType error code. 0 means success. */ /* */ /* */ /* YES. Rendering is synchronized, so that concurrent calls to the */ /* scan-line converter will be serialized. */ /* */ /* */ /* This function does NOT CREATE the bitmap, it only renders an */ /* outline image within the one you pass to it! */ /* */ /* It will use the raster correponding to the default glyph format. */ /* */ FT_EXPORT_DEF(FT_Error) FT_Outline_Get_Bitmap( FT_Library library, FT_Outline* outline, FT_Bitmap* bitmap ); /*************************************************************************/ /* */ /* */ /* FT_Outline_Render */ /* */ /* */ /* Renders an outline within a bitmap using the current scan-convert */ /* This functions uses a FT_Raster_Params as argument, allowing */ /* advanced features like direct composition/translucency, etc.. */ /* */ /* */ /* library :: A handle to a FreeType library object. */ /* outline :: A pointer to the source outline descriptor. */ /* params :: A pointer to a FT_Raster_Params used to describe */ /* the rendering operation */ /* */ /* */ /* FreeType error code. 0 means success. */ /* */ /* */ /* YES. Rendering is synchronized, so that concurrent calls to the */ /* scan-line converter will be serialized. */ /* */ /* */ /* You should know what you're doing and the role of FT_Raster_Params */ /* to use this function. */ /* */ /* the field "params.source" will be set to "outline" before the */ /* scan converter is called, which means that the value you give it */ /* is actually ignored.. */ /* */ FT_EXPORT_DEF(FT_Error) FT_Outline_Render( FT_Library library, FT_Outline* outline, FT_Raster_Params* params ); #endif /* FTOUTLN_H */