vrshoot

annotate libs/ft2static/freetype/ftimage.h @ 0:b2f14e535253

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