~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/gui/painting/qrasterdefs_p.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

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