ftimage.h
上传用户:yisoukefu
上传日期:2020-08-09
资源大小:39506k
文件大小:76k
源码类别:

其他游戏

开发平台:

Visual C++

  1. /***************************************************************************/
  2. /*                                                                         */
  3. /*  ftimage.h                                                              */
  4. /*                                                                         */
  5. /*    FreeType glyph image formats and default raster interface            */
  6. /*    (specification).                                                     */
  7. /*                                                                         */
  8. /*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
  9. /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
  10. /*                                                                         */
  11. /*  This file is part of the FreeType project, and may only be used,       */
  12. /*  modified, and distributed under the terms of the FreeType project      */
  13. /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
  14. /*  this file you indicate that you have read the license and              */
  15. /*  understand and accept it fully.                                        */
  16. /*                                                                         */
  17. /***************************************************************************/
  18.   /*************************************************************************/
  19.   /*                                                                       */
  20.   /* Note: A `raster' is simply a scan-line converter, used to render      */
  21.   /*       FT_Outlines into FT_Bitmaps.                                    */
  22.   /*                                                                       */
  23.   /*************************************************************************/
  24. #ifndef __FTIMAGE_H__
  25. #define __FTIMAGE_H__
  26. /* _STANDALONE_ is from ftgrays.c */
  27. #ifndef _STANDALONE_
  28. #include <ft2build.h>
  29. #endif
  30. FT_BEGIN_HEADER
  31.   /*************************************************************************/
  32.   /*                                                                       */
  33.   /* <Section>                                                             */
  34.   /*    basic_types                                                        */
  35.   /*                                                                       */
  36.   /*************************************************************************/
  37.   /*************************************************************************/
  38.   /*                                                                       */
  39.   /* <Type>                                                                */
  40.   /*    FT_Pos                                                             */
  41.   /*                                                                       */
  42.   /* <Description>                                                         */
  43.   /*    The type FT_Pos is a 32-bit integer used to store vectorial        */
  44.   /*    coordinates.  Depending on the context, these can represent        */
  45.   /*    distances in integer font units, or 16,16, or 26.6 fixed float     */
  46.   /*    pixel coordinates.                                                 */
  47.   /*                                                                       */
  48.   typedef signed long  FT_Pos;
  49.   /*************************************************************************/
  50.   /*                                                                       */
  51.   /* <Struct>                                                              */
  52.   /*    FT_Vector                                                          */
  53.   /*                                                                       */
  54.   /* <Description>                                                         */
  55.   /*    A simple structure used to store a 2D vector; coordinates are of   */
  56.   /*    the FT_Pos type.                                                   */
  57.   /*                                                                       */
  58.   /* <Fields>                                                              */
  59.   /*    x :: The horizontal coordinate.                                    */
  60.   /*    y :: The vertical coordinate.                                      */
  61.   /*                                                                       */
  62.   typedef struct  FT_Vector_
  63.   {
  64.     FT_Pos  x;
  65.     FT_Pos  y;
  66.   } FT_Vector;
  67.   /*************************************************************************/
  68.   /*                                                                       */
  69.   /* <Struct>                                                              */
  70.   /*    FT_BBox                                                            */
  71.   /*                                                                       */
  72.   /* <Description>                                                         */
  73.   /*    A structure used to hold an outline's bounding box, i.e., the      */
  74.   /*    coordinates of its extrema in the horizontal and vertical          */
  75.   /*    directions.                                                        */
  76.   /*                                                                       */
  77.   /* <Fields>                                                              */
  78.   /*    xMin :: The horizontal minimum (left-most).                        */
  79.   /*                                                                       */
  80.   /*    yMin :: The vertical minimum (bottom-most).                        */
  81.   /*                                                                       */
  82.   /*    xMax :: The horizontal maximum (right-most).                       */
  83.   /*                                                                       */
  84.   /*    yMax :: The vertical maximum (top-most).                           */
  85.   /*                                                                       */
  86.   typedef struct  FT_BBox_
  87.   {
  88.     FT_Pos  xMin, yMin;
  89.     FT_Pos  xMax, yMax;
  90.   } FT_BBox;
  91.   /*************************************************************************/
  92.   /*                                                                       */
  93.   /* <Enum>                                                                */
  94.   /*    FT_Pixel_Mode                                                      */
  95.   /*                                                                       */
  96.   /* <Description>                                                         */
  97.   /*    An enumeration type used to describe the format of pixels in a     */
  98.   /*    given bitmap.  Note that additional formats may be added in the    */
  99.   /*    future.                                                            */
  100.   /*                                                                       */
  101.   /* <Values>                                                              */
  102.   /*    FT_PIXEL_MODE_NONE ::                                              */
  103.   /*      Value 0 is reserved.                                             */
  104.   /*                                                                       */
  105.   /*    FT_PIXEL_MODE_MONO ::                                              */
  106.   /*      A monochrome bitmap, using 1 bit per pixel.  Note that pixels    */
  107.   /*      are stored in most-significant order (MSB), which means that     */
  108.   /*      the left-most pixel in a byte has value 128.                     */
  109.   /*                                                                       */
  110.   /*    FT_PIXEL_MODE_GRAY ::                                              */
  111.   /*      An 8-bit bitmap, generally used to represent anti-aliased glyph  */
  112.   /*      images.  Each pixel is stored in one byte.  Note that the number */
  113.   /*      of value `gray' levels is stored in the `num_bytes' field of     */
  114.   /*      the @FT_Bitmap structure (it generally is 256).                  */
  115.   /*                                                                       */
  116.   /*    FT_PIXEL_MODE_GRAY2 ::                                             */
  117.   /*      A 2-bit/pixel bitmap, used to represent embedded anti-aliased    */
  118.   /*      bitmaps in font files according to the OpenType specification.   */
  119.   /*      We haven't found a single font using this format, however.       */
  120.   /*                                                                       */
  121.   /*    FT_PIXEL_MODE_GRAY4 ::                                             */
  122.   /*      A 4-bit/pixel bitmap, used to represent embedded anti-aliased    */
  123.   /*      bitmaps in font files according to the OpenType specification.   */
  124.   /*      We haven't found a single font using this format, however.       */
  125.   /*                                                                       */
  126.   /*    FT_PIXEL_MODE_LCD ::                                               */
  127.   /*      An 8-bit bitmap, used to represent RGB or BGR decimated glyph    */
  128.   /*      images used for display on LCD displays; the bitmap is three     */
  129.   /*      times wider than the original glyph image.  See also             */
  130.   /*      @FT_RENDER_MODE_LCD.                                             */
  131.   /*                                                                       */
  132.   /*    FT_PIXEL_MODE_LCD_V ::                                             */
  133.   /*      An 8-bit bitmap, used to represent RGB or BGR decimated glyph    */
  134.   /*      images used for display on rotated LCD displays; the bitmap      */
  135.   /*      is three times taller than the original glyph image.  See also   */
  136.   /*      @FT_RENDER_MODE_LCD_V.                                           */
  137.   /*                                                                       */
  138.   typedef enum  FT_Pixel_Mode_
  139.   {
  140.     FT_PIXEL_MODE_NONE = 0,
  141.     FT_PIXEL_MODE_MONO,
  142.     FT_PIXEL_MODE_GRAY,
  143.     FT_PIXEL_MODE_GRAY2,
  144.     FT_PIXEL_MODE_GRAY4,
  145.     FT_PIXEL_MODE_LCD,
  146.     FT_PIXEL_MODE_LCD_V,
  147.     FT_PIXEL_MODE_MAX      /* do not remove */
  148.   } FT_Pixel_Mode;
  149.   /*************************************************************************/
  150.   /*                                                                       */
  151.   /* <Enum>                                                                */
  152.   /*    ft_pixel_mode_xxx                                                  */
  153.   /*                                                                       */
  154.   /* <Description>                                                         */
  155.   /*    A list of deprecated constants.  Use the corresponding             */
  156.   /*    @FT_Pixel_Mode values instead.                                     */
  157.   /*                                                                       */
  158.   /* <Values>                                                              */
  159.   /*    ft_pixel_mode_none  :: See @FT_PIXEL_MODE_NONE.                    */
  160.   /*    ft_pixel_mode_mono  :: See @FT_PIXEL_MODE_MONO.                    */
  161.   /*    ft_pixel_mode_grays :: See @FT_PIXEL_MODE_GRAY.                    */
  162.   /*    ft_pixel_mode_pal2  :: See @FT_PIXEL_MODE_GRAY2.                   */
  163.   /*    ft_pixel_mode_pal4  :: See @FT_PIXEL_MODE_GRAY4.                   */
  164.   /*                                                                       */
  165. #define ft_pixel_mode_none   FT_PIXEL_MODE_NONE
  166. #define ft_pixel_mode_mono   FT_PIXEL_MODE_MONO
  167. #define ft_pixel_mode_grays  FT_PIXEL_MODE_GRAY
  168. #define ft_pixel_mode_pal2   FT_PIXEL_MODE_GRAY2
  169. #define ft_pixel_mode_pal4   FT_PIXEL_MODE_GRAY4
  170.  /* */
  171. #if 0
  172.   /*************************************************************************/
  173.   /*                                                                       */
  174.   /* <Enum>                                                                */
  175.   /*    FT_Palette_Mode                                                    */
  176.   /*                                                                       */
  177.   /* <Description>                                                         */
  178.   /*    THIS TYPE IS DEPRECATED.  DO NOT USE IT!                           */
  179.   /*                                                                       */
  180.   /*    An enumeration type to describe the format of a bitmap palette,    */
  181.   /*    used with ft_pixel_mode_pal4 and ft_pixel_mode_pal8.               */
  182.   /*                                                                       */
  183.   /* <Fields>                                                              */
  184.   /*    ft_palette_mode_rgb  :: The palette is an array of 3-bytes RGB     */
  185.   /*                            records.                                   */
  186.   /*                                                                       */
  187.   /*    ft_palette_mode_rgba :: The palette is an array of 4-bytes RGBA    */
  188.   /*                            records.                                   */
  189.   /*                                                                       */
  190.   /* <Note>                                                                */
  191.   /*    As ft_pixel_mode_pal2, pal4 and pal8 are currently unused by       */
  192.   /*    FreeType, these types are not handled by the library itself.       */
  193.   /*                                                                       */
  194.   typedef enum  FT_Palette_Mode_
  195.   {
  196.     ft_palette_mode_rgb = 0,
  197.     ft_palette_mode_rgba,
  198.     ft_palettte_mode_max   /* do not remove */
  199.   } FT_Palette_Mode;
  200.   /* */
  201. #endif
  202.   /*************************************************************************/
  203.   /*                                                                       */
  204.   /* <Struct>                                                              */
  205.   /*    FT_Bitmap                                                          */
  206.   /*                                                                       */
  207.   /* <Description>                                                         */
  208.   /*    A structure used to describe a bitmap or pixmap to the raster.     */
  209.   /*    Note that we now manage pixmaps of various depths through the      */
  210.   /*    `pixel_mode' field.                                                */
  211.   /*                                                                       */
  212.   /* <Fields>                                                              */
  213.   /*    rows         :: The number of bitmap rows.                         */
  214.   /*                                                                       */
  215.   /*    width        :: The number of pixels in bitmap row.                */
  216.   /*                                                                       */
  217.   /*    pitch        :: The pitch's absolute value is the number of bytes  */
  218.   /*                    taken by one bitmap row, including padding.        */
  219.   /*                    However, the pitch is positive when the bitmap has */
  220.   /*                    a `down' flow, and negative when it has an `up'    */
  221.   /*                    flow.  In all cases, the pitch is an offset to add */
  222.   /*                    to a bitmap pointer in order to go down one row.   */
  223.   /*                                                                       */
  224.   /*    buffer       :: A typeless pointer to the bitmap buffer.  This     */
  225.   /*                    value should be aligned on 32-bit boundaries in    */
  226.   /*                    most cases.                                        */
  227.   /*                                                                       */
  228.   /*    num_grays    :: This field is only used with                       */
  229.   /*                    @FT_PIXEL_MODE_GRAY; it gives the number of gray   */
  230.   /*                    levels used in the bitmap.                         */
  231.   /*                                                                       */
  232.   /*    pixel_mode   :: The pixel mode, i.e., how pixel bits are stored.   */
  233.   /*                    See @FT_Pixel_Mode for possible values.            */
  234.   /*                                                                       */
  235.   /*    palette_mode :: This field is intended for paletted pixel modes;   */
  236.   /*                    it indicates how the palette is stored.  Not       */
  237.   /*                    used currently.                                    */
  238.   /*                                                                       */
  239.   /*    palette      :: A typeless pointer to the bitmap palette; this     */
  240.   /*                    field is intended for paletted pixel modes.  Not   */
  241.   /*                    used currently.                                    */
  242.   /*                                                                       */
  243.   /* <Note>                                                                */
  244.   /*   For now, the only pixel modes supported by FreeType are mono and    */
  245.   /*   grays.  However, drivers might be added in the future to support    */
  246.   /*   more `colorful' options.                                            */
  247.   /*                                                                       */
  248.   typedef struct  FT_Bitmap_
  249.   {
  250.     int             rows;
  251.     int             width;
  252.     int             pitch;
  253.     unsigned char*  buffer;
  254.     short           num_grays;
  255.     char            pixel_mode;
  256.     char            palette_mode;
  257.     void*           palette;
  258.   } FT_Bitmap;
  259.   /*************************************************************************/
  260.   /*                                                                       */
  261.   /* <Section>                                                             */
  262.   /*    outline_processing                                                 */
  263.   /*                                                                       */
  264.   /*************************************************************************/
  265.   /*************************************************************************/
  266.   /*                                                                       */
  267.   /* <Struct>                                                              */
  268.   /*    FT_Outline                                                         */
  269.   /*                                                                       */
  270.   /* <Description>                                                         */
  271.   /*    This structure is used to describe an outline to the scan-line     */
  272.   /*    converter.                                                         */
  273.   /*                                                                       */
  274.   /* <Fields>                                                              */
  275.   /*    n_contours :: The number of contours in the outline.               */
  276.   /*                                                                       */
  277.   /*    n_points   :: The number of points in the outline.                 */
  278.   /*                                                                       */
  279.   /*    points     :: A pointer to an array of `n_points' @FT_Vector       */
  280.   /*                  elements, giving the outline's point coordinates.    */
  281.   /*                                                                       */
  282.   /*    tags       :: A pointer to an array of `n_points' chars, giving    */
  283.   /*                  each outline point's type.  If bit 0 is unset, the   */
  284.   /*                  point is `off' the curve, i.e., a Bézier control     */
  285.   /*                  point, while it is `on' when set.                    */
  286.   /*                                                                       */
  287.   /*                  Bit 1 is meaningful for `off' points only.  If set,  */
  288.   /*                  it indicates a third-order Bézier arc control point; */
  289.   /*                  and a second-order control point if unset.           */
  290.   /*                                                                       */
  291.   /*    contours   :: An array of `n_contours' shorts, giving the end      */
  292.   /*                  point of each contour within the outline.  For       */
  293.   /*                  example, the first contour is defined by the points  */
  294.   /*                  `0' to `contours[0]', the second one is defined by   */
  295.   /*                  the points `contours[0]+1' to `contours[1]', etc.    */
  296.   /*                                                                       */
  297.   /*    flags      :: A set of bit flags used to characterize the outline  */
  298.   /*                  and give hints to the scan-converter and hinter on   */
  299.   /*                  how to convert/grid-fit it.  See @FT_OUTLINE_FLAGS.  */
  300.   /*                                                                       */
  301.   typedef struct  FT_Outline_
  302.   {
  303.     short       n_contours;      /* number of contours in glyph        */
  304.     short       n_points;        /* number of points in the glyph      */
  305.     FT_Vector*  points;          /* the outline's points               */
  306.     char*       tags;            /* the points flags                   */
  307.     short*      contours;        /* the contour end points             */
  308.     int         flags;           /* outline masks                      */
  309.   } FT_Outline;
  310.   /*************************************************************************/
  311.   /*                                                                       */
  312.   /* <Enum>                                                                */
  313.   /*   FT_OUTLINE_FLAGS                                                    */
  314.   /*                                                                       */
  315.   /* <Description>                                                         */
  316.   /*    A list of bit-field constants use for the flags in an outline's    */
  317.   /*    `flags' field.                                                     */
  318.   /*                                                                       */
  319.   /* <Values>                                                              */
  320.   /*    FT_OUTLINE_NONE           :: Value 0 is reserved.                  */
  321.   /*                                                                       */
  322.   /*    FT_OUTLINE_OWNER          :: If set, this flag indicates that the  */
  323.   /*                                 outline's field arrays (i.e.,         */
  324.   /*                                 `points', `flags' & `contours') are   */
  325.   /*                                 `owned' by the outline object, and    */
  326.   /*                                 should thus be freed when it is       */
  327.   /*                                 destroyed.                            */
  328.   /*                                                                       */
  329.   /*   FT_OUTLINE_EVEN_ODD_FILL   :: By default, outlines are filled using */
  330.   /*                                 the non-zero winding rule.  If set to */
  331.   /*                                 1, the outline will be filled using   */
  332.   /*                                 the even-odd fill rule (only works    */
  333.   /*                                 with the smooth raster).              */
  334.   /*                                                                       */
  335.   /*   FT_OUTLINE_REVERSE_FILL    :: By default, outside contours of an    */
  336.   /*                                 outline are oriented in clock-wise    */
  337.   /*                                 direction, as defined in the TrueType */
  338.   /*                                 specification.  This flag is set if   */
  339.   /*                                 the outline uses the opposite         */
  340.   /*                                 direction (typically for Type 1       */
  341.   /*                                 fonts).  This flag is ignored by the  */
  342.   /*                                 scan-converter.                       */
  343.   /*                                                                       */
  344.   /*   FT_OUTLINE_IGNORE_DROPOUTS :: By default, the scan converter will   */
  345.   /*                                 try to detect drop-outs in an outline */
  346.   /*                                 and correct the glyph bitmap to       */
  347.   /*                                 ensure consistent shape continuity.   */
  348.   /*                                 If set, this flag hints the scan-line */
  349.   /*                                 converter to ignore such cases.       */
  350.   /*                                                                       */
  351.   /*   FT_OUTLINE_HIGH_PRECISION  :: This flag indicates that the          */
  352.   /*                                 scan-line converter should try to     */
  353.   /*                                 convert this outline to bitmaps with  */
  354.   /*                                 the highest possible quality.  It is  */
  355.   /*                                 typically set for small character     */
  356.   /*                                 sizes.  Note that this is only a      */
  357.   /*                                 hint, that might be completely        */
  358.   /*                                 ignored by a given scan-converter.    */
  359.   /*                                                                       */
  360.   /*   FT_OUTLINE_SINGLE_PASS     :: This flag is set to force a given     */
  361.   /*                                 scan-converter to only use a single   */
  362.   /*                                 pass over the outline to render a     */
  363.   /*                                 bitmap glyph image.  Normally, it is  */
  364.   /*                                 set for very large character sizes.   */
  365.   /*                                 It is only a hint, that might be      */
  366.   /*                                 completely ignored by a given         */
  367.   /*                                 scan-converter.                       */
  368.   /*                                                                       */
  369. #define FT_OUTLINE_NONE             0x0
  370. #define FT_OUTLINE_OWNER            0x1
  371. #define FT_OUTLINE_EVEN_ODD_FILL    0x2
  372. #define FT_OUTLINE_REVERSE_FILL     0x4
  373. #define FT_OUTLINE_IGNORE_DROPOUTS  0x8
  374. #define FT_OUTLINE_HIGH_PRECISION   0x100
  375. #define FT_OUTLINE_SINGLE_PASS      0x200
  376.  /*************************************************************************
  377.   *
  378.   * @enum:
  379.   *   ft_outline_flags
  380.   *
  381.   * @description:
  382.   *   These constants are deprecated.  Please use the corresponding
  383.   *   @FT_OUTLINE_FLAGS values.
  384.   *
  385.   * @values:
  386.   *   ft_outline_none            :: See @FT_OUTLINE_NONE.
  387.   *   ft_outline_owner           :: See @FT_OUTLINE_OWNER.
  388.   *   ft_outline_even_odd_fill   :: See @FT_OUTLINE_EVEN_ODD_FILL.
  389.   *   ft_outline_reverse_fill    :: See @FT_OUTLINE_REVERSE_FILL.
  390.   *   ft_outline_ignore_dropouts :: See @FT_OUTLINE_IGNORE_DROPOUTS.
  391.   *   ft_outline_high_precision  :: See @FT_OUTLINE_HIGH_PRECISION.
  392.   *   ft_outline_single_pass     :: See @FT_OUTLINE_SINGLE_PASS.
  393.   */
  394. #define ft_outline_none             FT_OUTLINE_NONE
  395. #define ft_outline_owner            FT_OUTLINE_OWNER
  396. #define ft_outline_even_odd_fill    FT_OUTLINE_EVEN_ODD_FILL
  397. #define ft_outline_reverse_fill     FT_OUTLINE_REVERSE_FILL
  398. #define ft_outline_ignore_dropouts  FT_OUTLINE_IGNORE_DROPOUTS
  399. #define ft_outline_high_precision   FT_OUTLINE_HIGH_PRECISION
  400. #define ft_outline_single_pass      FT_OUTLINE_SINGLE_PASS
  401.   /* */
  402. #define FT_CURVE_TAG( flag )  ( flag & 3 )
  403. #define FT_CURVE_TAG_ON           1
  404. #define FT_CURVE_TAG_CONIC        0
  405. #define FT_CURVE_TAG_CUBIC        2
  406. #define FT_CURVE_TAG_TOUCH_X      8  /* reserved for the TrueType hinter */
  407. #define FT_CURVE_TAG_TOUCH_Y     16  /* reserved for the TrueType hinter */
  408. #define FT_CURVE_TAG_TOUCH_BOTH  ( FT_CURVE_TAG_TOUCH_X | 
  409.                                    FT_CURVE_TAG_TOUCH_Y )
  410. #define  FT_Curve_Tag_On       FT_CURVE_TAG_ON
  411. #define  FT_Curve_Tag_Conic    FT_CURVE_TAG_CONIC
  412. #define  FT_Curve_Tag_Cubic    FT_CURVE_TAG_CUBIC
  413. #define  FT_Curve_Tag_Touch_X  FT_CURVE_TAG_TOUCH_X
  414. #define  FT_Curve_Tag_Touch_Y  FT_CURVE_TAG_TOUCH_Y
  415.   /*************************************************************************/
  416.   /*                                                                       */
  417.   /* <FuncType>                                                            */
  418.   /*    FT_Outline_MoveToFunc                                              */
  419.   /*                                                                       */
  420.   /* <Description>                                                         */
  421.   /*    A function pointer type used to describe the signature of a `move  */
  422.   /*    to' function during outline walking/decomposition.                 */
  423.   /*                                                                       */
  424.   /*    A `move to' is emitted to start a new contour in an outline.       */
  425.   /*                                                                       */
  426.   /* <Input>                                                               */
  427.   /*    to   :: A pointer to the target point of the `move to'.            */
  428.   /*                                                                       */
  429.   /*    user :: A typeless pointer which is passed from the caller of the  */
  430.   /*            decomposition function.                                    */
  431.   /*                                                                       */
  432.   /* <Return>                                                              */
  433.   /*    Error code.  0 means success.                                      */
  434.   /*                                                                       */
  435.   typedef int
  436.   (*FT_Outline_MoveToFunc)( const FT_Vector*  to,
  437.                             void*             user );
  438. #define FT_Outline_MoveTo_Func  FT_Outline_MoveToFunc
  439.   /*************************************************************************/
  440.   /*                                                                       */
  441.   /* <FuncType>                                                            */
  442.   /*    FT_Outline_LineToFunc                                              */
  443.   /*                                                                       */
  444.   /* <Description>                                                         */
  445.   /*    A function pointer type used to describe the signature of a `line  */
  446.   /*    to' function during outline walking/decomposition.                 */
  447.   /*                                                                       */
  448.   /*    A `line to' is emitted to indicate a segment in the outline.       */
  449.   /*                                                                       */
  450.   /* <Input>                                                               */
  451.   /*    to   :: A pointer to the target point of the `line to'.            */
  452.   /*                                                                       */
  453.   /*    user :: A typeless pointer which is passed from the caller of the  */
  454.   /*            decomposition function.                                    */
  455.   /*                                                                       */
  456.   /* <Return>                                                              */
  457.   /*    Error code.  0 means success.                                      */
  458.   /*                                                                       */
  459.   typedef int
  460.   (*FT_Outline_LineToFunc)( const FT_Vector*  to,
  461.                             void*             user );
  462. #define  FT_Outline_LineTo_Func  FT_Outline_LineToFunc
  463.   /*************************************************************************/
  464.   /*                                                                       */
  465.   /* <FuncType>                                                            */
  466.   /*    FT_Outline_ConicToFunc                                             */
  467.   /*                                                                       */
  468.   /* <Description>                                                         */
  469.   /*    A function pointer type use to describe the signature of a `conic  */
  470.   /*    to' function during outline walking/decomposition.                 */
  471.   /*                                                                       */
  472.   /*    A `conic to' is emitted to indicate a second-order Bézier arc in   */
  473.   /*    the outline.                                                       */
  474.   /*                                                                       */
  475.   /* <Input>                                                               */
  476.   /*    control :: An intermediate control point between the last position */
  477.   /*               and the new target in `to'.                             */
  478.   /*                                                                       */
  479.   /*    to      :: A pointer to the target end point of the conic arc.     */
  480.   /*                                                                       */
  481.   /*    user    :: A typeless pointer which is passed from the caller of   */
  482.   /*               the decomposition function.                             */
  483.   /*                                                                       */
  484.   /* <Return>                                                              */
  485.   /*    Error code.  0 means success.                                      */
  486.   /*                                                                       */
  487.   typedef int
  488.   (*FT_Outline_ConicToFunc)( const FT_Vector*  control,
  489.                              const FT_Vector*  to,
  490.                              void*             user );
  491. #define  FT_Outline_ConicTo_Func  FT_Outline_ConicToFunc
  492.   /*************************************************************************/
  493.   /*                                                                       */
  494.   /* <FuncType>                                                            */
  495.   /*    FT_Outline_CubicToFunc                                             */
  496.   /*                                                                       */
  497.   /* <Description>                                                         */
  498.   /*    A function pointer type used to describe the signature of a `cubic */
  499.   /*    to' function during outline walking/decomposition.                 */
  500.   /*                                                                       */
  501.   /*    A `cubic to' is emitted to indicate a third-order Bézier arc.      */
  502.   /*                                                                       */
  503.   /* <Input>                                                               */
  504.   /*    control1 :: A pointer to the first Bézier control point.           */
  505.   /*                                                                       */
  506.   /*    control2 :: A pointer to the second Bézier control point.          */
  507.   /*                                                                       */
  508.   /*    to       :: A pointer to the target end point.                     */
  509.   /*                                                                       */
  510.   /*    user     :: A typeless pointer which is passed from the caller of  */
  511.   /*                the decomposition function.                            */
  512.   /*                                                                       */
  513.   /* <Return>                                                              */
  514.   /*    Error code.  0 means success.                                      */
  515.   /*                                                                       */
  516.   typedef int
  517.   (*FT_Outline_CubicToFunc)( const FT_Vector*  control1,
  518.                              const FT_Vector*  control2,
  519.                              const FT_Vector*  to,
  520.                              void*             user );
  521. #define  FT_Outline_CubicTo_Func  FT_Outline_CubicToFunc
  522.   /*************************************************************************/
  523.   /*                                                                       */
  524.   /* <Struct>                                                              */
  525.   /*    FT_Outline_Funcs                                                   */
  526.   /*                                                                       */
  527.   /* <Description>                                                         */
  528.   /*    A structure to hold various function pointers used during outline  */
  529.   /*    decomposition in order to emit segments, conic, and cubic Béziers, */
  530.   /*    as well as `move to' and `close to' operations.                    */
  531.   /*                                                                       */
  532.   /* <Fields>                                                              */
  533.   /*    move_to  :: The `move to' emitter.                                 */
  534.   /*                                                                       */
  535.   /*    line_to  :: The segment emitter.                                   */
  536.   /*                                                                       */
  537.   /*    conic_to :: The second-order Bézier arc emitter.                   */
  538.   /*                                                                       */
  539.   /*    cubic_to :: The third-order Bézier arc emitter.                    */
  540.   /*                                                                       */
  541.   /*    shift    :: The shift that is applied to coordinates before they   */
  542.   /*                are sent to the emitter.                               */
  543.   /*                                                                       */
  544.   /*    delta    :: The delta that is applied to coordinates before they   */
  545.   /*                are sent to the emitter, but after the shift.          */
  546.   /*                                                                       */
  547.   /* <Note>                                                                */
  548.   /*    The point coordinates sent to the emitters are the transformed     */
  549.   /*    version of the original coordinates (this is important for high    */
  550.   /*    accuracy during scan-conversion).  The transformation is simple:   */
  551.   /*                                                                       */
  552.   /*    {                                                                  */
  553.   /*      x' = (x << shift) - delta                                        */
  554.   /*      y' = (x << shift) - delta                                        */
  555.   /*    }                                                                  */
  556.   /*                                                                       */
  557.   /*    Set the value of `shift' and `delta' to 0 to get the original      */
  558.   /*    point coordinates.                                                 */
  559.   /*                                                                       */
  560.   typedef struct  FT_Outline_Funcs_
  561.   {
  562.     FT_Outline_MoveToFunc   move_to;
  563.     FT_Outline_LineToFunc   line_to;
  564.     FT_Outline_ConicToFunc  conic_to;
  565.     FT_Outline_CubicToFunc  cubic_to;
  566.     int                     shift;
  567.     FT_Pos                  delta;
  568.   } FT_Outline_Funcs;
  569.   /*************************************************************************/
  570.   /*                                                                       */
  571.   /* <Section>                                                             */
  572.   /*    basic_types                                                        */
  573.   /*                                                                       */
  574.   /*************************************************************************/
  575.   /*************************************************************************/
  576.   /*                                                                       */
  577.   /* <Macro>                                                               */
  578.   /*    FT_IMAGE_TAG                                                       */
  579.   /*                                                                       */
  580.   /* <Description>                                                         */
  581.   /*    This macro converts four-letter tags to an unsigned long type.     */
  582.   /*                                                                       */
  583.   /* <Note>                                                                */
  584.   /*    Since many 16bit compilers don't like 32bit enumerations, you      */
  585.   /*    should redefine this macro in case of problems to something like   */
  586.   /*    this:                                                              */
  587.   /*                                                                       */
  588.   /*    {                                                                  */
  589.   /*      #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 )  value         */
  590.   /*    }                                                                  */
  591.   /*                                                                       */
  592.   /*    to get a simple enumeration without assigning special numbers.     */
  593.   /*                                                                       */
  594. #ifndef FT_IMAGE_TAG
  595. #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 )  
  596.           value = ( ( (unsigned long)_x1 << 24 ) | 
  597.                     ( (unsigned long)_x2 << 16 ) | 
  598.                     ( (unsigned long)_x3 << 8  ) | 
  599.                       (unsigned long)_x4         )
  600. #endif /* FT_IMAGE_TAG */
  601.   /*************************************************************************/
  602.   /*                                                                       */
  603.   /* <Enum>                                                                */
  604.   /*    FT_Glyph_Format                                                    */
  605.   /*                                                                       */
  606.   /* <Description>                                                         */
  607.   /*    An enumeration type used to describe the format of a given glyph   */
  608.   /*    image.  Note that this version of FreeType only supports two image */
  609.   /*    formats, even though future font drivers will be able to register  */
  610.   /*    their own format.                                                  */
  611.   /*                                                                       */
  612.   /* <Values>                                                              */
  613.   /*    FT_GLYPH_FORMAT_NONE ::                                            */
  614.   /*      The value 0 is reserved.                                         */
  615.   /*                                                                       */
  616.   /*    FT_GLYPH_FORMAT_COMPOSITE ::                                       */
  617.   /*      The glyph image is a composite of several other images.  This    */
  618.   /*      format is _only_ used with @FT_LOAD_NO_RECURSE, and is used to   */
  619.   /*      report compound glyphs (like accented characters).               */
  620.   /*                                                                       */
  621.   /*    FT_GLYPH_FORMAT_BITMAP ::                                          */
  622.   /*      The glyph image is a bitmap, and can be described as an          */
  623.   /*      @FT_Bitmap.  You generally need to access the `bitmap' field of  */
  624.   /*      the @FT_GlyphSlotRec structure to read it.                       */
  625.   /*                                                                       */
  626.   /*    FT_GLYPH_FORMAT_OUTLINE ::                                         */
  627.   /*      The glyph image is a vectorial outline made of line segments     */
  628.   /*      and Bézier arcs; it can be described as an @FT_Outline; you      */
  629.   /*      generally want to access the `outline' field of the              */
  630.   /*      @FT_GlyphSlotRec structure to read it.                           */
  631.   /*                                                                       */
  632.   /*    FT_GLYPH_FORMAT_PLOTTER ::                                         */
  633.   /*      The glyph image is a vectorial path with no inside and outside   */
  634.   /*      contours.  Some Type 1 fonts, like those in the Hershey family,  */
  635.   /*      contain glyphs in this format.  These are described as           */
  636.   /*      @FT_Outline, but FreeType isn't currently capable of rendering   */
  637.   /*      them correctly.                                                  */
  638.   /*                                                                       */
  639.   typedef enum  FT_Glyph_Format_
  640.   {
  641.     FT_IMAGE_TAG( FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0 ),
  642.     FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ),
  643.     FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP,    'b', 'i', 't', 's' ),
  644.     FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE,   'o', 'u', 't', 'l' ),
  645.     FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER,   'p', 'l', 'o', 't' )
  646.   } FT_Glyph_Format;
  647.   /*************************************************************************/
  648.   /*                                                                       */
  649.   /* <Enum>                                                                */
  650.   /*    ft_glyph_format_xxx                                                */
  651.   /*                                                                       */
  652.   /* <Description>                                                         */
  653.   /*    A list of deprecated constants.  Use the corresponding             */
  654.   /*    @FT_Glyph_Format values instead.                                   */
  655.   /*                                                                       */
  656.   /* <Values>                                                              */
  657.   /*    ft_glyph_format_none      :: See @FT_GLYPH_FORMAT_NONE.            */
  658.   /*    ft_glyph_format_composite :: See @FT_GLYPH_FORMAT_COMPOSITE.       */
  659.   /*    ft_glyph_format_bitmap    :: See @FT_GLYPH_FORMAT_BITMAP.          */
  660.   /*    ft_glyph_format_outline   :: See @FT_GLYPH_FORMAT_OUTLINE.         */
  661.   /*    ft_glyph_format_plotter   :: See @FT_GLYPH_FORMAT_PLOTTER.         */
  662.   /*                                                                       */
  663. #define ft_glyph_format_none       FT_GLYPH_FORMAT_NONE
  664. #define ft_glyph_format_composite  FT_GLYPH_FORMAT_COMPOSITE
  665. #define ft_glyph_format_bitmap     FT_GLYPH_FORMAT_BITMAP
  666. #define ft_glyph_format_outline    FT_GLYPH_FORMAT_OUTLINE
  667. #define ft_glyph_format_plotter    FT_GLYPH_FORMAT_PLOTTER
  668.   /*************************************************************************/
  669.   /*************************************************************************/
  670.   /*************************************************************************/
  671.   /*****                                                               *****/
  672.   /*****            R A S T E R   D E F I N I T I O N S                *****/
  673.   /*****                                                               *****/
  674.   /*************************************************************************/
  675.   /*************************************************************************/
  676.   /*************************************************************************/
  677.   /*************************************************************************/
  678.   /*                                                                       */
  679.   /* A raster is a scan converter, in charge of rendering an outline into  */
  680.   /* a a bitmap.  This section contains the public API for rasters.        */
  681.   /*                                                                       */
  682.   /* Note that in FreeType 2, all rasters are now encapsulated within      */
  683.   /* specific modules called `renderers'.  See `freetype/ftrender.h' for   */
  684.   /* more details on renderers.                                            */
  685.   /*                                                                       */
  686.   /*************************************************************************/
  687.   /*************************************************************************/
  688.   /*                                                                       */
  689.   /* <Section>                                                             */
  690.   /*    raster                                                             */
  691.   /*                                                                       */
  692.   /* <Title>                                                               */
  693.   /*    Scanline Converter                                                 */
  694.   /*                                                                       */
  695.   /* <Abstract>                                                            */
  696.   /*    How vectorial outlines are converted into bitmaps and pixmaps.     */
  697.   /*                                                                       */
  698.   /* <Description>                                                         */
  699.   /*    This section contains technical definitions.                       */
  700.   /*                                                                       */
  701.   /*************************************************************************/
  702.   /*************************************************************************/
  703.   /*                                                                       */
  704.   /* <Type>                                                                */
  705.   /*    FT_Raster                                                          */
  706.   /*                                                                       */
  707.   /* <Description>                                                         */
  708.   /*    A handle (pointer) to a raster object.  Each object can be used    */
  709.   /*    independently to convert an outline into a bitmap or pixmap.       */
  710.   /*                                                                       */
  711.   typedef struct FT_RasterRec_*  FT_Raster;
  712.   /*************************************************************************/
  713.   /*                                                                       */
  714.   /* <Struct>                                                              */
  715.   /*    FT_Span                                                            */
  716.   /*                                                                       */
  717.   /* <Description>                                                         */
  718.   /*    A structure used to model a single span of gray (or black) pixels  */
  719.   /*    when rendering a monochrome or anti-aliased bitmap.                */
  720.   /*                                                                       */
  721.   /* <Fields>                                                              */
  722.   /*    x        :: The span's horizontal start position.                  */
  723.   /*                                                                       */
  724.   /*    len      :: The span's length in pixels.                           */
  725.   /*                                                                       */
  726.   /*    coverage :: The span color/coverage, ranging from 0 (background)   */
  727.   /*                to 255 (foreground).  Only used for anti-aliased       */
  728.   /*                rendering.                                             */
  729.   /*                                                                       */
  730.   /* <Note>                                                                */
  731.   /*    This structure is used by the span drawing callback type named     */
  732.   /*    @FT_SpanFunc which takes the y-coordinate of the span as a         */
  733.   /*    a parameter.                                                       */
  734.   /*                                                                       */
  735.   /*    The coverage value is always between 0 and 255.                    */
  736.   /*                                                                       */
  737.   typedef struct  FT_Span_
  738.   {
  739.     short           x;
  740.     unsigned short  len;
  741.     unsigned char   coverage;
  742.   } FT_Span;
  743.   /*************************************************************************/
  744.   /*                                                                       */
  745.   /* <FuncType>                                                            */
  746.   /*    FT_SpanFunc                                                        */
  747.   /*                                                                       */
  748.   /* <Description>                                                         */
  749.   /*    A function used as a call-back by the anti-aliased renderer in     */
  750.   /*    order to let client applications draw themselves the gray pixel    */
  751.   /*    spans on each scan line.                                           */
  752.   /*                                                                       */
  753.   /* <Input>                                                               */
  754.   /*    y     :: The scanline's y-coordinate.                              */
  755.   /*                                                                       */
  756.   /*    count :: The number of spans to draw on this scanline.             */
  757.   /*                                                                       */
  758.   /*    spans :: A table of `count' spans to draw on the scanline.         */
  759.   /*                                                                       */
  760.   /*    user  :: User-supplied data that is passed to the callback.        */
  761.   /*                                                                       */
  762.   /* <Note>                                                                */
  763.   /*    This callback allows client applications to directly render the    */
  764.   /*    gray spans of the anti-aliased bitmap to any kind of surfaces.     */
  765.   /*                                                                       */
  766.   /*    This can be used to write anti-aliased outlines directly to a      */
  767.   /*    given background bitmap, and even perform translucency.            */
  768.   /*                                                                       */
  769.   /*    Note that the `count' field cannot be greater than a fixed value   */
  770.   /*    defined by the `FT_MAX_GRAY_SPANS' configuration macro in          */
  771.   /*    `ftoption.h'.  By default, this value is set to 32, which means    */
  772.   /*    that if there are more than 32 spans on a given scanline, the      */
  773.   /*    callback is called several times with the same `y' parameter in    */
  774.   /*    order to draw all callbacks.                                       */
  775.   /*                                                                       */
  776.   /*    Otherwise, the callback is only called once per scan-line, and     */
  777.   /*    only for those scanlines that do have `gray' pixels on them.       */
  778.   /*                                                                       */
  779.   typedef void
  780.   (*FT_SpanFunc)( int             y,
  781.                   int             count,
  782.                   const FT_Span*  spans,
  783.                   void*           user );
  784. #define FT_Raster_Span_Func   FT_SpanFunc
  785.   /*************************************************************************/
  786.   /*                                                                       */
  787.   /* <FuncType>                                                            */
  788.   /*    FT_Raster_BitTest_Func                                             */
  789.   /*                                                                       */
  790.   /* <Description>                                                         */
  791.   /*    THIS TYPE IS DEPRECATED.  DO NOT USE IT.                           */
  792.   /*                                                                       */
  793.   /*    A function used as a call-back by the monochrome scan-converter    */
  794.   /*    to test whether a given target pixel is already set to the drawing */
  795.   /*    `color'.  These tests are crucial to implement drop-out control    */
  796.   /*    per-se the TrueType spec.                                          */
  797.   /*                                                                       */
  798.   /* <Input>                                                               */
  799.   /*    y     :: The pixel's y-coordinate.                                 */
  800.   /*                                                                       */
  801.   /*    x     :: The pixel's x-coordinate.                                 */
  802.   /*                                                                       */
  803.   /*    user  :: User-supplied data that is passed to the callback.        */
  804.   /*                                                                       */
  805.   /* <Return>                                                              */
  806.   /*   1 if the pixel is `set', 0 otherwise.                               */
  807.   /*                                                                       */
  808.   typedef int
  809.   (*FT_Raster_BitTest_Func)( int    y,
  810.                              int    x,
  811.                              void*  user );
  812.   /*************************************************************************/
  813.   /*                                                                       */
  814.   /* <FuncType>                                                            */
  815.   /*    FT_Raster_BitSet_Func                                              */
  816.   /*                                                                       */
  817.   /* <Description>                                                         */
  818.   /*    THIS TYPE IS DEPRECATED.  DO NOT USE IT.                           */
  819.   /*                                                                       */
  820.   /*    A function used as a call-back by the monochrome scan-converter    */
  821.   /*    to set an individual target pixel.  This is crucial to implement   */
  822.   /*    drop-out control according to the TrueType specification.          */
  823.   /*                                                                       */
  824.   /* <Input>                                                               */
  825.   /*    y     :: The pixel's y-coordinate.                                 */
  826.   /*                                                                       */
  827.   /*    x     :: The pixel's x-coordinate.                                 */
  828.   /*                                                                       */
  829.   /*    user  :: User-supplied data that is passed to the callback.        */
  830.   /*                                                                       */
  831.   /* <Return>                                                              */
  832.   /*    1 if the pixel is `set', 0 otherwise.                              */
  833.   /*                                                                       */
  834.   typedef void
  835.   (*FT_Raster_BitSet_Func)( int    y,
  836.                             int    x,
  837.                             void*  user );
  838.   /*************************************************************************/
  839.   /*                                                                       */
  840.   /* <Enum>                                                                */
  841.   /*    FT_RASTER_FLAG_XXX                                                 */
  842.   /*                                                                       */
  843.   /* <Description>                                                         */
  844.   /*    A list of bit flag constants as used in the `flags' field of a     */
  845.   /*    @FT_Raster_Params structure.                                       */
  846.   /*                                                                       */
  847.   /* <Values>                                                              */
  848.   /*    FT_RASTER_FLAG_DEFAULT :: This value is 0.                         */
  849.   /*                                                                       */
  850.   /*    FT_RASTER_FLAG_AA      :: This flag is set to indicate that an     */
  851.   /*                              anti-aliased glyph image should be       */
  852.   /*                              generated.  Otherwise, it will be        */
  853.   /*                              monochrome (1-bit).                      */
  854.   /*                                                                       */
  855.   /*    FT_RASTER_FLAG_DIRECT  :: This flag is set to indicate direct      */
  856.   /*                              rendering.  In this mode, client         */
  857.   /*                              applications must provide their own span */
  858.   /*                              callback.  This lets them directly       */
  859.   /*                              draw or compose over an existing bitmap. */
  860.   /*                              If this bit is not set, the target       */
  861.   /*                              pixmap's buffer _must_ be zeroed before  */
  862.   /*                              rendering.                               */
  863.   /*                                                                       */
  864.   /*                              Note that for now, direct rendering is   */
  865.   /*                              only possible with anti-aliased glyphs.  */
  866.   /*                                                                       */
  867.   /*    FT_RASTER_FLAG_CLIP    :: This flag is only used in direct         */
  868.   /*                              rendering mode.  If set, the output will */
  869.   /*                              be clipped to a box specified in the     */
  870.   /*                              `clip_box' field of the                  */
  871.   /*                              @FT_Raster_Params structure.             */
  872.   /*                                                                       */
  873.   /*                              Note that by default, the glyph bitmap   */
  874.   /*                              is clipped to the target pixmap, except  */
  875.   /*                              in direct rendering mode where all spans */
  876.   /*                              are generated if no clipping box is set. */
  877.   /*                                                                       */
  878. #define FT_RASTER_FLAG_DEFAULT  0x0
  879. #define FT_RASTER_FLAG_AA       0x1
  880. #define FT_RASTER_FLAG_DIRECT   0x2
  881. #define FT_RASTER_FLAG_CLIP     0x4
  882.   /* deprecated */
  883. #define ft_raster_flag_default  FT_RASTER_FLAG_DEFAULT
  884. #define ft_raster_flag_aa       FT_RASTER_FLAG_AA
  885. #define ft_raster_flag_direct   FT_RASTER_FLAG_DIRECT
  886. #define ft_raster_flag_clip     FT_RASTER_FLAG_CLIP
  887.   /*************************************************************************/
  888.   /*                                                                       */
  889.   /* <Struct>                                                              */
  890.   /*    FT_Raster_Params                                                   */
  891.   /*                                                                       */
  892.   /* <Description>                                                         */
  893.   /*    A structure to hold the arguments used by a raster's render        */
  894.   /*    function.                                                          */
  895.   /*                                                                       */
  896.   /* <Fields>                                                              */
  897.   /*    target      :: The target bitmap.                                  */
  898.   /*                                                                       */
  899.   /*    source      :: A pointer to the source glyph image (e.g., an       */
  900.   /*                   @FT_Outline).                                       */
  901.   /*                                                                       */
  902.   /*    flags       :: The rendering flags.                                */
  903.   /*                                                                       */
  904.   /*    gray_spans  :: The gray span drawing callback.                     */
  905.   /*                                                                       */
  906.   /*    black_spans :: The black span drawing callback.                    */
  907.   /*                                                                       */
  908.   /*    bit_test    :: The bit test callback.  UNIMPLEMENTED!              */
  909.   /*                                                                       */
  910.   /*    bit_set     :: The bit set callback.  UNIMPLEMENTED!               */
  911.   /*                                                                       */
  912.   /*    user        :: User-supplied data that is passed to each drawing   */
  913.   /*                   callback.                                           */
  914.   /*                                                                       */
  915.   /*    clip_box    :: An optional clipping box.  It is only used in       */
  916.   /*                   direct rendering mode.  Note that coordinates here  */
  917.   /*                   should be expressed in _integer_ pixels (and not in */
  918.   /*                   26.6 fixed-point units).                            */
  919.   /*                                                                       */
  920.   /* <Note>                                                                */
  921.   /*    An anti-aliased glyph bitmap is drawn if the @FT_RASTER_FLAG_AA    */
  922.   /*    bit flag is set in the `flags' field, otherwise a monochrome       */
  923.   /*    bitmap is generated.                                               */
  924.   /*                                                                       */
  925.   /*    If the @FT_RASTER_FLAG_DIRECT bit flag is set in `flags', the      */
  926.   /*    raster will call the `gray_spans' callback to draw gray pixel      */
  927.   /*    spans, in the case of an aa glyph bitmap, it will call             */
  928.   /*    `black_spans', and `bit_test' and `bit_set' in the case of a       */
  929.   /*    monochrome bitmap.  This allows direct composition over a          */
  930.   /*    pre-existing bitmap through user-provided callbacks to perform the */
  931.   /*    span drawing/composition.                                          */
  932.   /*                                                                       */
  933.   /*    Note that the `bit_test' and `bit_set' callbacks are required when */
  934.   /*    rendering a monochrome bitmap, as they are crucial to implement    */
  935.   /*    correct drop-out control as defined in the TrueType specification. */
  936.   /*                                                                       */
  937.   typedef struct  FT_Raster_Params_
  938.   {
  939.     const FT_Bitmap*        target;
  940.     const void*             source;
  941.     int                     flags;
  942.     FT_SpanFunc             gray_spans;
  943.     FT_SpanFunc             black_spans;
  944.     FT_Raster_BitTest_Func  bit_test;     /* doesn't work! */
  945.     FT_Raster_BitSet_Func   bit_set;      /* doesn't work! */
  946.     void*                   user;
  947.     FT_BBox                 clip_box;
  948.   } FT_Raster_Params;
  949.   /*************************************************************************/
  950.   /*                                                                       */
  951.   /* <FuncType>                                                            */
  952.   /*    FT_Raster_NewFunc                                                  */
  953.   /*                                                                       */
  954.   /* <Description>                                                         */
  955.   /*    A function used to create a new raster object.                     */
  956.   /*                                                                       */
  957.   /* <Input>                                                               */
  958.   /*    memory :: A handle to the memory allocator.                        */
  959.   /*                                                                       */
  960.   /* <Output>                                                              */
  961.   /*    raster :: A handle to the new raster object.                       */
  962.   /*                                                                       */
  963.   /* <Return>                                                              */
  964.   /*    Error code.  0 means success.                                      */
  965.   /*                                                                       */
  966.   /* <Note>                                                                */
  967.   /*    The `memory' parameter is a typeless pointer in order to avoid     */
  968.   /*    un-wanted dependencies on the rest of the FreeType code.  In       */
  969.   /*    practice, it is an @FT_Memory object, i.e., a handle to the        */
  970.   /*    standard FreeType memory allocator.  However, this field can be    */
  971.   /*    completely ignored by a given raster implementation.               */
  972.   /*                                                                       */
  973.   typedef int
  974.   (*FT_Raster_NewFunc)( void*       memory,
  975.                         FT_Raster*  raster );
  976. #define  FT_Raster_New_Func    FT_Raster_NewFunc
  977.   /*************************************************************************/
  978.   /*                                                                       */
  979.   /* <FuncType>                                                            */
  980.   /*    FT_Raster_DoneFunc                                                 */
  981.   /*                                                                       */
  982.   /* <Description>                                                         */
  983.   /*    A function used to destroy a given raster object.                  */
  984.   /*                                                                       */
  985.   /* <Input>                                                               */
  986.   /*    raster :: A handle to the raster object.                           */
  987.   /*                                                                       */
  988.   typedef void
  989.   (*FT_Raster_DoneFunc)( FT_Raster  raster );
  990. #define  FT_Raster_Done_Func   FT_Raster_DoneFunc
  991.   /*************************************************************************/
  992.   /*                                                                       */
  993.   /* <FuncType>                                                            */
  994.   /*    FT_Raster_ResetFunc                                                */
  995.   /*                                                                       */
  996.   /* <Description>                                                         */
  997.   /*    FreeType provides an area of memory called the `render pool',      */
  998.   /*    available to all registered rasters.  This pool can be freely used */
  999.   /*    during a given scan-conversion but is shared by all rasters.  Its  */
  1000.   /*    content is thus transient.                                         */
  1001.   /*                                                                       */
  1002.   /*    This function is called each time the render pool changes, or just */
  1003.   /*    after a new raster object is created.                              */
  1004.   /*                                                                       */
  1005.   /* <Input>                                                               */
  1006.   /*    raster    :: A handle to the new raster object.                    */
  1007.   /*                                                                       */
  1008.   /*    pool_base :: The address in memory of the render pool.             */
  1009.   /*                                                                       */
  1010.   /*    pool_size :: The size in bytes of the render pool.                 */
  1011.   /*                                                                       */
  1012.   /* <Note>                                                                */
  1013.   /*    Rasters can ignore the render pool and rely on dynamic memory      */
  1014.   /*    allocation if they want to (a handle to the memory allocator is    */
  1015.   /*    passed to the raster constructor).  However, this is not           */
  1016.   /*    recommended for efficiency purposes.                               */
  1017.   /*                                                                       */
  1018.   typedef void
  1019.   (*FT_Raster_ResetFunc)( FT_Raster       raster,
  1020.                           unsigned char*  pool_base,
  1021.                           unsigned long   pool_size );
  1022. #define  FT_Raster_Reset_Func   FT_Raster_ResetFunc
  1023.   /*************************************************************************/
  1024.   /*                                                                       */
  1025.   /* <FuncType>                                                            */
  1026.   /*    FT_Raster_SetModeFunc                                              */
  1027.   /*                                                                       */
  1028.   /* <Description>                                                         */
  1029.   /*    This function is a generic facility to change modes or attributes  */
  1030.   /*    in a given raster.  This can be used for debugging purposes, or    */
  1031.   /*    simply to allow implementation-specific `features' in a given      */
  1032.   /*    raster module.                                                     */
  1033.   /*                                                                       */
  1034.   /* <Input>                                                               */
  1035.   /*    raster :: A handle to the new raster object.                       */
  1036.   /*                                                                       */
  1037.   /*    mode   :: A 4-byte tag used to name the mode or property.          */
  1038.   /*                                                                       */
  1039.   /*    args   :: A pointer to the new mode/property to use.               */
  1040.   /*                                                                       */
  1041.   typedef int
  1042.   (*FT_Raster_SetModeFunc)( FT_Raster      raster,
  1043.                             unsigned long  mode,
  1044.                             void*          args );
  1045. #define  FT_Raster_Set_Mode_Func  FT_Raster_SetModeFunc
  1046.   /*************************************************************************/
  1047.   /*                                                                       */
  1048.   /* <FuncType>                                                            */
  1049.   /*    FT_Raster_RenderFunc                                               */
  1050.   /*                                                                       */
  1051.   /* <Description>                                                         */
  1052.   /*   Invokes a given raster to scan-convert a given glyph image into a   */
  1053.   /*   target bitmap.                                                      */
  1054.   /*                                                                       */
  1055.   /* <Input>                                                               */
  1056.   /*    raster :: A handle to the raster object.                           */
  1057.   /*                                                                       */
  1058.   /*    params :: A pointer to an @FT_Raster_Params structure used to      */
  1059.   /*              store the rendering parameters.                          */
  1060.   /*                                                                       */
  1061.   /* <Return>                                                              */
  1062.   /*    Error code.  0 means success.                                      */
  1063.   /*                                                                       */
  1064.   /* <Note>                                                                */
  1065.   /*    The exact format of the source image depends on the raster's glyph */
  1066.   /*    format defined in its @FT_Raster_Funcs structure.  It can be an    */
  1067.   /*    @FT_Outline or anything else in order to support a large array of  */
  1068.   /*    glyph formats.                                                     */
  1069.   /*                                                                       */
  1070.   /*    Note also that the render function can fail and return a           */
  1071.   /*    `FT_Err_Unimplemented_Feature' error code if the raster used does  */
  1072.   /*    not support direct composition.                                    */
  1073.   /*                                                                       */
  1074.   /*    XXX: For now, the standard raster doesn't support direct           */
  1075.   /*         composition but this should change for the final release (see */
  1076.   /*         the files `demos/src/ftgrays.c' and `demos/src/ftgrays2.c'    */
  1077.   /*         for examples of distinct implementations which support direct */
  1078.   /*         composition).                                                 */
  1079.   /*                                                                       */
  1080.   typedef int
  1081.   (*FT_Raster_RenderFunc)( FT_Raster                raster,
  1082.                            const FT_Raster_Params*  params );
  1083. #define  FT_Raster_Render_Func    FT_Raster_RenderFunc
  1084.   /*************************************************************************/
  1085.   /*                                                                       */
  1086.   /* <Struct>                                                              */
  1087.   /*    FT_Raster_Funcs                                                    */
  1088.   /*                                                                       */
  1089.   /* <Description>                                                         */
  1090.   /*   A structure used to describe a given raster class to the library.   */
  1091.   /*                                                                       */
  1092.   /* <Fields>                                                              */
  1093.   /*    glyph_format  :: The supported glyph format for this raster.       */
  1094.   /*                                                                       */
  1095.   /*    raster_new    :: The raster constructor.                           */
  1096.   /*                                                                       */
  1097.   /*    raster_reset  :: Used to reset the render pool within the raster.  */
  1098.   /*                                                                       */
  1099.   /*    raster_render :: A function to render a glyph into a given bitmap. */
  1100.   /*                                                                       */
  1101.   /*    raster_done   :: The raster destructor.                            */
  1102.   /*                                                                       */
  1103.   typedef struct  FT_Raster_Funcs_
  1104.   {
  1105.     FT_Glyph_Format         glyph_format;
  1106.     FT_Raster_NewFunc       raster_new;
  1107.     FT_Raster_ResetFunc     raster_reset;
  1108.     FT_Raster_SetModeFunc   raster_set_mode;
  1109.     FT_Raster_RenderFunc    raster_render;
  1110.     FT_Raster_DoneFunc      raster_done;
  1111.   } FT_Raster_Funcs;
  1112.   /* */
  1113. FT_END_HEADER
  1114. #endif /* __FTIMAGE_H__ */
  1115. /* END */
  1116. /* Local Variables: */
  1117. /* coding: utf-8    */
  1118. /* End:             */