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