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