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