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