ftimage.h

Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  ftimage.h                                                              */
00004 /*                                                                         */
00005 /*    FreeType glyph image formats and default raster interface            */
00006 /*    (specification).                                                     */
00007 /*                                                                         */
00008 /*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,   */
00009 /*            2010 by                                                      */
00010 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
00011 /*                                                                         */
00012 /*  This file is part of the FreeType project, and may only be used,       */
00013 /*  modified, and distributed under the terms of the FreeType project      */
00014 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
00015 /*  this file you indicate that you have read the license and              */
00016 /*  understand and accept it fully.                                        */
00017 /*                                                                         */
00018 /***************************************************************************/
00019 
00020   /*************************************************************************/
00021   /*                                                                       */
00022   /* Note: A `raster' is simply a scan-line converter, used to render      */
00023   /*       FT_Outlines into FT_Bitmaps.                                    */
00024   /*                                                                       */
00025   /*************************************************************************/
00026 
00027 
00028 #ifndef __FTIMAGE_H__
00029 #define __FTIMAGE_H__
00030 
00031 
00032   /* _STANDALONE_ is from ftgrays.c */
00033 #ifndef _STANDALONE_
00034 #include <ft2build.h>
00035 #endif
00036 
00037 
00038 FT_BEGIN_HEADER
00039 
00040 
00041   /*************************************************************************/
00042   /*                                                                       */
00043   /* <Section>                                                             */
00044   /*    basic_types                                                        */
00045   /*                                                                       */
00046   /*************************************************************************/
00047 
00048 
00049   /*************************************************************************/
00050   /*                                                                       */
00051   /* <Type>                                                                */
00052   /*    FT_Pos                                                             */
00053   /*                                                                       */
00054   /* <Description>                                                         */
00055   /*    The type FT_Pos is used to store vectorial coordinates.  Depending */
00056   /*    on the context, these can represent distances in integer font      */
00057   /*    units, or 16.16, or 26.6 fixed float pixel coordinates.            */
00058   /*                                                                       */
00059   typedef signed long  FT_Pos;
00060 
00061 
00062   /*************************************************************************/
00063   /*                                                                       */
00064   /* <Struct>                                                              */
00065   /*    FT_Vector                                                          */
00066   /*                                                                       */
00067   /* <Description>                                                         */
00068   /*    A simple structure used to store a 2D vector; coordinates are of   */
00069   /*    the FT_Pos type.                                                   */
00070   /*                                                                       */
00071   /* <Fields>                                                              */
00072   /*    x :: The horizontal coordinate.                                    */
00073   /*    y :: The vertical coordinate.                                      */
00074   /*                                                                       */
00075   typedef struct  FT_Vector_
00076   {
00077     FT_Pos  x;
00078     FT_Pos  y;
00079 
00080   } FT_Vector;
00081 
00082 
00083   /*************************************************************************/
00084   /*                                                                       */
00085   /* <Struct>                                                              */
00086   /*    FT_BBox                                                            */
00087   /*                                                                       */
00088   /* <Description>                                                         */
00089   /*    A structure used to hold an outline's bounding box, i.e., the      */
00090   /*    coordinates of its extrema in the horizontal and vertical          */
00091   /*    directions.                                                        */
00092   /*                                                                       */
00093   /* <Fields>                                                              */
00094   /*    xMin :: The horizontal minimum (left-most).                        */
00095   /*                                                                       */
00096   /*    yMin :: The vertical minimum (bottom-most).                        */
00097   /*                                                                       */
00098   /*    xMax :: The horizontal maximum (right-most).                       */
00099   /*                                                                       */
00100   /*    yMax :: The vertical maximum (top-most).                           */
00101   /*                                                                       */
00102   /* <Note>                                                                */
00103   /*    The bounding box is specified with the coordinates of the lower    */
00104   /*    left and the upper right corner.  In PostScript, those values are  */
00105   /*    often called (llx,lly) and (urx,ury), respectively.                */
00106   /*                                                                       */
00107   /*    If `yMin' is negative, this value gives the glyph's descender.     */
00108   /*    Otherwise, the glyph doesn't descend below the baseline.           */
00109   /*    Similarly, if `ymax' is positive, this value gives the glyph's     */
00110   /*    ascender.                                                          */
00111   /*                                                                       */
00112   /*    `xMin' gives the horizontal distance from the glyph's origin to    */
00113   /*    the left edge of the glyph's bounding box.  If `xMin' is negative, */
00114   /*    the glyph extends to the left of the origin.                       */
00115   /*                                                                       */
00116   typedef struct  FT_BBox_
00117   {
00118     FT_Pos  xMin, yMin;
00119     FT_Pos  xMax, yMax;
00120 
00121   } FT_BBox;
00122 
00123 
00124   /*************************************************************************/
00125   /*                                                                       */
00126   /* <Enum>                                                                */
00127   /*    FT_Pixel_Mode                                                      */
00128   /*                                                                       */
00129   /* <Description>                                                         */
00130   /*    An enumeration type used to describe the format of pixels in a     */
00131   /*    given bitmap.  Note that additional formats may be added in the    */
00132   /*    future.                                                            */
00133   /*                                                                       */
00134   /* <Values>                                                              */
00135   /*    FT_PIXEL_MODE_NONE ::                                              */
00136   /*      Value~0 is reserved.                                             */
00137   /*                                                                       */
00138   /*    FT_PIXEL_MODE_MONO ::                                              */
00139   /*      A monochrome bitmap, using 1~bit per pixel.  Note that pixels    */
00140   /*      are stored in most-significant order (MSB), which means that     */
00141   /*      the left-most pixel in a byte has value 128.                     */
00142   /*                                                                       */
00143   /*    FT_PIXEL_MODE_GRAY ::                                              */
00144   /*      An 8-bit bitmap, generally used to represent anti-aliased glyph  */
00145   /*      images.  Each pixel is stored in one byte.  Note that the number */
00146   /*      of `gray' levels is stored in the `num_grays' field of the       */
00147   /*      @FT_Bitmap structure (it generally is 256).                      */
00148   /*                                                                       */
00149   /*    FT_PIXEL_MODE_GRAY2 ::                                             */
00150   /*      A 2-bit per pixel bitmap, used to represent embedded             */
00151   /*      anti-aliased bitmaps in font files according to the OpenType     */
00152   /*      specification.  We haven't found a single font using this        */
00153   /*      format, however.                                                 */
00154   /*                                                                       */
00155   /*    FT_PIXEL_MODE_GRAY4 ::                                             */
00156   /*      A 4-bit per pixel bitmap, representing embedded anti-aliased     */
00157   /*      bitmaps in font files according to the OpenType specification.   */
00158   /*      We haven't found a single font using this format, however.       */
00159   /*                                                                       */
00160   /*    FT_PIXEL_MODE_LCD ::                                               */
00161   /*      An 8-bit bitmap, representing RGB or BGR decimated glyph images  */
00162   /*      used for display on LCD displays; the bitmap is three times      */
00163   /*      wider than the original glyph image.  See also                   */
00164   /*      @FT_RENDER_MODE_LCD.                                             */
00165   /*                                                                       */
00166   /*    FT_PIXEL_MODE_LCD_V ::                                             */
00167   /*      An 8-bit bitmap, representing RGB or BGR decimated glyph images  */
00168   /*      used for display on rotated LCD displays; the bitmap is three    */
00169   /*      times taller than the original glyph image.  See also            */
00170   /*      @FT_RENDER_MODE_LCD_V.                                           */
00171   /*                                                                       */
00172   typedef enum  FT_Pixel_Mode_
00173   {
00174     FT_PIXEL_MODE_NONE = 0,
00175     FT_PIXEL_MODE_MONO,
00176     FT_PIXEL_MODE_GRAY,
00177     FT_PIXEL_MODE_GRAY2,
00178     FT_PIXEL_MODE_GRAY4,
00179     FT_PIXEL_MODE_LCD,
00180     FT_PIXEL_MODE_LCD_V,
00181 
00182     FT_PIXEL_MODE_MAX      /* do not remove */
00183 
00184   } FT_Pixel_Mode;
00185 
00186 
00187   /*************************************************************************/
00188   /*                                                                       */
00189   /* <Enum>                                                                */
00190   /*    ft_pixel_mode_xxx                                                  */
00191   /*                                                                       */
00192   /* <Description>                                                         */
00193   /*    A list of deprecated constants.  Use the corresponding             */
00194   /*    @FT_Pixel_Mode values instead.                                     */
00195   /*                                                                       */
00196   /* <Values>                                                              */
00197   /*    ft_pixel_mode_none  :: See @FT_PIXEL_MODE_NONE.                    */
00198   /*    ft_pixel_mode_mono  :: See @FT_PIXEL_MODE_MONO.                    */
00199   /*    ft_pixel_mode_grays :: See @FT_PIXEL_MODE_GRAY.                    */
00200   /*    ft_pixel_mode_pal2  :: See @FT_PIXEL_MODE_GRAY2.                   */
00201   /*    ft_pixel_mode_pal4  :: See @FT_PIXEL_MODE_GRAY4.                   */
00202   /*                                                                       */
00203 #define ft_pixel_mode_none   FT_PIXEL_MODE_NONE
00204 #define ft_pixel_mode_mono   FT_PIXEL_MODE_MONO
00205 #define ft_pixel_mode_grays  FT_PIXEL_MODE_GRAY
00206 #define ft_pixel_mode_pal2   FT_PIXEL_MODE_GRAY2
00207 #define ft_pixel_mode_pal4   FT_PIXEL_MODE_GRAY4
00208 
00209  /* */
00210 
00211 #if 0
00212 
00213   /*************************************************************************/
00214   /*                                                                       */
00215   /* <Enum>                                                                */
00216   /*    FT_Palette_Mode                                                    */
00217   /*                                                                       */
00218   /* <Description>                                                         */
00219   /*    THIS TYPE IS DEPRECATED.  DO NOT USE IT!                           */
00220   /*                                                                       */
00221   /*    An enumeration type to describe the format of a bitmap palette,    */
00222   /*    used with ft_pixel_mode_pal4 and ft_pixel_mode_pal8.               */
00223   /*                                                                       */
00224   /* <Values>                                                              */
00225   /*    ft_palette_mode_rgb  :: The palette is an array of 3-byte RGB      */
00226   /*                            records.                                   */
00227   /*                                                                       */
00228   /*    ft_palette_mode_rgba :: The palette is an array of 4-byte RGBA     */
00229   /*                            records.                                   */
00230   /*                                                                       */
00231   /* <Note>                                                                */
00232   /*    As ft_pixel_mode_pal2, pal4 and pal8 are currently unused by       */
00233   /*    FreeType, these types are not handled by the library itself.       */
00234   /*                                                                       */
00235   typedef enum  FT_Palette_Mode_
00236   {
00237     ft_palette_mode_rgb = 0,
00238     ft_palette_mode_rgba,
00239 
00240     ft_palette_mode_max   /* do not remove */
00241 
00242   } FT_Palette_Mode;
00243 
00244   /* */
00245 
00246 #endif
00247 
00248 
00249   /*************************************************************************/
00250   /*                                                                       */
00251   /* <Struct>                                                              */
00252   /*    FT_Bitmap                                                          */
00253   /*                                                                       */
00254   /* <Description>                                                         */
00255   /*    A structure used to describe a bitmap or pixmap to the raster.     */
00256   /*    Note that we now manage pixmaps of various depths through the      */
00257   /*    `pixel_mode' field.                                                */
00258   /*                                                                       */
00259   /* <Fields>                                                              */
00260   /*    rows         :: The number of bitmap rows.                         */
00261   /*                                                                       */
00262   /*    width        :: The number of pixels in bitmap row.                */
00263   /*                                                                       */
00264   /*    pitch        :: The pitch's absolute value is the number of bytes  */
00265   /*                    taken by one bitmap row, including padding.        */
00266   /*                    However, the pitch is positive when the bitmap has */
00267   /*                    a `down' flow, and negative when it has an `up'    */
00268   /*                    flow.  In all cases, the pitch is an offset to add */
00269   /*                    to a bitmap pointer in order to go down one row.   */
00270   /*                                                                       */
00271   /*                    For the B/W rasterizer, `pitch' is always an even  */
00272   /*                    number.                                            */
00273   /*                                                                       */
00274   /*    buffer       :: A typeless pointer to the bitmap buffer.  This     */
00275   /*                    value should be aligned on 32-bit boundaries in    */
00276   /*                    most cases.                                        */
00277   /*                                                                       */
00278   /*    num_grays    :: This field is only used with                       */
00279   /*                    @FT_PIXEL_MODE_GRAY; it gives the number of gray   */
00280   /*                    levels used in the bitmap.                         */
00281   /*                                                                       */
00282   /*    pixel_mode   :: The pixel mode, i.e., how pixel bits are stored.   */
00283   /*                    See @FT_Pixel_Mode for possible values.            */
00284   /*                                                                       */
00285   /*    palette_mode :: This field is intended for paletted pixel modes;   */
00286   /*                    it indicates how the palette is stored.  Not       */
00287   /*                    used currently.                                    */
00288   /*                                                                       */
00289   /*    palette      :: A typeless pointer to the bitmap palette; this     */
00290   /*                    field is intended for paletted pixel modes.  Not   */
00291   /*                    used currently.                                    */
00292   /*                                                                       */
00293   /* <Note>                                                                */
00294   /*   For now, the only pixel modes supported by FreeType are mono and    */
00295   /*   grays.  However, drivers might be added in the future to support    */
00296   /*   more `colorful' options.                                            */
00297   /*                                                                       */
00298   typedef struct  FT_Bitmap_
00299   {
00300     int             rows;
00301     int             width;
00302     int             pitch;
00303     unsigned char*  buffer;
00304     short           num_grays;
00305     char            pixel_mode;
00306     char            palette_mode;
00307     void*           palette;
00308 
00309   } FT_Bitmap;
00310 
00311 
00312   /*************************************************************************/
00313   /*                                                                       */
00314   /* <Section>                                                             */
00315   /*    outline_processing                                                 */
00316   /*                                                                       */
00317   /*************************************************************************/
00318 
00319 
00320   /*************************************************************************/
00321   /*                                                                       */
00322   /* <Struct>                                                              */
00323   /*    FT_Outline                                                         */
00324   /*                                                                       */
00325   /* <Description>                                                         */
00326   /*    This structure is used to describe an outline to the scan-line     */
00327   /*    converter.                                                         */
00328   /*                                                                       */
00329   /* <Fields>                                                              */
00330   /*    n_contours :: The number of contours in the outline.               */
00331   /*                                                                       */
00332   /*    n_points   :: The number of points in the outline.                 */
00333   /*                                                                       */
00334   /*    points     :: A pointer to an array of `n_points' @FT_Vector       */
00335   /*                  elements, giving the outline's point coordinates.    */
00336   /*                                                                       */
00337   /*    tags       :: A pointer to an array of `n_points' chars, giving    */
00338   /*                  each outline point's type.                           */
00339   /*                                                                       */
00340   /*                  If bit~0 is unset, the point is `off' the curve,     */
00341   /*                  i.e., a Bézier control point, while it is `on' if    */
00342   /*                  set.                                                 */
00343   /*                                                                       */
00344   /*                  Bit~1 is meaningful for `off' points only.  If set,  */
00345   /*                  it indicates a third-order Bézier arc control point; */
00346   /*                  and a second-order control point if unset.           */
00347   /*                                                                       */
00348   /*                  If bit~2 is set, bits 5-7 contain the drop-out mode  */
00349   /*                  (as defined in the OpenType specification; the value */
00350   /*                  is the same as the argument to the SCANMODE          */
00351   /*                  instruction).                                        */
00352   /*                                                                       */
00353   /*                  Bits 3 and~4 are reserved for internal purposes.     */
00354   /*                                                                       */
00355   /*    contours   :: An array of `n_contours' shorts, giving the end      */
00356   /*                  point of each contour within the outline.  For       */
00357   /*                  example, the first contour is defined by the points  */
00358   /*                  `0' to `contours[0]', the second one is defined by   */
00359   /*                  the points `contours[0]+1' to `contours[1]', etc.    */
00360   /*                                                                       */
00361   /*    flags      :: A set of bit flags used to characterize the outline  */
00362   /*                  and give hints to the scan-converter and hinter on   */
00363   /*                  how to convert/grid-fit it.  See @FT_OUTLINE_FLAGS.  */
00364   /*                                                                       */
00365   /* <Note>                                                                */
00366   /*    The B/W rasterizer only checks bit~2 in the `tags' array for the   */
00367   /*    first point of each contour.  The drop-out mode as given with      */
00368   /*    @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and       */
00369   /*    @FT_OUTLINE_INCLUDE_STUBS in `flags' is then overridden.           */
00370   /*                                                                       */
00371   typedef struct  FT_Outline_
00372   {
00373     short       n_contours;      /* number of contours in glyph        */
00374     short       n_points;        /* number of points in the glyph      */
00375 
00376     FT_Vector*  points;          /* the outline's points               */
00377     char*       tags;            /* the points flags                   */
00378     short*      contours;        /* the contour end points             */
00379 
00380     int         flags;           /* outline masks                      */
00381 
00382   } FT_Outline;
00383 
00384   /* Following limits must be consistent with */
00385   /* FT_Outline.{n_contours,n_points}         */
00386 #define FT_OUTLINE_CONTOURS_MAX  SHRT_MAX
00387 #define FT_OUTLINE_POINTS_MAX    SHRT_MAX
00388 
00389 
00390   /*************************************************************************/
00391   /*                                                                       */
00392   /* <Enum>                                                                */
00393   /*    FT_OUTLINE_FLAGS                                                   */
00394   /*                                                                       */
00395   /* <Description>                                                         */
00396   /*    A list of bit-field constants use for the flags in an outline's    */
00397   /*    `flags' field.                                                     */
00398   /*                                                                       */
00399   /* <Values>                                                              */
00400   /*    FT_OUTLINE_NONE ::                                                 */
00401   /*      Value~0 is reserved.                                             */
00402   /*                                                                       */
00403   /*    FT_OUTLINE_OWNER ::                                                */
00404   /*      If set, this flag indicates that the outline's field arrays      */
00405   /*      (i.e., `points', `flags', and `contours') are `owned' by the     */
00406   /*      outline object, and should thus be freed when it is destroyed.   */
00407   /*                                                                       */
00408   /*    FT_OUTLINE_EVEN_ODD_FILL ::                                        */
00409   /*      By default, outlines are filled using the non-zero winding rule. */
00410   /*      If set to 1, the outline will be filled using the even-odd fill  */
00411   /*      rule (only works with the smooth rasterizer).                    */
00412   /*                                                                       */
00413   /*    FT_OUTLINE_REVERSE_FILL ::                                         */
00414   /*      By default, outside contours of an outline are oriented in       */
00415   /*      clock-wise direction, as defined in the TrueType specification.  */
00416   /*      This flag is set if the outline uses the opposite direction      */
00417   /*      (typically for Type~1 fonts).  This flag is ignored by the scan  */
00418   /*      converter.                                                       */
00419   /*                                                                       */
00420   /*    FT_OUTLINE_IGNORE_DROPOUTS ::                                      */
00421   /*      By default, the scan converter will try to detect drop-outs in   */
00422   /*      an outline and correct the glyph bitmap to ensure consistent     */
00423   /*      shape continuity.  If set, this flag hints the scan-line         */
00424   /*      converter to ignore such cases.  See below for more information. */
00425   /*                                                                       */
00426   /*    FT_OUTLINE_SMART_DROPOUTS ::                                       */
00427   /*      Select smart dropout control.  If unset, use simple dropout      */
00428   /*      control.  Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set.  See    */
00429   /*      below for more information.                                      */
00430   /*                                                                       */
00431   /*    FT_OUTLINE_INCLUDE_STUBS ::                                        */
00432   /*      If set, turn pixels on for `stubs', otherwise exclude them.      */
00433   /*      Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set.  See below for    */
00434   /*      more information.                                                */
00435   /*                                                                       */
00436   /*    FT_OUTLINE_HIGH_PRECISION ::                                       */
00437   /*      This flag indicates that the scan-line converter should try to   */
00438   /*      convert this outline to bitmaps with the highest possible        */
00439   /*      quality.  It is typically set for small character sizes.  Note   */
00440   /*      that this is only a hint that might be completely ignored by a   */
00441   /*      given scan-converter.                                            */
00442   /*                                                                       */
00443   /*    FT_OUTLINE_SINGLE_PASS ::                                          */
00444   /*      This flag is set to force a given scan-converter to only use a   */
00445   /*      single pass over the outline to render a bitmap glyph image.     */
00446   /*      Normally, it is set for very large character sizes.  It is only  */
00447   /*      a hint that might be completely ignored by a given               */
00448   /*      scan-converter.                                                  */
00449   /*                                                                       */
00450   /* <Note>                                                                */
00451   /*    The flags @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, */
00452   /*    and @FT_OUTLINE_INCLUDE_STUBS are ignored by the smooth            */
00453   /*    rasterizer.                                                        */
00454   /*                                                                       */
00455   /*    There exists a second mechanism to pass the drop-out mode to the   */
00456   /*    B/W rasterizer; see the `tags' field in @FT_Outline.               */
00457   /*                                                                       */
00458   /*    Please refer to the description of the `SCANTYPE' instruction in   */
00459   /*    the OpenType specification (in file `ttinst1.doc') how simple      */
00460   /*    drop-outs, smart drop-outs, and stubs are defined.                 */
00461   /*                                                                       */
00462 #define FT_OUTLINE_NONE             0x0
00463 #define FT_OUTLINE_OWNER            0x1
00464 #define FT_OUTLINE_EVEN_ODD_FILL    0x2
00465 #define FT_OUTLINE_REVERSE_FILL     0x4
00466 #define FT_OUTLINE_IGNORE_DROPOUTS  0x8
00467 #define FT_OUTLINE_SMART_DROPOUTS   0x10
00468 #define FT_OUTLINE_INCLUDE_STUBS    0x20
00469 
00470 #define FT_OUTLINE_HIGH_PRECISION   0x100
00471 #define FT_OUTLINE_SINGLE_PASS      0x200
00472 
00473 
00474  /*************************************************************************
00475   *
00476   * @enum:
00477   *   ft_outline_flags
00478   *
00479   * @description:
00480   *   These constants are deprecated.  Please use the corresponding
00481   *   @FT_OUTLINE_FLAGS values.
00482   *
00483   * @values:
00484   *   ft_outline_none            :: See @FT_OUTLINE_NONE.
00485   *   ft_outline_owner           :: See @FT_OUTLINE_OWNER.
00486   *   ft_outline_even_odd_fill   :: See @FT_OUTLINE_EVEN_ODD_FILL.
00487   *   ft_outline_reverse_fill    :: See @FT_OUTLINE_REVERSE_FILL.
00488   *   ft_outline_ignore_dropouts :: See @FT_OUTLINE_IGNORE_DROPOUTS.
00489   *   ft_outline_high_precision  :: See @FT_OUTLINE_HIGH_PRECISION.
00490   *   ft_outline_single_pass     :: See @FT_OUTLINE_SINGLE_PASS.
00491   */
00492 #define ft_outline_none             FT_OUTLINE_NONE
00493 #define ft_outline_owner            FT_OUTLINE_OWNER
00494 #define ft_outline_even_odd_fill    FT_OUTLINE_EVEN_ODD_FILL
00495 #define ft_outline_reverse_fill     FT_OUTLINE_REVERSE_FILL
00496 #define ft_outline_ignore_dropouts  FT_OUTLINE_IGNORE_DROPOUTS
00497 #define ft_outline_high_precision   FT_OUTLINE_HIGH_PRECISION
00498 #define ft_outline_single_pass      FT_OUTLINE_SINGLE_PASS
00499 
00500   /* */
00501 
00502 #define FT_CURVE_TAG( flag )  ( flag & 3 )
00503 
00504 #define FT_CURVE_TAG_ON            1
00505 #define FT_CURVE_TAG_CONIC         0
00506 #define FT_CURVE_TAG_CUBIC         2
00507 
00508 #define FT_CURVE_TAG_HAS_SCANMODE  4
00509 
00510 #define FT_CURVE_TAG_TOUCH_X       8  /* reserved for the TrueType hinter */
00511 #define FT_CURVE_TAG_TOUCH_Y      16  /* reserved for the TrueType hinter */
00512 
00513 #define FT_CURVE_TAG_TOUCH_BOTH    ( FT_CURVE_TAG_TOUCH_X | \
00514                                      FT_CURVE_TAG_TOUCH_Y )
00515 
00516 #define FT_Curve_Tag_On       FT_CURVE_TAG_ON
00517 #define FT_Curve_Tag_Conic    FT_CURVE_TAG_CONIC
00518 #define FT_Curve_Tag_Cubic    FT_CURVE_TAG_CUBIC
00519 #define FT_Curve_Tag_Touch_X  FT_CURVE_TAG_TOUCH_X
00520 #define FT_Curve_Tag_Touch_Y  FT_CURVE_TAG_TOUCH_Y
00521 
00522 
00523   /*************************************************************************/
00524   /*                                                                       */
00525   /* <FuncType>                                                            */
00526   /*    FT_Outline_MoveToFunc                                              */
00527   /*                                                                       */
00528   /* <Description>                                                         */
00529   /*    A function pointer type used to describe the signature of a `move  */
00530   /*    to' function during outline walking/decomposition.                 */
00531   /*                                                                       */
00532   /*    A `move to' is emitted to start a new contour in an outline.       */
00533   /*                                                                       */
00534   /* <Input>                                                               */
00535   /*    to   :: A pointer to the target point of the `move to'.            */
00536   /*                                                                       */
00537   /*    user :: A typeless pointer which is passed from the caller of the  */
00538   /*            decomposition function.                                    */
00539   /*                                                                       */
00540   /* <Return>                                                              */
00541   /*    Error code.  0~means success.                                      */
00542   /*                                                                       */
00543   typedef int
00544   (*FT_Outline_MoveToFunc)( const FT_Vector*  to,
00545                             void*             user );
00546 
00547 #define FT_Outline_MoveTo_Func  FT_Outline_MoveToFunc
00548 
00549 
00550   /*************************************************************************/
00551   /*                                                                       */
00552   /* <FuncType>                                                            */
00553   /*    FT_Outline_LineToFunc                                              */
00554   /*                                                                       */
00555   /* <Description>                                                         */
00556   /*    A function pointer type used to describe the signature of a `line  */
00557   /*    to' function during outline walking/decomposition.                 */
00558   /*                                                                       */
00559   /*    A `line to' is emitted to indicate a segment in the outline.       */
00560   /*                                                                       */
00561   /* <Input>                                                               */
00562   /*    to   :: A pointer to the target point of the `line to'.            */
00563   /*                                                                       */
00564   /*    user :: A typeless pointer which is passed from the caller of the  */
00565   /*            decomposition function.                                    */
00566   /*                                                                       */
00567   /* <Return>                                                              */
00568   /*    Error code.  0~means success.                                      */
00569   /*                                                                       */
00570   typedef int
00571   (*FT_Outline_LineToFunc)( const FT_Vector*  to,
00572                             void*             user );
00573 
00574 #define FT_Outline_LineTo_Func  FT_Outline_LineToFunc
00575 
00576 
00577   /*************************************************************************/
00578   /*                                                                       */
00579   /* <FuncType>                                                            */
00580   /*    FT_Outline_ConicToFunc                                             */
00581   /*                                                                       */
00582   /* <Description>                                                         */
00583   /*    A function pointer type used to describe the signature of a `conic */
00584   /*    to' function during outline walking or decomposition.              */
00585   /*                                                                       */
00586   /*    A `conic to' is emitted to indicate a second-order Bézier arc in   */
00587   /*    the outline.                                                       */
00588   /*                                                                       */
00589   /* <Input>                                                               */
00590   /*    control :: An intermediate control point between the last position */
00591   /*               and the new target in `to'.                             */
00592   /*                                                                       */
00593   /*    to      :: A pointer to the target end point of the conic arc.     */
00594   /*                                                                       */
00595   /*    user    :: A typeless pointer which is passed from the caller of   */
00596   /*               the decomposition function.                             */
00597   /*                                                                       */
00598   /* <Return>                                                              */
00599   /*    Error code.  0~means success.                                      */
00600   /*                                                                       */
00601   typedef int
00602   (*FT_Outline_ConicToFunc)( const FT_Vector*  control,
00603                              const FT_Vector*  to,
00604                              void*             user );
00605 
00606 #define FT_Outline_ConicTo_Func  FT_Outline_ConicToFunc
00607 
00608 
00609   /*************************************************************************/
00610   /*                                                                       */
00611   /* <FuncType>                                                            */
00612   /*    FT_Outline_CubicToFunc                                             */
00613   /*                                                                       */
00614   /* <Description>                                                         */
00615   /*    A function pointer type used to describe the signature of a `cubic */
00616   /*    to' function during outline walking or decomposition.              */
00617   /*                                                                       */
00618   /*    A `cubic to' is emitted to indicate a third-order Bézier arc.      */
00619   /*                                                                       */
00620   /* <Input>                                                               */
00621   /*    control1 :: A pointer to the first Bézier control point.           */
00622   /*                                                                       */
00623   /*    control2 :: A pointer to the second Bézier control point.          */
00624   /*                                                                       */
00625   /*    to       :: A pointer to the target end point.                     */
00626   /*                                                                       */
00627   /*    user     :: A typeless pointer which is passed from the caller of  */
00628   /*                the decomposition function.                            */
00629   /*                                                                       */
00630   /* <Return>                                                              */
00631   /*    Error code.  0~means success.                                      */
00632   /*                                                                       */
00633   typedef int
00634   (*FT_Outline_CubicToFunc)( const FT_Vector*  control1,
00635                              const FT_Vector*  control2,
00636                              const FT_Vector*  to,
00637                              void*             user );
00638 
00639 #define FT_Outline_CubicTo_Func  FT_Outline_CubicToFunc
00640 
00641 
00642   /*************************************************************************/
00643   /*                                                                       */
00644   /* <Struct>                                                              */
00645   /*    FT_Outline_Funcs                                                   */
00646   /*                                                                       */
00647   /* <Description>                                                         */
00648   /*    A structure to hold various function pointers used during outline  */
00649   /*    decomposition in order to emit segments, conic, and cubic Béziers. */
00650   /*                                                                       */
00651   /* <Fields>                                                              */
00652   /*    move_to  :: The `move to' emitter.                                 */
00653   /*                                                                       */
00654   /*    line_to  :: The segment emitter.                                   */
00655   /*                                                                       */
00656   /*    conic_to :: The second-order Bézier arc emitter.                   */
00657   /*                                                                       */
00658   /*    cubic_to :: The third-order Bézier arc emitter.                    */
00659   /*                                                                       */
00660   /*    shift    :: The shift that is applied to coordinates before they   */
00661   /*                are sent to the emitter.                               */
00662   /*                                                                       */
00663   /*    delta    :: The delta that is applied to coordinates before they   */
00664   /*                are sent to the emitter, but after the shift.          */
00665   /*                                                                       */
00666   /* <Note>                                                                */
00667   /*    The point coordinates sent to the emitters are the transformed     */
00668   /*    version of the original coordinates (this is important for high    */
00669   /*    accuracy during scan-conversion).  The transformation is simple:   */
00670   /*                                                                       */
00671   /*    {                                                                  */
00672   /*      x' = (x << shift) - delta                                        */
00673   /*      y' = (x << shift) - delta                                        */
00674   /*    }                                                                  */
00675   /*                                                                       */
00676   /*    Set the values of `shift' and `delta' to~0 to get the original     */
00677   /*    point coordinates.                                                 */
00678   /*                                                                       */
00679   typedef struct  FT_Outline_Funcs_
00680   {
00681     FT_Outline_MoveToFunc   move_to;
00682     FT_Outline_LineToFunc   line_to;
00683     FT_Outline_ConicToFunc  conic_to;
00684     FT_Outline_CubicToFunc  cubic_to;
00685 
00686     int                     shift;
00687     FT_Pos                  delta;
00688 
00689   } FT_Outline_Funcs;
00690 
00691 
00692   /*************************************************************************/
00693   /*                                                                       */
00694   /* <Section>                                                             */
00695   /*    basic_types                                                        */
00696   /*                                                                       */
00697   /*************************************************************************/
00698 
00699 
00700   /*************************************************************************/
00701   /*                                                                       */
00702   /* <Macro>                                                               */
00703   /*    FT_IMAGE_TAG                                                       */
00704   /*                                                                       */
00705   /* <Description>                                                         */
00706   /*    This macro converts four-letter tags to an unsigned long type.     */
00707   /*                                                                       */
00708   /* <Note>                                                                */
00709   /*    Since many 16-bit compilers don't like 32-bit enumerations, you    */
00710   /*    should redefine this macro in case of problems to something like   */
00711   /*    this:                                                              */
00712   /*                                                                       */
00713   /*    {                                                                  */
00714   /*      #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 )  value         */
00715   /*    }                                                                  */
00716   /*                                                                       */
00717   /*    to get a simple enumeration without assigning special numbers.     */
00718   /*                                                                       */
00719 #ifndef FT_IMAGE_TAG
00720 #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 )  \
00721           value = ( ( (unsigned long)_x1 << 24 ) | \
00722                     ( (unsigned long)_x2 << 16 ) | \
00723                     ( (unsigned long)_x3 << 8  ) | \
00724                       (unsigned long)_x4         )
00725 #endif /* FT_IMAGE_TAG */
00726 
00727 
00728   /*************************************************************************/
00729   /*                                                                       */
00730   /* <Enum>                                                                */
00731   /*    FT_Glyph_Format                                                    */
00732   /*                                                                       */
00733   /* <Description>                                                         */
00734   /*    An enumeration type used to describe the format of a given glyph   */
00735   /*    image.  Note that this version of FreeType only supports two image */
00736   /*    formats, even though future font drivers will be able to register  */
00737   /*    their own format.                                                  */
00738   /*                                                                       */
00739   /* <Values>                                                              */
00740   /*    FT_GLYPH_FORMAT_NONE ::                                            */
00741   /*      The value~0 is reserved.                                         */
00742   /*                                                                       */
00743   /*    FT_GLYPH_FORMAT_COMPOSITE ::                                       */
00744   /*      The glyph image is a composite of several other images.  This    */
00745   /*      format is _only_ used with @FT_LOAD_NO_RECURSE, and is used to   */
00746   /*      report compound glyphs (like accented characters).               */
00747   /*                                                                       */
00748   /*    FT_GLYPH_FORMAT_BITMAP ::                                          */
00749   /*      The glyph image is a bitmap, and can be described as an          */
00750   /*      @FT_Bitmap.  You generally need to access the `bitmap' field of  */
00751   /*      the @FT_GlyphSlotRec structure to read it.                       */
00752   /*                                                                       */
00753   /*    FT_GLYPH_FORMAT_OUTLINE ::                                         */
00754   /*      The glyph image is a vectorial outline made of line segments     */
00755   /*      and Bézier arcs; it can be described as an @FT_Outline; you      */
00756   /*      generally want to access the `outline' field of the              */
00757   /*      @FT_GlyphSlotRec structure to read it.                           */
00758   /*                                                                       */
00759   /*    FT_GLYPH_FORMAT_PLOTTER ::                                         */
00760   /*      The glyph image is a vectorial path with no inside and outside   */
00761   /*      contours.  Some Type~1 fonts, like those in the Hershey family,  */
00762   /*      contain glyphs in this format.  These are described as           */
00763   /*      @FT_Outline, but FreeType isn't currently capable of rendering   */
00764   /*      them correctly.                                                  */
00765   /*                                                                       */
00766   typedef enum  FT_Glyph_Format_
00767   {
00768     FT_IMAGE_TAG( FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0 ),
00769 
00770     FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ),
00771     FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP,    'b', 'i', 't', 's' ),
00772     FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE,   'o', 'u', 't', 'l' ),
00773     FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER,   'p', 'l', 'o', 't' )
00774 
00775   } FT_Glyph_Format;
00776 
00777 
00778   /*************************************************************************/
00779   /*                                                                       */
00780   /* <Enum>                                                                */
00781   /*    ft_glyph_format_xxx                                                */
00782   /*                                                                       */
00783   /* <Description>                                                         */
00784   /*    A list of deprecated constants.  Use the corresponding             */
00785   /*    @FT_Glyph_Format values instead.                                   */
00786   /*                                                                       */
00787   /* <Values>                                                              */
00788   /*    ft_glyph_format_none      :: See @FT_GLYPH_FORMAT_NONE.            */
00789   /*    ft_glyph_format_composite :: See @FT_GLYPH_FORMAT_COMPOSITE.       */
00790   /*    ft_glyph_format_bitmap    :: See @FT_GLYPH_FORMAT_BITMAP.          */
00791   /*    ft_glyph_format_outline   :: See @FT_GLYPH_FORMAT_OUTLINE.         */
00792   /*    ft_glyph_format_plotter   :: See @FT_GLYPH_FORMAT_PLOTTER.         */
00793   /*                                                                       */
00794 #define ft_glyph_format_none       FT_GLYPH_FORMAT_NONE
00795 #define ft_glyph_format_composite  FT_GLYPH_FORMAT_COMPOSITE
00796 #define ft_glyph_format_bitmap     FT_GLYPH_FORMAT_BITMAP
00797 #define ft_glyph_format_outline    FT_GLYPH_FORMAT_OUTLINE
00798 #define ft_glyph_format_plotter    FT_GLYPH_FORMAT_PLOTTER
00799 
00800 
00801   /*************************************************************************/
00802   /*************************************************************************/
00803   /*************************************************************************/
00804   /*****                                                               *****/
00805   /*****            R A S T E R   D E F I N I T I O N S                *****/
00806   /*****                                                               *****/
00807   /*************************************************************************/
00808   /*************************************************************************/
00809   /*************************************************************************/
00810 
00811 
00812   /*************************************************************************/
00813   /*                                                                       */
00814   /* A raster is a scan converter, in charge of rendering an outline into  */
00815   /* a a bitmap.  This section contains the public API for rasters.        */
00816   /*                                                                       */
00817   /* Note that in FreeType 2, all rasters are now encapsulated within      */
00818   /* specific modules called `renderers'.  See `freetype/ftrender.h' for   */
00819   /* more details on renderers.                                            */
00820   /*                                                                       */
00821   /*************************************************************************/
00822 
00823 
00824   /*************************************************************************/
00825   /*                                                                       */
00826   /* <Section>                                                             */
00827   /*    raster                                                             */
00828   /*                                                                       */
00829   /* <Title>                                                               */
00830   /*    Scanline Converter                                                 */
00831   /*                                                                       */
00832   /* <Abstract>                                                            */
00833   /*    How vectorial outlines are converted into bitmaps and pixmaps.     */
00834   /*                                                                       */
00835   /* <Description>                                                         */
00836   /*    This section contains technical definitions.                       */
00837   /*                                                                       */
00838   /*************************************************************************/
00839 
00840 
00841   /*************************************************************************/
00842   /*                                                                       */
00843   /* <Type>                                                                */
00844   /*    FT_Raster                                                          */
00845   /*                                                                       */
00846   /* <Description>                                                         */
00847   /*    A handle (pointer) to a raster object.  Each object can be used    */
00848   /*    independently to convert an outline into a bitmap or pixmap.       */
00849   /*                                                                       */
00850   typedef struct FT_RasterRec_*  FT_Raster;
00851 
00852 
00853   /*************************************************************************/
00854   /*                                                                       */
00855   /* <Struct>                                                              */
00856   /*    FT_Span                                                            */
00857   /*                                                                       */
00858   /* <Description>                                                         */
00859   /*    A structure used to model a single span of gray (or black) pixels  */
00860   /*    when rendering a monochrome or anti-aliased bitmap.                */
00861   /*                                                                       */
00862   /* <Fields>                                                              */
00863   /*    x        :: The span's horizontal start position.                  */
00864   /*                                                                       */
00865   /*    len      :: The span's length in pixels.                           */
00866   /*                                                                       */
00867   /*    coverage :: The span color/coverage, ranging from 0 (background)   */
00868   /*                to 255 (foreground).  Only used for anti-aliased       */
00869   /*                rendering.                                             */
00870   /*                                                                       */
00871   /* <Note>                                                                */
00872   /*    This structure is used by the span drawing callback type named     */
00873   /*    @FT_SpanFunc which takes the y~coordinate of the span as a         */
00874   /*    a parameter.                                                       */
00875   /*                                                                       */
00876   /*    The coverage value is always between 0 and 255.  If you want less  */
00877   /*    gray values, the callback function has to reduce them.             */
00878   /*                                                                       */
00879   typedef struct  FT_Span_
00880   {
00881     short           x;
00882     unsigned short  len;
00883     unsigned char   coverage;
00884 
00885   } FT_Span;
00886 
00887 
00888   /*************************************************************************/
00889   /*                                                                       */
00890   /* <FuncType>                                                            */
00891   /*    FT_SpanFunc                                                        */
00892   /*                                                                       */
00893   /* <Description>                                                         */
00894   /*    A function used as a call-back by the anti-aliased renderer in     */
00895   /*    order to let client applications draw themselves the gray pixel    */
00896   /*    spans on each scan line.                                           */
00897   /*                                                                       */
00898   /* <Input>                                                               */
00899   /*    y     :: The scanline's y~coordinate.                              */
00900   /*                                                                       */
00901   /*    count :: The number of spans to draw on this scanline.             */
00902   /*                                                                       */
00903   /*    spans :: A table of `count' spans to draw on the scanline.         */
00904   /*                                                                       */
00905   /*    user  :: User-supplied data that is passed to the callback.        */
00906   /*                                                                       */
00907   /* <Note>                                                                */
00908   /*    This callback allows client applications to directly render the    */
00909   /*    gray spans of the anti-aliased bitmap to any kind of surfaces.     */
00910   /*                                                                       */
00911   /*    This can be used to write anti-aliased outlines directly to a      */
00912   /*    given background bitmap, and even perform translucency.            */
00913   /*                                                                       */
00914   /*    Note that the `count' field cannot be greater than a fixed value   */
00915   /*    defined by the `FT_MAX_GRAY_SPANS' configuration macro in          */
00916   /*    `ftoption.h'.  By default, this value is set to~32, which means    */
00917   /*    that if there are more than 32~spans on a given scanline, the      */
00918   /*    callback is called several times with the same `y' parameter in    */
00919   /*    order to draw all callbacks.                                       */
00920   /*                                                                       */
00921   /*    Otherwise, the callback is only called once per scan-line, and     */
00922   /*    only for those scanlines that do have `gray' pixels on them.       */
00923   /*                                                                       */
00924   typedef void
00925   (*FT_SpanFunc)( int             y,
00926                   int             count,
00927                   const FT_Span*  spans,
00928                   void*           user );
00929 
00930 #define FT_Raster_Span_Func  FT_SpanFunc
00931 
00932 
00933   /*************************************************************************/
00934   /*                                                                       */
00935   /* <FuncType>                                                            */
00936   /*    FT_Raster_BitTest_Func                                             */
00937   /*                                                                       */
00938   /* <Description>                                                         */
00939   /*    THIS TYPE IS DEPRECATED.  DO NOT USE IT.                           */
00940   /*                                                                       */
00941   /*    A function used as a call-back by the monochrome scan-converter    */
00942   /*    to test whether a given target pixel is already set to the drawing */
00943   /*    `color'.  These tests are crucial to implement drop-out control    */
00944   /*    per-se the TrueType spec.                                          */
00945   /*                                                                       */
00946   /* <Input>                                                               */
00947   /*    y     :: The pixel's y~coordinate.                                 */
00948   /*                                                                       */
00949   /*    x     :: The pixel's x~coordinate.                                 */
00950   /*                                                                       */
00951   /*    user  :: User-supplied data that is passed to the callback.        */
00952   /*                                                                       */
00953   /* <Return>                                                              */
00954   /*   1~if the pixel is `set', 0~otherwise.                               */
00955   /*                                                                       */
00956   typedef int
00957   (*FT_Raster_BitTest_Func)( int    y,
00958                              int    x,
00959                              void*  user );
00960 
00961 
00962   /*************************************************************************/
00963   /*                                                                       */
00964   /* <FuncType>                                                            */
00965   /*    FT_Raster_BitSet_Func                                              */
00966   /*                                                                       */
00967   /* <Description>                                                         */
00968   /*    THIS TYPE IS DEPRECATED.  DO NOT USE IT.                           */
00969   /*                                                                       */
00970   /*    A function used as a call-back by the monochrome scan-converter    */
00971   /*    to set an individual target pixel.  This is crucial to implement   */
00972   /*    drop-out control according to the TrueType specification.          */
00973   /*                                                                       */
00974   /* <Input>                                                               */
00975   /*    y     :: The pixel's y~coordinate.                                 */
00976   /*                                                                       */
00977   /*    x     :: The pixel's x~coordinate.                                 */
00978   /*                                                                       */
00979   /*    user  :: User-supplied data that is passed to the callback.        */
00980   /*                                                                       */
00981   /* <Return>                                                              */
00982   /*    1~if the pixel is `set', 0~otherwise.                              */
00983   /*                                                                       */
00984   typedef void
00985   (*FT_Raster_BitSet_Func)( int    y,
00986                             int    x,
00987                             void*  user );
00988 
00989 
00990   /*************************************************************************/
00991   /*                                                                       */
00992   /* <Enum>                                                                */
00993   /*    FT_RASTER_FLAG_XXX                                                 */
00994   /*                                                                       */
00995   /* <Description>                                                         */
00996   /*    A list of bit flag constants as used in the `flags' field of a     */
00997   /*    @FT_Raster_Params structure.                                       */
00998   /*                                                                       */
00999   /* <Values>                                                              */
01000   /*    FT_RASTER_FLAG_DEFAULT :: This value is 0.                         */
01001   /*                                                                       */
01002   /*    FT_RASTER_FLAG_AA      :: This flag is set to indicate that an     */
01003   /*                              anti-aliased glyph image should be       */
01004   /*                              generated.  Otherwise, it will be        */
01005   /*                              monochrome (1-bit).                      */
01006   /*                                                                       */
01007   /*    FT_RASTER_FLAG_DIRECT  :: This flag is set to indicate direct      */
01008   /*                              rendering.  In this mode, client         */
01009   /*                              applications must provide their own span */
01010   /*                              callback.  This lets them directly       */
01011   /*                              draw or compose over an existing bitmap. */
01012   /*                              If this bit is not set, the target       */
01013   /*                              pixmap's buffer _must_ be zeroed before  */
01014   /*                              rendering.                               */
01015   /*                                                                       */
01016   /*                              Note that for now, direct rendering is   */
01017   /*                              only possible with anti-aliased glyphs.  */
01018   /*                                                                       */
01019   /*    FT_RASTER_FLAG_CLIP    :: This flag is only used in direct         */
01020   /*                              rendering mode.  If set, the output will */
01021   /*                              be clipped to a box specified in the     */
01022   /*                              `clip_box' field of the                  */
01023   /*                              @FT_Raster_Params structure.             */
01024   /*                                                                       */
01025   /*                              Note that by default, the glyph bitmap   */
01026   /*                              is clipped to the target pixmap, except  */
01027   /*                              in direct rendering mode where all spans */
01028   /*                              are generated if no clipping box is set. */
01029   /*                                                                       */
01030 #define FT_RASTER_FLAG_DEFAULT  0x0
01031 #define FT_RASTER_FLAG_AA       0x1
01032 #define FT_RASTER_FLAG_DIRECT   0x2
01033 #define FT_RASTER_FLAG_CLIP     0x4
01034 
01035   /* deprecated */
01036 #define ft_raster_flag_default  FT_RASTER_FLAG_DEFAULT
01037 #define ft_raster_flag_aa       FT_RASTER_FLAG_AA
01038 #define ft_raster_flag_direct   FT_RASTER_FLAG_DIRECT
01039 #define ft_raster_flag_clip     FT_RASTER_FLAG_CLIP
01040 
01041 
01042   /*************************************************************************/
01043   /*                                                                       */
01044   /* <Struct>                                                              */
01045   /*    FT_Raster_Params                                                   */
01046   /*                                                                       */
01047   /* <Description>                                                         */
01048   /*    A structure to hold the arguments used by a raster's render        */
01049   /*    function.                                                          */
01050   /*                                                                       */
01051   /* <Fields>                                                              */
01052   /*    target      :: The target bitmap.                                  */
01053   /*                                                                       */
01054   /*    source      :: A pointer to the source glyph image (e.g., an       */
01055   /*                   @FT_Outline).                                       */
01056   /*                                                                       */
01057   /*    flags       :: The rendering flags.                                */
01058   /*                                                                       */
01059   /*    gray_spans  :: The gray span drawing callback.                     */
01060   /*                                                                       */
01061   /*    black_spans :: The black span drawing callback.  UNIMPLEMENTED!    */
01062   /*                                                                       */
01063   /*    bit_test    :: The bit test callback.  UNIMPLEMENTED!              */
01064   /*                                                                       */
01065   /*    bit_set     :: The bit set callback.  UNIMPLEMENTED!               */
01066   /*                                                                       */
01067   /*    user        :: User-supplied data that is passed to each drawing   */
01068   /*                   callback.                                           */
01069   /*                                                                       */
01070   /*    clip_box    :: An optional clipping box.  It is only used in       */
01071   /*                   direct rendering mode.  Note that coordinates here  */
01072   /*                   should be expressed in _integer_ pixels (and not in */
01073   /*                   26.6 fixed-point units).                            */
01074   /*                                                                       */
01075   /* <Note>                                                                */
01076   /*    An anti-aliased glyph bitmap is drawn if the @FT_RASTER_FLAG_AA    */
01077   /*    bit flag is set in the `flags' field, otherwise a monochrome       */
01078   /*    bitmap is generated.                                               */
01079   /*                                                                       */
01080   /*    If the @FT_RASTER_FLAG_DIRECT bit flag is set in `flags', the      */
01081   /*    raster will call the `gray_spans' callback to draw gray pixel      */
01082   /*    spans, in the case of an aa glyph bitmap, it will call             */
01083   /*    `black_spans', and `bit_test' and `bit_set' in the case of a       */
01084   /*    monochrome bitmap.  This allows direct composition over a          */
01085   /*    pre-existing bitmap through user-provided callbacks to perform the */
01086   /*    span drawing/composition.                                          */
01087   /*                                                                       */
01088   /*    Note that the `bit_test' and `bit_set' callbacks are required when */
01089   /*    rendering a monochrome bitmap, as they are crucial to implement    */
01090   /*    correct drop-out control as defined in the TrueType specification. */
01091   /*                                                                       */
01092   typedef struct  FT_Raster_Params_
01093   {
01094     const FT_Bitmap*        target;
01095     const void*             source;
01096     int                     flags;
01097     FT_SpanFunc             gray_spans;
01098     FT_SpanFunc             black_spans;  /* doesn't work! */
01099     FT_Raster_BitTest_Func  bit_test;     /* doesn't work! */
01100     FT_Raster_BitSet_Func   bit_set;      /* doesn't work! */
01101     void*                   user;
01102     FT_BBox                 clip_box;
01103 
01104   } FT_Raster_Params;
01105 
01106 
01107   /*************************************************************************/
01108   /*                                                                       */
01109   /* <FuncType>                                                            */
01110   /*    FT_Raster_NewFunc                                                  */
01111   /*                                                                       */
01112   /* <Description>                                                         */
01113   /*    A function used to create a new raster object.                     */
01114   /*                                                                       */
01115   /* <Input>                                                               */
01116   /*    memory :: A handle to the memory allocator.                        */
01117   /*                                                                       */
01118   /* <Output>                                                              */
01119   /*    raster :: A handle to the new raster object.                       */
01120   /*                                                                       */
01121   /* <Return>                                                              */
01122   /*    Error code.  0~means success.                                      */
01123   /*                                                                       */
01124   /* <Note>                                                                */
01125   /*    The `memory' parameter is a typeless pointer in order to avoid     */
01126   /*    un-wanted dependencies on the rest of the FreeType code.  In       */
01127   /*    practice, it is an @FT_Memory object, i.e., a handle to the        */
01128   /*    standard FreeType memory allocator.  However, this field can be    */
01129   /*    completely ignored by a given raster implementation.               */
01130   /*                                                                       */
01131   typedef int
01132   (*FT_Raster_NewFunc)( void*       memory,
01133                         FT_Raster*  raster );
01134 
01135 #define FT_Raster_New_Func  FT_Raster_NewFunc
01136 
01137 
01138   /*************************************************************************/
01139   /*                                                                       */
01140   /* <FuncType>                                                            */
01141   /*    FT_Raster_DoneFunc                                                 */
01142   /*                                                                       */
01143   /* <Description>                                                         */
01144   /*    A function used to destroy a given raster object.                  */
01145   /*                                                                       */
01146   /* <Input>                                                               */
01147   /*    raster :: A handle to the raster object.                           */
01148   /*                                                                       */
01149   typedef void
01150   (*FT_Raster_DoneFunc)( FT_Raster  raster );
01151 
01152 #define FT_Raster_Done_Func  FT_Raster_DoneFunc
01153 
01154 
01155   /*************************************************************************/
01156   /*                                                                       */
01157   /* <FuncType>                                                            */
01158   /*    FT_Raster_ResetFunc                                                */
01159   /*                                                                       */
01160   /* <Description>                                                         */
01161   /*    FreeType provides an area of memory called the `render pool',      */
01162   /*    available to all registered rasters.  This pool can be freely used */
01163   /*    during a given scan-conversion but is shared by all rasters.  Its  */
01164   /*    content is thus transient.                                         */
01165   /*                                                                       */
01166   /*    This function is called each time the render pool changes, or just */
01167   /*    after a new raster object is created.                              */
01168   /*                                                                       */
01169   /* <Input>                                                               */
01170   /*    raster    :: A handle to the new raster object.                    */
01171   /*                                                                       */
01172   /*    pool_base :: The address in memory of the render pool.             */
01173   /*                                                                       */
01174   /*    pool_size :: The size in bytes of the render pool.                 */
01175   /*                                                                       */
01176   /* <Note>                                                                */
01177   /*    Rasters can ignore the render pool and rely on dynamic memory      */
01178   /*    allocation if they want to (a handle to the memory allocator is    */
01179   /*    passed to the raster constructor).  However, this is not           */
01180   /*    recommended for efficiency purposes.                               */
01181   /*                                                                       */
01182   typedef void
01183   (*FT_Raster_ResetFunc)( FT_Raster       raster,
01184                           unsigned char*  pool_base,
01185                           unsigned long   pool_size );
01186 
01187 #define FT_Raster_Reset_Func  FT_Raster_ResetFunc
01188 
01189 
01190   /*************************************************************************/
01191   /*                                                                       */
01192   /* <FuncType>                                                            */
01193   /*    FT_Raster_SetModeFunc                                              */
01194   /*                                                                       */
01195   /* <Description>                                                         */
01196   /*    This function is a generic facility to change modes or attributes  */
01197   /*    in a given raster.  This can be used for debugging purposes, or    */
01198   /*    simply to allow implementation-specific `features' in a given      */
01199   /*    raster module.                                                     */
01200   /*                                                                       */
01201   /* <Input>                                                               */
01202   /*    raster :: A handle to the new raster object.                       */
01203   /*                                                                       */
01204   /*    mode   :: A 4-byte tag used to name the mode or property.          */
01205   /*                                                                       */
01206   /*    args   :: A pointer to the new mode/property to use.               */
01207   /*                                                                       */
01208   typedef int
01209   (*FT_Raster_SetModeFunc)( FT_Raster      raster,
01210                             unsigned long  mode,
01211                             void*          args );
01212 
01213 #define FT_Raster_Set_Mode_Func  FT_Raster_SetModeFunc
01214 
01215 
01216   /*************************************************************************/
01217   /*                                                                       */
01218   /* <FuncType>                                                            */
01219   /*    FT_Raster_RenderFunc                                               */
01220   /*                                                                       */
01221   /* <Description>                                                         */
01222   /*    Invoke a given raster to scan-convert a given glyph image into a   */
01223   /*    target bitmap.                                                     */
01224   /*                                                                       */
01225   /* <Input>                                                               */
01226   /*    raster :: A handle to the raster object.                           */
01227   /*                                                                       */
01228   /*    params :: A pointer to an @FT_Raster_Params structure used to      */
01229   /*              store the rendering parameters.                          */
01230   /*                                                                       */
01231   /* <Return>                                                              */
01232   /*    Error code.  0~means success.                                      */
01233   /*                                                                       */
01234   /* <Note>                                                                */
01235   /*    The exact format of the source image depends on the raster's glyph */
01236   /*    format defined in its @FT_Raster_Funcs structure.  It can be an    */
01237   /*    @FT_Outline or anything else in order to support a large array of  */
01238   /*    glyph formats.                                                     */
01239   /*                                                                       */
01240   /*    Note also that the render function can fail and return a           */
01241   /*    `FT_Err_Unimplemented_Feature' error code if the raster used does  */
01242   /*    not support direct composition.                                    */
01243   /*                                                                       */
01244   /*    XXX: For now, the standard raster doesn't support direct           */
01245   /*         composition but this should change for the final release (see */
01246   /*         the files `demos/src/ftgrays.c' and `demos/src/ftgrays2.c'    */
01247   /*         for examples of distinct implementations which support direct */
01248   /*         composition).                                                 */
01249   /*                                                                       */
01250   typedef int
01251   (*FT_Raster_RenderFunc)( FT_Raster                raster,
01252                            const FT_Raster_Params*  params );
01253 
01254 #define FT_Raster_Render_Func  FT_Raster_RenderFunc
01255 
01256 
01257   /*************************************************************************/
01258   /*                                                                       */
01259   /* <Struct>                                                              */
01260   /*    FT_Raster_Funcs                                                    */
01261   /*                                                                       */
01262   /* <Description>                                                         */
01263   /*   A structure used to describe a given raster class to the library.   */
01264   /*                                                                       */
01265   /* <Fields>                                                              */
01266   /*    glyph_format  :: The supported glyph format for this raster.       */
01267   /*                                                                       */
01268   /*    raster_new    :: The raster constructor.                           */
01269   /*                                                                       */
01270   /*    raster_reset  :: Used to reset the render pool within the raster.  */
01271   /*                                                                       */
01272   /*    raster_render :: A function to render a glyph into a given bitmap. */
01273   /*                                                                       */
01274   /*    raster_done   :: The raster destructor.                            */
01275   /*                                                                       */
01276   typedef struct  FT_Raster_Funcs_
01277   {
01278     FT_Glyph_Format        glyph_format;
01279     FT_Raster_NewFunc      raster_new;
01280     FT_Raster_ResetFunc    raster_reset;
01281     FT_Raster_SetModeFunc  raster_set_mode;
01282     FT_Raster_RenderFunc   raster_render;
01283     FT_Raster_DoneFunc     raster_done;
01284 
01285   } FT_Raster_Funcs;
01286 
01287 
01288   /* */
01289 
01290 
01291 FT_END_HEADER
01292 
01293 #endif /* __FTIMAGE_H__ */
01294 
01295 
01296 /* END */
01297 
01298 
01299 /* Local Variables: */
01300 /* coding: utf-8    */
01301 /* End:             */

Generated on Tue Jul 5 14:13:36 2011 for ROOT_528-00b_version by  doxygen 1.5.1