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