source: OGRE/trunk/ogrenew/Dependencies/include/freetype/ftimage.h @ 657

Revision 657, 76.9 KB checked in by mattausch, 18 years ago (diff)

added ogre dependencies and patched ogre sources

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