ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

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

Generated on Sun May 27 2012 04:33:31 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.