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