vrshoot
diff 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 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libs/ft2static/freetype/ftimage.h Sat Feb 01 19:58:19 2014 +0200 1.3 @@ -0,0 +1,1313 @@ 1.4 +/***************************************************************************/ 1.5 +/* */ 1.6 +/* ftimage.h */ 1.7 +/* */ 1.8 +/* FreeType glyph image formats and default raster interface */ 1.9 +/* (specification). */ 1.10 +/* */ 1.11 +/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ 1.12 +/* 2010 by */ 1.13 +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ 1.14 +/* */ 1.15 +/* This file is part of the FreeType project, and may only be used, */ 1.16 +/* modified, and distributed under the terms of the FreeType project */ 1.17 +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 1.18 +/* this file you indicate that you have read the license and */ 1.19 +/* understand and accept it fully. */ 1.20 +/* */ 1.21 +/***************************************************************************/ 1.22 + 1.23 + /*************************************************************************/ 1.24 + /* */ 1.25 + /* Note: A `raster' is simply a scan-line converter, used to render */ 1.26 + /* FT_Outlines into FT_Bitmaps. */ 1.27 + /* */ 1.28 + /*************************************************************************/ 1.29 + 1.30 + 1.31 +#ifndef __FTIMAGE_H__ 1.32 +#define __FTIMAGE_H__ 1.33 + 1.34 + 1.35 + /* _STANDALONE_ is from ftgrays.c */ 1.36 +#ifndef _STANDALONE_ 1.37 +#include <ft2build.h> 1.38 +#endif 1.39 + 1.40 + 1.41 +FT_BEGIN_HEADER 1.42 + 1.43 + 1.44 + /*************************************************************************/ 1.45 + /* */ 1.46 + /* <Section> */ 1.47 + /* basic_types */ 1.48 + /* */ 1.49 + /*************************************************************************/ 1.50 + 1.51 + 1.52 + /*************************************************************************/ 1.53 + /* */ 1.54 + /* <Type> */ 1.55 + /* FT_Pos */ 1.56 + /* */ 1.57 + /* <Description> */ 1.58 + /* The type FT_Pos is used to store vectorial coordinates. Depending */ 1.59 + /* on the context, these can represent distances in integer font */ 1.60 + /* units, or 16.16, or 26.6 fixed float pixel coordinates. */ 1.61 + /* */ 1.62 + typedef signed long FT_Pos; 1.63 + 1.64 + 1.65 + /*************************************************************************/ 1.66 + /* */ 1.67 + /* <Struct> */ 1.68 + /* FT_Vector */ 1.69 + /* */ 1.70 + /* <Description> */ 1.71 + /* A simple structure used to store a 2D vector; coordinates are of */ 1.72 + /* the FT_Pos type. */ 1.73 + /* */ 1.74 + /* <Fields> */ 1.75 + /* x :: The horizontal coordinate. */ 1.76 + /* y :: The vertical coordinate. */ 1.77 + /* */ 1.78 + typedef struct FT_Vector_ 1.79 + { 1.80 + FT_Pos x; 1.81 + FT_Pos y; 1.82 + 1.83 + } FT_Vector; 1.84 + 1.85 + 1.86 + /*************************************************************************/ 1.87 + /* */ 1.88 + /* <Struct> */ 1.89 + /* FT_BBox */ 1.90 + /* */ 1.91 + /* <Description> */ 1.92 + /* A structure used to hold an outline's bounding box, i.e., the */ 1.93 + /* coordinates of its extrema in the horizontal and vertical */ 1.94 + /* directions. */ 1.95 + /* */ 1.96 + /* <Fields> */ 1.97 + /* xMin :: The horizontal minimum (left-most). */ 1.98 + /* */ 1.99 + /* yMin :: The vertical minimum (bottom-most). */ 1.100 + /* */ 1.101 + /* xMax :: The horizontal maximum (right-most). */ 1.102 + /* */ 1.103 + /* yMax :: The vertical maximum (top-most). */ 1.104 + /* */ 1.105 + /* <Note> */ 1.106 + /* The bounding box is specified with the coordinates of the lower */ 1.107 + /* left and the upper right corner. In PostScript, those values are */ 1.108 + /* often called (llx,lly) and (urx,ury), respectively. */ 1.109 + /* */ 1.110 + /* If `yMin' is negative, this value gives the glyph's descender. */ 1.111 + /* Otherwise, the glyph doesn't descend below the baseline. */ 1.112 + /* Similarly, if `ymax' is positive, this value gives the glyph's */ 1.113 + /* ascender. */ 1.114 + /* */ 1.115 + /* `xMin' gives the horizontal distance from the glyph's origin to */ 1.116 + /* the left edge of the glyph's bounding box. If `xMin' is negative, */ 1.117 + /* the glyph extends to the left of the origin. */ 1.118 + /* */ 1.119 + typedef struct FT_BBox_ 1.120 + { 1.121 + FT_Pos xMin, yMin; 1.122 + FT_Pos xMax, yMax; 1.123 + 1.124 + } FT_BBox; 1.125 + 1.126 + 1.127 + /*************************************************************************/ 1.128 + /* */ 1.129 + /* <Enum> */ 1.130 + /* FT_Pixel_Mode */ 1.131 + /* */ 1.132 + /* <Description> */ 1.133 + /* An enumeration type used to describe the format of pixels in a */ 1.134 + /* given bitmap. Note that additional formats may be added in the */ 1.135 + /* future. */ 1.136 + /* */ 1.137 + /* <Values> */ 1.138 + /* FT_PIXEL_MODE_NONE :: */ 1.139 + /* Value~0 is reserved. */ 1.140 + /* */ 1.141 + /* FT_PIXEL_MODE_MONO :: */ 1.142 + /* A monochrome bitmap, using 1~bit per pixel. Note that pixels */ 1.143 + /* are stored in most-significant order (MSB), which means that */ 1.144 + /* the left-most pixel in a byte has value 128. */ 1.145 + /* */ 1.146 + /* FT_PIXEL_MODE_GRAY :: */ 1.147 + /* An 8-bit bitmap, generally used to represent anti-aliased glyph */ 1.148 + /* images. Each pixel is stored in one byte. Note that the number */ 1.149 + /* of `gray' levels is stored in the `num_grays' field of the */ 1.150 + /* @FT_Bitmap structure (it generally is 256). */ 1.151 + /* */ 1.152 + /* FT_PIXEL_MODE_GRAY2 :: */ 1.153 + /* A 2-bit per pixel bitmap, used to represent embedded */ 1.154 + /* anti-aliased bitmaps in font files according to the OpenType */ 1.155 + /* specification. We haven't found a single font using this */ 1.156 + /* format, however. */ 1.157 + /* */ 1.158 + /* FT_PIXEL_MODE_GRAY4 :: */ 1.159 + /* A 4-bit per pixel bitmap, representing embedded anti-aliased */ 1.160 + /* bitmaps in font files according to the OpenType specification. */ 1.161 + /* We haven't found a single font using this format, however. */ 1.162 + /* */ 1.163 + /* FT_PIXEL_MODE_LCD :: */ 1.164 + /* An 8-bit bitmap, representing RGB or BGR decimated glyph images */ 1.165 + /* used for display on LCD displays; the bitmap is three times */ 1.166 + /* wider than the original glyph image. See also */ 1.167 + /* @FT_RENDER_MODE_LCD. */ 1.168 + /* */ 1.169 + /* FT_PIXEL_MODE_LCD_V :: */ 1.170 + /* An 8-bit bitmap, representing RGB or BGR decimated glyph images */ 1.171 + /* used for display on rotated LCD displays; the bitmap is three */ 1.172 + /* times taller than the original glyph image. See also */ 1.173 + /* @FT_RENDER_MODE_LCD_V. */ 1.174 + /* */ 1.175 + typedef enum FT_Pixel_Mode_ 1.176 + { 1.177 + FT_PIXEL_MODE_NONE = 0, 1.178 + FT_PIXEL_MODE_MONO, 1.179 + FT_PIXEL_MODE_GRAY, 1.180 + FT_PIXEL_MODE_GRAY2, 1.181 + FT_PIXEL_MODE_GRAY4, 1.182 + FT_PIXEL_MODE_LCD, 1.183 + FT_PIXEL_MODE_LCD_V, 1.184 + 1.185 + FT_PIXEL_MODE_MAX /* do not remove */ 1.186 + 1.187 + } FT_Pixel_Mode; 1.188 + 1.189 + 1.190 + /*************************************************************************/ 1.191 + /* */ 1.192 + /* <Enum> */ 1.193 + /* ft_pixel_mode_xxx */ 1.194 + /* */ 1.195 + /* <Description> */ 1.196 + /* A list of deprecated constants. Use the corresponding */ 1.197 + /* @FT_Pixel_Mode values instead. */ 1.198 + /* */ 1.199 + /* <Values> */ 1.200 + /* ft_pixel_mode_none :: See @FT_PIXEL_MODE_NONE. */ 1.201 + /* ft_pixel_mode_mono :: See @FT_PIXEL_MODE_MONO. */ 1.202 + /* ft_pixel_mode_grays :: See @FT_PIXEL_MODE_GRAY. */ 1.203 + /* ft_pixel_mode_pal2 :: See @FT_PIXEL_MODE_GRAY2. */ 1.204 + /* ft_pixel_mode_pal4 :: See @FT_PIXEL_MODE_GRAY4. */ 1.205 + /* */ 1.206 +#define ft_pixel_mode_none FT_PIXEL_MODE_NONE 1.207 +#define ft_pixel_mode_mono FT_PIXEL_MODE_MONO 1.208 +#define ft_pixel_mode_grays FT_PIXEL_MODE_GRAY 1.209 +#define ft_pixel_mode_pal2 FT_PIXEL_MODE_GRAY2 1.210 +#define ft_pixel_mode_pal4 FT_PIXEL_MODE_GRAY4 1.211 + 1.212 + /* */ 1.213 + 1.214 +#if 0 1.215 + 1.216 + /*************************************************************************/ 1.217 + /* */ 1.218 + /* <Enum> */ 1.219 + /* FT_Palette_Mode */ 1.220 + /* */ 1.221 + /* <Description> */ 1.222 + /* THIS TYPE IS DEPRECATED. DO NOT USE IT! */ 1.223 + /* */ 1.224 + /* An enumeration type to describe the format of a bitmap palette, */ 1.225 + /* used with ft_pixel_mode_pal4 and ft_pixel_mode_pal8. */ 1.226 + /* */ 1.227 + /* <Values> */ 1.228 + /* ft_palette_mode_rgb :: The palette is an array of 3-byte RGB */ 1.229 + /* records. */ 1.230 + /* */ 1.231 + /* ft_palette_mode_rgba :: The palette is an array of 4-byte RGBA */ 1.232 + /* records. */ 1.233 + /* */ 1.234 + /* <Note> */ 1.235 + /* As ft_pixel_mode_pal2, pal4 and pal8 are currently unused by */ 1.236 + /* FreeType, these types are not handled by the library itself. */ 1.237 + /* */ 1.238 + typedef enum FT_Palette_Mode_ 1.239 + { 1.240 + ft_palette_mode_rgb = 0, 1.241 + ft_palette_mode_rgba, 1.242 + 1.243 + ft_palette_mode_max /* do not remove */ 1.244 + 1.245 + } FT_Palette_Mode; 1.246 + 1.247 + /* */ 1.248 + 1.249 +#endif 1.250 + 1.251 + 1.252 + /*************************************************************************/ 1.253 + /* */ 1.254 + /* <Struct> */ 1.255 + /* FT_Bitmap */ 1.256 + /* */ 1.257 + /* <Description> */ 1.258 + /* A structure used to describe a bitmap or pixmap to the raster. */ 1.259 + /* Note that we now manage pixmaps of various depths through the */ 1.260 + /* `pixel_mode' field. */ 1.261 + /* */ 1.262 + /* <Fields> */ 1.263 + /* rows :: The number of bitmap rows. */ 1.264 + /* */ 1.265 + /* width :: The number of pixels in bitmap row. */ 1.266 + /* */ 1.267 + /* pitch :: The pitch's absolute value is the number of bytes */ 1.268 + /* taken by one bitmap row, including padding. */ 1.269 + /* However, the pitch is positive when the bitmap has */ 1.270 + /* a `down' flow, and negative when it has an `up' */ 1.271 + /* flow. In all cases, the pitch is an offset to add */ 1.272 + /* to a bitmap pointer in order to go down one row. */ 1.273 + /* */ 1.274 + /* Note that `padding' means the alignment of a */ 1.275 + /* bitmap to a byte border, and FreeType functions */ 1.276 + /* normally align to the smallest possible integer */ 1.277 + /* value. */ 1.278 + /* */ 1.279 + /* For the B/W rasterizer, `pitch' is always an even */ 1.280 + /* number. */ 1.281 + /* */ 1.282 + /* To change the pitch of a bitmap (say, to make it a */ 1.283 + /* multiple of 4), use @FT_Bitmap_Convert. */ 1.284 + /* Alternatively, you might use callback functions to */ 1.285 + /* directly render to the application's surface; see */ 1.286 + /* the file `example2.cpp' in the tutorial for a */ 1.287 + /* demonstration. */ 1.288 + /* */ 1.289 + /* buffer :: A typeless pointer to the bitmap buffer. This */ 1.290 + /* value should be aligned on 32-bit boundaries in */ 1.291 + /* most cases. */ 1.292 + /* */ 1.293 + /* num_grays :: This field is only used with */ 1.294 + /* @FT_PIXEL_MODE_GRAY; it gives the number of gray */ 1.295 + /* levels used in the bitmap. */ 1.296 + /* */ 1.297 + /* pixel_mode :: The pixel mode, i.e., how pixel bits are stored. */ 1.298 + /* See @FT_Pixel_Mode for possible values. */ 1.299 + /* */ 1.300 + /* palette_mode :: This field is intended for paletted pixel modes; */ 1.301 + /* it indicates how the palette is stored. Not */ 1.302 + /* used currently. */ 1.303 + /* */ 1.304 + /* palette :: A typeless pointer to the bitmap palette; this */ 1.305 + /* field is intended for paletted pixel modes. Not */ 1.306 + /* used currently. */ 1.307 + /* */ 1.308 + /* <Note> */ 1.309 + /* For now, the only pixel modes supported by FreeType are mono and */ 1.310 + /* grays. However, drivers might be added in the future to support */ 1.311 + /* more `colorful' options. */ 1.312 + /* */ 1.313 + typedef struct FT_Bitmap_ 1.314 + { 1.315 + int rows; 1.316 + int width; 1.317 + int pitch; 1.318 + unsigned char* buffer; 1.319 + short num_grays; 1.320 + char pixel_mode; 1.321 + char palette_mode; 1.322 + void* palette; 1.323 + 1.324 + } FT_Bitmap; 1.325 + 1.326 + 1.327 + /*************************************************************************/ 1.328 + /* */ 1.329 + /* <Section> */ 1.330 + /* outline_processing */ 1.331 + /* */ 1.332 + /*************************************************************************/ 1.333 + 1.334 + 1.335 + /*************************************************************************/ 1.336 + /* */ 1.337 + /* <Struct> */ 1.338 + /* FT_Outline */ 1.339 + /* */ 1.340 + /* <Description> */ 1.341 + /* This structure is used to describe an outline to the scan-line */ 1.342 + /* converter. */ 1.343 + /* */ 1.344 + /* <Fields> */ 1.345 + /* n_contours :: The number of contours in the outline. */ 1.346 + /* */ 1.347 + /* n_points :: The number of points in the outline. */ 1.348 + /* */ 1.349 + /* points :: A pointer to an array of `n_points' @FT_Vector */ 1.350 + /* elements, giving the outline's point coordinates. */ 1.351 + /* */ 1.352 + /* tags :: A pointer to an array of `n_points' chars, giving */ 1.353 + /* each outline point's type. */ 1.354 + /* */ 1.355 + /* If bit~0 is unset, the point is `off' the curve, */ 1.356 + /* i.e., a Bézier control point, while it is `on' if */ 1.357 + /* set. */ 1.358 + /* */ 1.359 + /* Bit~1 is meaningful for `off' points only. If set, */ 1.360 + /* it indicates a third-order Bézier arc control point; */ 1.361 + /* and a second-order control point if unset. */ 1.362 + /* */ 1.363 + /* If bit~2 is set, bits 5-7 contain the drop-out mode */ 1.364 + /* (as defined in the OpenType specification; the value */ 1.365 + /* is the same as the argument to the SCANMODE */ 1.366 + /* instruction). */ 1.367 + /* */ 1.368 + /* Bits 3 and~4 are reserved for internal purposes. */ 1.369 + /* */ 1.370 + /* contours :: An array of `n_contours' shorts, giving the end */ 1.371 + /* point of each contour within the outline. For */ 1.372 + /* example, the first contour is defined by the points */ 1.373 + /* `0' to `contours[0]', the second one is defined by */ 1.374 + /* the points `contours[0]+1' to `contours[1]', etc. */ 1.375 + /* */ 1.376 + /* flags :: A set of bit flags used to characterize the outline */ 1.377 + /* and give hints to the scan-converter and hinter on */ 1.378 + /* how to convert/grid-fit it. See @FT_OUTLINE_FLAGS. */ 1.379 + /* */ 1.380 + /* <Note> */ 1.381 + /* The B/W rasterizer only checks bit~2 in the `tags' array for the */ 1.382 + /* first point of each contour. The drop-out mode as given with */ 1.383 + /* @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and */ 1.384 + /* @FT_OUTLINE_INCLUDE_STUBS in `flags' is then overridden. */ 1.385 + /* */ 1.386 + typedef struct FT_Outline_ 1.387 + { 1.388 + short n_contours; /* number of contours in glyph */ 1.389 + short n_points; /* number of points in the glyph */ 1.390 + 1.391 + FT_Vector* points; /* the outline's points */ 1.392 + char* tags; /* the points flags */ 1.393 + short* contours; /* the contour end points */ 1.394 + 1.395 + int flags; /* outline masks */ 1.396 + 1.397 + } FT_Outline; 1.398 + 1.399 + /* Following limits must be consistent with */ 1.400 + /* FT_Outline.{n_contours,n_points} */ 1.401 +#define FT_OUTLINE_CONTOURS_MAX SHRT_MAX 1.402 +#define FT_OUTLINE_POINTS_MAX SHRT_MAX 1.403 + 1.404 + 1.405 + /*************************************************************************/ 1.406 + /* */ 1.407 + /* <Enum> */ 1.408 + /* FT_OUTLINE_FLAGS */ 1.409 + /* */ 1.410 + /* <Description> */ 1.411 + /* A list of bit-field constants use for the flags in an outline's */ 1.412 + /* `flags' field. */ 1.413 + /* */ 1.414 + /* <Values> */ 1.415 + /* FT_OUTLINE_NONE :: */ 1.416 + /* Value~0 is reserved. */ 1.417 + /* */ 1.418 + /* FT_OUTLINE_OWNER :: */ 1.419 + /* If set, this flag indicates that the outline's field arrays */ 1.420 + /* (i.e., `points', `flags', and `contours') are `owned' by the */ 1.421 + /* outline object, and should thus be freed when it is destroyed. */ 1.422 + /* */ 1.423 + /* FT_OUTLINE_EVEN_ODD_FILL :: */ 1.424 + /* By default, outlines are filled using the non-zero winding rule. */ 1.425 + /* If set to 1, the outline will be filled using the even-odd fill */ 1.426 + /* rule (only works with the smooth rasterizer). */ 1.427 + /* */ 1.428 + /* FT_OUTLINE_REVERSE_FILL :: */ 1.429 + /* By default, outside contours of an outline are oriented in */ 1.430 + /* clock-wise direction, as defined in the TrueType specification. */ 1.431 + /* This flag is set if the outline uses the opposite direction */ 1.432 + /* (typically for Type~1 fonts). This flag is ignored by the scan */ 1.433 + /* converter. */ 1.434 + /* */ 1.435 + /* FT_OUTLINE_IGNORE_DROPOUTS :: */ 1.436 + /* By default, the scan converter will try to detect drop-outs in */ 1.437 + /* an outline and correct the glyph bitmap to ensure consistent */ 1.438 + /* shape continuity. If set, this flag hints the scan-line */ 1.439 + /* converter to ignore such cases. See below for more information. */ 1.440 + /* */ 1.441 + /* FT_OUTLINE_SMART_DROPOUTS :: */ 1.442 + /* Select smart dropout control. If unset, use simple dropout */ 1.443 + /* control. Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See */ 1.444 + /* below for more information. */ 1.445 + /* */ 1.446 + /* FT_OUTLINE_INCLUDE_STUBS :: */ 1.447 + /* If set, turn pixels on for `stubs', otherwise exclude them. */ 1.448 + /* Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See below for */ 1.449 + /* more information. */ 1.450 + /* */ 1.451 + /* FT_OUTLINE_HIGH_PRECISION :: */ 1.452 + /* This flag indicates that the scan-line converter should try to */ 1.453 + /* convert this outline to bitmaps with the highest possible */ 1.454 + /* quality. It is typically set for small character sizes. Note */ 1.455 + /* that this is only a hint that might be completely ignored by a */ 1.456 + /* given scan-converter. */ 1.457 + /* */ 1.458 + /* FT_OUTLINE_SINGLE_PASS :: */ 1.459 + /* This flag is set to force a given scan-converter to only use a */ 1.460 + /* single pass over the outline to render a bitmap glyph image. */ 1.461 + /* Normally, it is set for very large character sizes. It is only */ 1.462 + /* a hint that might be completely ignored by a given */ 1.463 + /* scan-converter. */ 1.464 + /* */ 1.465 + /* <Note> */ 1.466 + /* The flags @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, */ 1.467 + /* and @FT_OUTLINE_INCLUDE_STUBS are ignored by the smooth */ 1.468 + /* rasterizer. */ 1.469 + /* */ 1.470 + /* There exists a second mechanism to pass the drop-out mode to the */ 1.471 + /* B/W rasterizer; see the `tags' field in @FT_Outline. */ 1.472 + /* */ 1.473 + /* Please refer to the description of the `SCANTYPE' instruction in */ 1.474 + /* the OpenType specification (in file `ttinst1.doc') how simple */ 1.475 + /* drop-outs, smart drop-outs, and stubs are defined. */ 1.476 + /* */ 1.477 +#define FT_OUTLINE_NONE 0x0 1.478 +#define FT_OUTLINE_OWNER 0x1 1.479 +#define FT_OUTLINE_EVEN_ODD_FILL 0x2 1.480 +#define FT_OUTLINE_REVERSE_FILL 0x4 1.481 +#define FT_OUTLINE_IGNORE_DROPOUTS 0x8 1.482 +#define FT_OUTLINE_SMART_DROPOUTS 0x10 1.483 +#define FT_OUTLINE_INCLUDE_STUBS 0x20 1.484 + 1.485 +#define FT_OUTLINE_HIGH_PRECISION 0x100 1.486 +#define FT_OUTLINE_SINGLE_PASS 0x200 1.487 + 1.488 + 1.489 + /************************************************************************* 1.490 + * 1.491 + * @enum: 1.492 + * ft_outline_flags 1.493 + * 1.494 + * @description: 1.495 + * These constants are deprecated. Please use the corresponding 1.496 + * @FT_OUTLINE_FLAGS values. 1.497 + * 1.498 + * @values: 1.499 + * ft_outline_none :: See @FT_OUTLINE_NONE. 1.500 + * ft_outline_owner :: See @FT_OUTLINE_OWNER. 1.501 + * ft_outline_even_odd_fill :: See @FT_OUTLINE_EVEN_ODD_FILL. 1.502 + * ft_outline_reverse_fill :: See @FT_OUTLINE_REVERSE_FILL. 1.503 + * ft_outline_ignore_dropouts :: See @FT_OUTLINE_IGNORE_DROPOUTS. 1.504 + * ft_outline_high_precision :: See @FT_OUTLINE_HIGH_PRECISION. 1.505 + * ft_outline_single_pass :: See @FT_OUTLINE_SINGLE_PASS. 1.506 + */ 1.507 +#define ft_outline_none FT_OUTLINE_NONE 1.508 +#define ft_outline_owner FT_OUTLINE_OWNER 1.509 +#define ft_outline_even_odd_fill FT_OUTLINE_EVEN_ODD_FILL 1.510 +#define ft_outline_reverse_fill FT_OUTLINE_REVERSE_FILL 1.511 +#define ft_outline_ignore_dropouts FT_OUTLINE_IGNORE_DROPOUTS 1.512 +#define ft_outline_high_precision FT_OUTLINE_HIGH_PRECISION 1.513 +#define ft_outline_single_pass FT_OUTLINE_SINGLE_PASS 1.514 + 1.515 + /* */ 1.516 + 1.517 +#define FT_CURVE_TAG( flag ) ( flag & 3 ) 1.518 + 1.519 +#define FT_CURVE_TAG_ON 1 1.520 +#define FT_CURVE_TAG_CONIC 0 1.521 +#define FT_CURVE_TAG_CUBIC 2 1.522 + 1.523 +#define FT_CURVE_TAG_HAS_SCANMODE 4 1.524 + 1.525 +#define FT_CURVE_TAG_TOUCH_X 8 /* reserved for the TrueType hinter */ 1.526 +#define FT_CURVE_TAG_TOUCH_Y 16 /* reserved for the TrueType hinter */ 1.527 + 1.528 +#define FT_CURVE_TAG_TOUCH_BOTH ( FT_CURVE_TAG_TOUCH_X | \ 1.529 + FT_CURVE_TAG_TOUCH_Y ) 1.530 + 1.531 +#define FT_Curve_Tag_On FT_CURVE_TAG_ON 1.532 +#define FT_Curve_Tag_Conic FT_CURVE_TAG_CONIC 1.533 +#define FT_Curve_Tag_Cubic FT_CURVE_TAG_CUBIC 1.534 +#define FT_Curve_Tag_Touch_X FT_CURVE_TAG_TOUCH_X 1.535 +#define FT_Curve_Tag_Touch_Y FT_CURVE_TAG_TOUCH_Y 1.536 + 1.537 + 1.538 + /*************************************************************************/ 1.539 + /* */ 1.540 + /* <FuncType> */ 1.541 + /* FT_Outline_MoveToFunc */ 1.542 + /* */ 1.543 + /* <Description> */ 1.544 + /* A function pointer type used to describe the signature of a `move */ 1.545 + /* to' function during outline walking/decomposition. */ 1.546 + /* */ 1.547 + /* A `move to' is emitted to start a new contour in an outline. */ 1.548 + /* */ 1.549 + /* <Input> */ 1.550 + /* to :: A pointer to the target point of the `move to'. */ 1.551 + /* */ 1.552 + /* user :: A typeless pointer which is passed from the caller of the */ 1.553 + /* decomposition function. */ 1.554 + /* */ 1.555 + /* <Return> */ 1.556 + /* Error code. 0~means success. */ 1.557 + /* */ 1.558 + typedef int 1.559 + (*FT_Outline_MoveToFunc)( const FT_Vector* to, 1.560 + void* user ); 1.561 + 1.562 +#define FT_Outline_MoveTo_Func FT_Outline_MoveToFunc 1.563 + 1.564 + 1.565 + /*************************************************************************/ 1.566 + /* */ 1.567 + /* <FuncType> */ 1.568 + /* FT_Outline_LineToFunc */ 1.569 + /* */ 1.570 + /* <Description> */ 1.571 + /* A function pointer type used to describe the signature of a `line */ 1.572 + /* to' function during outline walking/decomposition. */ 1.573 + /* */ 1.574 + /* A `line to' is emitted to indicate a segment in the outline. */ 1.575 + /* */ 1.576 + /* <Input> */ 1.577 + /* to :: A pointer to the target point of the `line to'. */ 1.578 + /* */ 1.579 + /* user :: A typeless pointer which is passed from the caller of the */ 1.580 + /* decomposition function. */ 1.581 + /* */ 1.582 + /* <Return> */ 1.583 + /* Error code. 0~means success. */ 1.584 + /* */ 1.585 + typedef int 1.586 + (*FT_Outline_LineToFunc)( const FT_Vector* to, 1.587 + void* user ); 1.588 + 1.589 +#define FT_Outline_LineTo_Func FT_Outline_LineToFunc 1.590 + 1.591 + 1.592 + /*************************************************************************/ 1.593 + /* */ 1.594 + /* <FuncType> */ 1.595 + /* FT_Outline_ConicToFunc */ 1.596 + /* */ 1.597 + /* <Description> */ 1.598 + /* A function pointer type used to describe the signature of a `conic */ 1.599 + /* to' function during outline walking or decomposition. */ 1.600 + /* */ 1.601 + /* A `conic to' is emitted to indicate a second-order Bézier arc in */ 1.602 + /* the outline. */ 1.603 + /* */ 1.604 + /* <Input> */ 1.605 + /* control :: An intermediate control point between the last position */ 1.606 + /* and the new target in `to'. */ 1.607 + /* */ 1.608 + /* to :: A pointer to the target end point of the conic arc. */ 1.609 + /* */ 1.610 + /* user :: A typeless pointer which is passed from the caller of */ 1.611 + /* the decomposition function. */ 1.612 + /* */ 1.613 + /* <Return> */ 1.614 + /* Error code. 0~means success. */ 1.615 + /* */ 1.616 + typedef int 1.617 + (*FT_Outline_ConicToFunc)( const FT_Vector* control, 1.618 + const FT_Vector* to, 1.619 + void* user ); 1.620 + 1.621 +#define FT_Outline_ConicTo_Func FT_Outline_ConicToFunc 1.622 + 1.623 + 1.624 + /*************************************************************************/ 1.625 + /* */ 1.626 + /* <FuncType> */ 1.627 + /* FT_Outline_CubicToFunc */ 1.628 + /* */ 1.629 + /* <Description> */ 1.630 + /* A function pointer type used to describe the signature of a `cubic */ 1.631 + /* to' function during outline walking or decomposition. */ 1.632 + /* */ 1.633 + /* A `cubic to' is emitted to indicate a third-order Bézier arc. */ 1.634 + /* */ 1.635 + /* <Input> */ 1.636 + /* control1 :: A pointer to the first Bézier control point. */ 1.637 + /* */ 1.638 + /* control2 :: A pointer to the second Bézier control point. */ 1.639 + /* */ 1.640 + /* to :: A pointer to the target end point. */ 1.641 + /* */ 1.642 + /* user :: A typeless pointer which is passed from the caller of */ 1.643 + /* the decomposition function. */ 1.644 + /* */ 1.645 + /* <Return> */ 1.646 + /* Error code. 0~means success. */ 1.647 + /* */ 1.648 + typedef int 1.649 + (*FT_Outline_CubicToFunc)( const FT_Vector* control1, 1.650 + const FT_Vector* control2, 1.651 + const FT_Vector* to, 1.652 + void* user ); 1.653 + 1.654 +#define FT_Outline_CubicTo_Func FT_Outline_CubicToFunc 1.655 + 1.656 + 1.657 + /*************************************************************************/ 1.658 + /* */ 1.659 + /* <Struct> */ 1.660 + /* FT_Outline_Funcs */ 1.661 + /* */ 1.662 + /* <Description> */ 1.663 + /* A structure to hold various function pointers used during outline */ 1.664 + /* decomposition in order to emit segments, conic, and cubic Béziers. */ 1.665 + /* */ 1.666 + /* <Fields> */ 1.667 + /* move_to :: The `move to' emitter. */ 1.668 + /* */ 1.669 + /* line_to :: The segment emitter. */ 1.670 + /* */ 1.671 + /* conic_to :: The second-order Bézier arc emitter. */ 1.672 + /* */ 1.673 + /* cubic_to :: The third-order Bézier arc emitter. */ 1.674 + /* */ 1.675 + /* shift :: The shift that is applied to coordinates before they */ 1.676 + /* are sent to the emitter. */ 1.677 + /* */ 1.678 + /* delta :: The delta that is applied to coordinates before they */ 1.679 + /* are sent to the emitter, but after the shift. */ 1.680 + /* */ 1.681 + /* <Note> */ 1.682 + /* The point coordinates sent to the emitters are the transformed */ 1.683 + /* version of the original coordinates (this is important for high */ 1.684 + /* accuracy during scan-conversion). The transformation is simple: */ 1.685 + /* */ 1.686 + /* { */ 1.687 + /* x' = (x << shift) - delta */ 1.688 + /* y' = (x << shift) - delta */ 1.689 + /* } */ 1.690 + /* */ 1.691 + /* Set the values of `shift' and `delta' to~0 to get the original */ 1.692 + /* point coordinates. */ 1.693 + /* */ 1.694 + typedef struct FT_Outline_Funcs_ 1.695 + { 1.696 + FT_Outline_MoveToFunc move_to; 1.697 + FT_Outline_LineToFunc line_to; 1.698 + FT_Outline_ConicToFunc conic_to; 1.699 + FT_Outline_CubicToFunc cubic_to; 1.700 + 1.701 + int shift; 1.702 + FT_Pos delta; 1.703 + 1.704 + } FT_Outline_Funcs; 1.705 + 1.706 + 1.707 + /*************************************************************************/ 1.708 + /* */ 1.709 + /* <Section> */ 1.710 + /* basic_types */ 1.711 + /* */ 1.712 + /*************************************************************************/ 1.713 + 1.714 + 1.715 + /*************************************************************************/ 1.716 + /* */ 1.717 + /* <Macro> */ 1.718 + /* FT_IMAGE_TAG */ 1.719 + /* */ 1.720 + /* <Description> */ 1.721 + /* This macro converts four-letter tags to an unsigned long type. */ 1.722 + /* */ 1.723 + /* <Note> */ 1.724 + /* Since many 16-bit compilers don't like 32-bit enumerations, you */ 1.725 + /* should redefine this macro in case of problems to something like */ 1.726 + /* this: */ 1.727 + /* */ 1.728 + /* { */ 1.729 + /* #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) value */ 1.730 + /* } */ 1.731 + /* */ 1.732 + /* to get a simple enumeration without assigning special numbers. */ 1.733 + /* */ 1.734 +#ifndef FT_IMAGE_TAG 1.735 +#define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) \ 1.736 + value = ( ( (unsigned long)_x1 << 24 ) | \ 1.737 + ( (unsigned long)_x2 << 16 ) | \ 1.738 + ( (unsigned long)_x3 << 8 ) | \ 1.739 + (unsigned long)_x4 ) 1.740 +#endif /* FT_IMAGE_TAG */ 1.741 + 1.742 + 1.743 + /*************************************************************************/ 1.744 + /* */ 1.745 + /* <Enum> */ 1.746 + /* FT_Glyph_Format */ 1.747 + /* */ 1.748 + /* <Description> */ 1.749 + /* An enumeration type used to describe the format of a given glyph */ 1.750 + /* image. Note that this version of FreeType only supports two image */ 1.751 + /* formats, even though future font drivers will be able to register */ 1.752 + /* their own format. */ 1.753 + /* */ 1.754 + /* <Values> */ 1.755 + /* FT_GLYPH_FORMAT_NONE :: */ 1.756 + /* The value~0 is reserved. */ 1.757 + /* */ 1.758 + /* FT_GLYPH_FORMAT_COMPOSITE :: */ 1.759 + /* The glyph image is a composite of several other images. This */ 1.760 + /* format is _only_ used with @FT_LOAD_NO_RECURSE, and is used to */ 1.761 + /* report compound glyphs (like accented characters). */ 1.762 + /* */ 1.763 + /* FT_GLYPH_FORMAT_BITMAP :: */ 1.764 + /* The glyph image is a bitmap, and can be described as an */ 1.765 + /* @FT_Bitmap. You generally need to access the `bitmap' field of */ 1.766 + /* the @FT_GlyphSlotRec structure to read it. */ 1.767 + /* */ 1.768 + /* FT_GLYPH_FORMAT_OUTLINE :: */ 1.769 + /* The glyph image is a vectorial outline made of line segments */ 1.770 + /* and Bézier arcs; it can be described as an @FT_Outline; you */ 1.771 + /* generally want to access the `outline' field of the */ 1.772 + /* @FT_GlyphSlotRec structure to read it. */ 1.773 + /* */ 1.774 + /* FT_GLYPH_FORMAT_PLOTTER :: */ 1.775 + /* The glyph image is a vectorial path with no inside and outside */ 1.776 + /* contours. Some Type~1 fonts, like those in the Hershey family, */ 1.777 + /* contain glyphs in this format. These are described as */ 1.778 + /* @FT_Outline, but FreeType isn't currently capable of rendering */ 1.779 + /* them correctly. */ 1.780 + /* */ 1.781 + typedef enum FT_Glyph_Format_ 1.782 + { 1.783 + FT_IMAGE_TAG( FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0 ), 1.784 + 1.785 + FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ), 1.786 + FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP, 'b', 'i', 't', 's' ), 1.787 + FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE, 'o', 'u', 't', 'l' ), 1.788 + FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER, 'p', 'l', 'o', 't' ) 1.789 + 1.790 + } FT_Glyph_Format; 1.791 + 1.792 + 1.793 + /*************************************************************************/ 1.794 + /* */ 1.795 + /* <Enum> */ 1.796 + /* ft_glyph_format_xxx */ 1.797 + /* */ 1.798 + /* <Description> */ 1.799 + /* A list of deprecated constants. Use the corresponding */ 1.800 + /* @FT_Glyph_Format values instead. */ 1.801 + /* */ 1.802 + /* <Values> */ 1.803 + /* ft_glyph_format_none :: See @FT_GLYPH_FORMAT_NONE. */ 1.804 + /* ft_glyph_format_composite :: See @FT_GLYPH_FORMAT_COMPOSITE. */ 1.805 + /* ft_glyph_format_bitmap :: See @FT_GLYPH_FORMAT_BITMAP. */ 1.806 + /* ft_glyph_format_outline :: See @FT_GLYPH_FORMAT_OUTLINE. */ 1.807 + /* ft_glyph_format_plotter :: See @FT_GLYPH_FORMAT_PLOTTER. */ 1.808 + /* */ 1.809 +#define ft_glyph_format_none FT_GLYPH_FORMAT_NONE 1.810 +#define ft_glyph_format_composite FT_GLYPH_FORMAT_COMPOSITE 1.811 +#define ft_glyph_format_bitmap FT_GLYPH_FORMAT_BITMAP 1.812 +#define ft_glyph_format_outline FT_GLYPH_FORMAT_OUTLINE 1.813 +#define ft_glyph_format_plotter FT_GLYPH_FORMAT_PLOTTER 1.814 + 1.815 + 1.816 + /*************************************************************************/ 1.817 + /*************************************************************************/ 1.818 + /*************************************************************************/ 1.819 + /***** *****/ 1.820 + /***** R A S T E R D E F I N I T I O N S *****/ 1.821 + /***** *****/ 1.822 + /*************************************************************************/ 1.823 + /*************************************************************************/ 1.824 + /*************************************************************************/ 1.825 + 1.826 + 1.827 + /*************************************************************************/ 1.828 + /* */ 1.829 + /* A raster is a scan converter, in charge of rendering an outline into */ 1.830 + /* a a bitmap. This section contains the public API for rasters. */ 1.831 + /* */ 1.832 + /* Note that in FreeType 2, all rasters are now encapsulated within */ 1.833 + /* specific modules called `renderers'. See `freetype/ftrender.h' for */ 1.834 + /* more details on renderers. */ 1.835 + /* */ 1.836 + /*************************************************************************/ 1.837 + 1.838 + 1.839 + /*************************************************************************/ 1.840 + /* */ 1.841 + /* <Section> */ 1.842 + /* raster */ 1.843 + /* */ 1.844 + /* <Title> */ 1.845 + /* Scanline Converter */ 1.846 + /* */ 1.847 + /* <Abstract> */ 1.848 + /* How vectorial outlines are converted into bitmaps and pixmaps. */ 1.849 + /* */ 1.850 + /* <Description> */ 1.851 + /* This section contains technical definitions. */ 1.852 + /* */ 1.853 + /*************************************************************************/ 1.854 + 1.855 + 1.856 + /*************************************************************************/ 1.857 + /* */ 1.858 + /* <Type> */ 1.859 + /* FT_Raster */ 1.860 + /* */ 1.861 + /* <Description> */ 1.862 + /* A handle (pointer) to a raster object. Each object can be used */ 1.863 + /* independently to convert an outline into a bitmap or pixmap. */ 1.864 + /* */ 1.865 + typedef struct FT_RasterRec_* FT_Raster; 1.866 + 1.867 + 1.868 + /*************************************************************************/ 1.869 + /* */ 1.870 + /* <Struct> */ 1.871 + /* FT_Span */ 1.872 + /* */ 1.873 + /* <Description> */ 1.874 + /* A structure used to model a single span of gray (or black) pixels */ 1.875 + /* when rendering a monochrome or anti-aliased bitmap. */ 1.876 + /* */ 1.877 + /* <Fields> */ 1.878 + /* x :: The span's horizontal start position. */ 1.879 + /* */ 1.880 + /* len :: The span's length in pixels. */ 1.881 + /* */ 1.882 + /* coverage :: The span color/coverage, ranging from 0 (background) */ 1.883 + /* to 255 (foreground). Only used for anti-aliased */ 1.884 + /* rendering. */ 1.885 + /* */ 1.886 + /* <Note> */ 1.887 + /* This structure is used by the span drawing callback type named */ 1.888 + /* @FT_SpanFunc which takes the y~coordinate of the span as a */ 1.889 + /* a parameter. */ 1.890 + /* */ 1.891 + /* The coverage value is always between 0 and 255. If you want less */ 1.892 + /* gray values, the callback function has to reduce them. */ 1.893 + /* */ 1.894 + typedef struct FT_Span_ 1.895 + { 1.896 + short x; 1.897 + unsigned short len; 1.898 + unsigned char coverage; 1.899 + 1.900 + } FT_Span; 1.901 + 1.902 + 1.903 + /*************************************************************************/ 1.904 + /* */ 1.905 + /* <FuncType> */ 1.906 + /* FT_SpanFunc */ 1.907 + /* */ 1.908 + /* <Description> */ 1.909 + /* A function used as a call-back by the anti-aliased renderer in */ 1.910 + /* order to let client applications draw themselves the gray pixel */ 1.911 + /* spans on each scan line. */ 1.912 + /* */ 1.913 + /* <Input> */ 1.914 + /* y :: The scanline's y~coordinate. */ 1.915 + /* */ 1.916 + /* count :: The number of spans to draw on this scanline. */ 1.917 + /* */ 1.918 + /* spans :: A table of `count' spans to draw on the scanline. */ 1.919 + /* */ 1.920 + /* user :: User-supplied data that is passed to the callback. */ 1.921 + /* */ 1.922 + /* <Note> */ 1.923 + /* This callback allows client applications to directly render the */ 1.924 + /* gray spans of the anti-aliased bitmap to any kind of surfaces. */ 1.925 + /* */ 1.926 + /* This can be used to write anti-aliased outlines directly to a */ 1.927 + /* given background bitmap, and even perform translucency. */ 1.928 + /* */ 1.929 + /* Note that the `count' field cannot be greater than a fixed value */ 1.930 + /* defined by the `FT_MAX_GRAY_SPANS' configuration macro in */ 1.931 + /* `ftoption.h'. By default, this value is set to~32, which means */ 1.932 + /* that if there are more than 32~spans on a given scanline, the */ 1.933 + /* callback is called several times with the same `y' parameter in */ 1.934 + /* order to draw all callbacks. */ 1.935 + /* */ 1.936 + /* Otherwise, the callback is only called once per scan-line, and */ 1.937 + /* only for those scanlines that do have `gray' pixels on them. */ 1.938 + /* */ 1.939 + typedef void 1.940 + (*FT_SpanFunc)( int y, 1.941 + int count, 1.942 + const FT_Span* spans, 1.943 + void* user ); 1.944 + 1.945 +#define FT_Raster_Span_Func FT_SpanFunc 1.946 + 1.947 + 1.948 + /*************************************************************************/ 1.949 + /* */ 1.950 + /* <FuncType> */ 1.951 + /* FT_Raster_BitTest_Func */ 1.952 + /* */ 1.953 + /* <Description> */ 1.954 + /* THIS TYPE IS DEPRECATED. DO NOT USE IT. */ 1.955 + /* */ 1.956 + /* A function used as a call-back by the monochrome scan-converter */ 1.957 + /* to test whether a given target pixel is already set to the drawing */ 1.958 + /* `color'. These tests are crucial to implement drop-out control */ 1.959 + /* per-se the TrueType spec. */ 1.960 + /* */ 1.961 + /* <Input> */ 1.962 + /* y :: The pixel's y~coordinate. */ 1.963 + /* */ 1.964 + /* x :: The pixel's x~coordinate. */ 1.965 + /* */ 1.966 + /* user :: User-supplied data that is passed to the callback. */ 1.967 + /* */ 1.968 + /* <Return> */ 1.969 + /* 1~if the pixel is `set', 0~otherwise. */ 1.970 + /* */ 1.971 + typedef int 1.972 + (*FT_Raster_BitTest_Func)( int y, 1.973 + int x, 1.974 + void* user ); 1.975 + 1.976 + 1.977 + /*************************************************************************/ 1.978 + /* */ 1.979 + /* <FuncType> */ 1.980 + /* FT_Raster_BitSet_Func */ 1.981 + /* */ 1.982 + /* <Description> */ 1.983 + /* THIS TYPE IS DEPRECATED. DO NOT USE IT. */ 1.984 + /* */ 1.985 + /* A function used as a call-back by the monochrome scan-converter */ 1.986 + /* to set an individual target pixel. This is crucial to implement */ 1.987 + /* drop-out control according to the TrueType specification. */ 1.988 + /* */ 1.989 + /* <Input> */ 1.990 + /* y :: The pixel's y~coordinate. */ 1.991 + /* */ 1.992 + /* x :: The pixel's x~coordinate. */ 1.993 + /* */ 1.994 + /* user :: User-supplied data that is passed to the callback. */ 1.995 + /* */ 1.996 + /* <Return> */ 1.997 + /* 1~if the pixel is `set', 0~otherwise. */ 1.998 + /* */ 1.999 + typedef void 1.1000 + (*FT_Raster_BitSet_Func)( int y, 1.1001 + int x, 1.1002 + void* user ); 1.1003 + 1.1004 + 1.1005 + /*************************************************************************/ 1.1006 + /* */ 1.1007 + /* <Enum> */ 1.1008 + /* FT_RASTER_FLAG_XXX */ 1.1009 + /* */ 1.1010 + /* <Description> */ 1.1011 + /* A list of bit flag constants as used in the `flags' field of a */ 1.1012 + /* @FT_Raster_Params structure. */ 1.1013 + /* */ 1.1014 + /* <Values> */ 1.1015 + /* FT_RASTER_FLAG_DEFAULT :: This value is 0. */ 1.1016 + /* */ 1.1017 + /* FT_RASTER_FLAG_AA :: This flag is set to indicate that an */ 1.1018 + /* anti-aliased glyph image should be */ 1.1019 + /* generated. Otherwise, it will be */ 1.1020 + /* monochrome (1-bit). */ 1.1021 + /* */ 1.1022 + /* FT_RASTER_FLAG_DIRECT :: This flag is set to indicate direct */ 1.1023 + /* rendering. In this mode, client */ 1.1024 + /* applications must provide their own span */ 1.1025 + /* callback. This lets them directly */ 1.1026 + /* draw or compose over an existing bitmap. */ 1.1027 + /* If this bit is not set, the target */ 1.1028 + /* pixmap's buffer _must_ be zeroed before */ 1.1029 + /* rendering. */ 1.1030 + /* */ 1.1031 + /* Note that for now, direct rendering is */ 1.1032 + /* only possible with anti-aliased glyphs. */ 1.1033 + /* */ 1.1034 + /* FT_RASTER_FLAG_CLIP :: This flag is only used in direct */ 1.1035 + /* rendering mode. If set, the output will */ 1.1036 + /* be clipped to a box specified in the */ 1.1037 + /* `clip_box' field of the */ 1.1038 + /* @FT_Raster_Params structure. */ 1.1039 + /* */ 1.1040 + /* Note that by default, the glyph bitmap */ 1.1041 + /* is clipped to the target pixmap, except */ 1.1042 + /* in direct rendering mode where all spans */ 1.1043 + /* are generated if no clipping box is set. */ 1.1044 + /* */ 1.1045 +#define FT_RASTER_FLAG_DEFAULT 0x0 1.1046 +#define FT_RASTER_FLAG_AA 0x1 1.1047 +#define FT_RASTER_FLAG_DIRECT 0x2 1.1048 +#define FT_RASTER_FLAG_CLIP 0x4 1.1049 + 1.1050 + /* deprecated */ 1.1051 +#define ft_raster_flag_default FT_RASTER_FLAG_DEFAULT 1.1052 +#define ft_raster_flag_aa FT_RASTER_FLAG_AA 1.1053 +#define ft_raster_flag_direct FT_RASTER_FLAG_DIRECT 1.1054 +#define ft_raster_flag_clip FT_RASTER_FLAG_CLIP 1.1055 + 1.1056 + 1.1057 + /*************************************************************************/ 1.1058 + /* */ 1.1059 + /* <Struct> */ 1.1060 + /* FT_Raster_Params */ 1.1061 + /* */ 1.1062 + /* <Description> */ 1.1063 + /* A structure to hold the arguments used by a raster's render */ 1.1064 + /* function. */ 1.1065 + /* */ 1.1066 + /* <Fields> */ 1.1067 + /* target :: The target bitmap. */ 1.1068 + /* */ 1.1069 + /* source :: A pointer to the source glyph image (e.g., an */ 1.1070 + /* @FT_Outline). */ 1.1071 + /* */ 1.1072 + /* flags :: The rendering flags. */ 1.1073 + /* */ 1.1074 + /* gray_spans :: The gray span drawing callback. */ 1.1075 + /* */ 1.1076 + /* black_spans :: The black span drawing callback. UNIMPLEMENTED! */ 1.1077 + /* */ 1.1078 + /* bit_test :: The bit test callback. UNIMPLEMENTED! */ 1.1079 + /* */ 1.1080 + /* bit_set :: The bit set callback. UNIMPLEMENTED! */ 1.1081 + /* */ 1.1082 + /* user :: User-supplied data that is passed to each drawing */ 1.1083 + /* callback. */ 1.1084 + /* */ 1.1085 + /* clip_box :: An optional clipping box. It is only used in */ 1.1086 + /* direct rendering mode. Note that coordinates here */ 1.1087 + /* should be expressed in _integer_ pixels (and not in */ 1.1088 + /* 26.6 fixed-point units). */ 1.1089 + /* */ 1.1090 + /* <Note> */ 1.1091 + /* An anti-aliased glyph bitmap is drawn if the @FT_RASTER_FLAG_AA */ 1.1092 + /* bit flag is set in the `flags' field, otherwise a monochrome */ 1.1093 + /* bitmap is generated. */ 1.1094 + /* */ 1.1095 + /* If the @FT_RASTER_FLAG_DIRECT bit flag is set in `flags', the */ 1.1096 + /* raster will call the `gray_spans' callback to draw gray pixel */ 1.1097 + /* spans, in the case of an aa glyph bitmap, it will call */ 1.1098 + /* `black_spans', and `bit_test' and `bit_set' in the case of a */ 1.1099 + /* monochrome bitmap. This allows direct composition over a */ 1.1100 + /* pre-existing bitmap through user-provided callbacks to perform the */ 1.1101 + /* span drawing/composition. */ 1.1102 + /* */ 1.1103 + /* Note that the `bit_test' and `bit_set' callbacks are required when */ 1.1104 + /* rendering a monochrome bitmap, as they are crucial to implement */ 1.1105 + /* correct drop-out control as defined in the TrueType specification. */ 1.1106 + /* */ 1.1107 + typedef struct FT_Raster_Params_ 1.1108 + { 1.1109 + const FT_Bitmap* target; 1.1110 + const void* source; 1.1111 + int flags; 1.1112 + FT_SpanFunc gray_spans; 1.1113 + FT_SpanFunc black_spans; /* doesn't work! */ 1.1114 + FT_Raster_BitTest_Func bit_test; /* doesn't work! */ 1.1115 + FT_Raster_BitSet_Func bit_set; /* doesn't work! */ 1.1116 + void* user; 1.1117 + FT_BBox clip_box; 1.1118 + 1.1119 + } FT_Raster_Params; 1.1120 + 1.1121 + 1.1122 + /*************************************************************************/ 1.1123 + /* */ 1.1124 + /* <FuncType> */ 1.1125 + /* FT_Raster_NewFunc */ 1.1126 + /* */ 1.1127 + /* <Description> */ 1.1128 + /* A function used to create a new raster object. */ 1.1129 + /* */ 1.1130 + /* <Input> */ 1.1131 + /* memory :: A handle to the memory allocator. */ 1.1132 + /* */ 1.1133 + /* <Output> */ 1.1134 + /* raster :: A handle to the new raster object. */ 1.1135 + /* */ 1.1136 + /* <Return> */ 1.1137 + /* Error code. 0~means success. */ 1.1138 + /* */ 1.1139 + /* <Note> */ 1.1140 + /* The `memory' parameter is a typeless pointer in order to avoid */ 1.1141 + /* un-wanted dependencies on the rest of the FreeType code. In */ 1.1142 + /* practice, it is an @FT_Memory object, i.e., a handle to the */ 1.1143 + /* standard FreeType memory allocator. However, this field can be */ 1.1144 + /* completely ignored by a given raster implementation. */ 1.1145 + /* */ 1.1146 + typedef int 1.1147 + (*FT_Raster_NewFunc)( void* memory, 1.1148 + FT_Raster* raster ); 1.1149 + 1.1150 +#define FT_Raster_New_Func FT_Raster_NewFunc 1.1151 + 1.1152 + 1.1153 + /*************************************************************************/ 1.1154 + /* */ 1.1155 + /* <FuncType> */ 1.1156 + /* FT_Raster_DoneFunc */ 1.1157 + /* */ 1.1158 + /* <Description> */ 1.1159 + /* A function used to destroy a given raster object. */ 1.1160 + /* */ 1.1161 + /* <Input> */ 1.1162 + /* raster :: A handle to the raster object. */ 1.1163 + /* */ 1.1164 + typedef void 1.1165 + (*FT_Raster_DoneFunc)( FT_Raster raster ); 1.1166 + 1.1167 +#define FT_Raster_Done_Func FT_Raster_DoneFunc 1.1168 + 1.1169 + 1.1170 + /*************************************************************************/ 1.1171 + /* */ 1.1172 + /* <FuncType> */ 1.1173 + /* FT_Raster_ResetFunc */ 1.1174 + /* */ 1.1175 + /* <Description> */ 1.1176 + /* FreeType provides an area of memory called the `render pool', */ 1.1177 + /* available to all registered rasters. This pool can be freely used */ 1.1178 + /* during a given scan-conversion but is shared by all rasters. Its */ 1.1179 + /* content is thus transient. */ 1.1180 + /* */ 1.1181 + /* This function is called each time the render pool changes, or just */ 1.1182 + /* after a new raster object is created. */ 1.1183 + /* */ 1.1184 + /* <Input> */ 1.1185 + /* raster :: A handle to the new raster object. */ 1.1186 + /* */ 1.1187 + /* pool_base :: The address in memory of the render pool. */ 1.1188 + /* */ 1.1189 + /* pool_size :: The size in bytes of the render pool. */ 1.1190 + /* */ 1.1191 + /* <Note> */ 1.1192 + /* Rasters can ignore the render pool and rely on dynamic memory */ 1.1193 + /* allocation if they want to (a handle to the memory allocator is */ 1.1194 + /* passed to the raster constructor). However, this is not */ 1.1195 + /* recommended for efficiency purposes. */ 1.1196 + /* */ 1.1197 + typedef void 1.1198 + (*FT_Raster_ResetFunc)( FT_Raster raster, 1.1199 + unsigned char* pool_base, 1.1200 + unsigned long pool_size ); 1.1201 + 1.1202 +#define FT_Raster_Reset_Func FT_Raster_ResetFunc 1.1203 + 1.1204 + 1.1205 + /*************************************************************************/ 1.1206 + /* */ 1.1207 + /* <FuncType> */ 1.1208 + /* FT_Raster_SetModeFunc */ 1.1209 + /* */ 1.1210 + /* <Description> */ 1.1211 + /* This function is a generic facility to change modes or attributes */ 1.1212 + /* in a given raster. This can be used for debugging purposes, or */ 1.1213 + /* simply to allow implementation-specific `features' in a given */ 1.1214 + /* raster module. */ 1.1215 + /* */ 1.1216 + /* <Input> */ 1.1217 + /* raster :: A handle to the new raster object. */ 1.1218 + /* */ 1.1219 + /* mode :: A 4-byte tag used to name the mode or property. */ 1.1220 + /* */ 1.1221 + /* args :: A pointer to the new mode/property to use. */ 1.1222 + /* */ 1.1223 + typedef int 1.1224 + (*FT_Raster_SetModeFunc)( FT_Raster raster, 1.1225 + unsigned long mode, 1.1226 + void* args ); 1.1227 + 1.1228 +#define FT_Raster_Set_Mode_Func FT_Raster_SetModeFunc 1.1229 + 1.1230 + 1.1231 + /*************************************************************************/ 1.1232 + /* */ 1.1233 + /* <FuncType> */ 1.1234 + /* FT_Raster_RenderFunc */ 1.1235 + /* */ 1.1236 + /* <Description> */ 1.1237 + /* Invoke a given raster to scan-convert a given glyph image into a */ 1.1238 + /* target bitmap. */ 1.1239 + /* */ 1.1240 + /* <Input> */ 1.1241 + /* raster :: A handle to the raster object. */ 1.1242 + /* */ 1.1243 + /* params :: A pointer to an @FT_Raster_Params structure used to */ 1.1244 + /* store the rendering parameters. */ 1.1245 + /* */ 1.1246 + /* <Return> */ 1.1247 + /* Error code. 0~means success. */ 1.1248 + /* */ 1.1249 + /* <Note> */ 1.1250 + /* The exact format of the source image depends on the raster's glyph */ 1.1251 + /* format defined in its @FT_Raster_Funcs structure. It can be an */ 1.1252 + /* @FT_Outline or anything else in order to support a large array of */ 1.1253 + /* glyph formats. */ 1.1254 + /* */ 1.1255 + /* Note also that the render function can fail and return a */ 1.1256 + /* `FT_Err_Unimplemented_Feature' error code if the raster used does */ 1.1257 + /* not support direct composition. */ 1.1258 + /* */ 1.1259 + /* XXX: For now, the standard raster doesn't support direct */ 1.1260 + /* composition but this should change for the final release (see */ 1.1261 + /* the files `demos/src/ftgrays.c' and `demos/src/ftgrays2.c' */ 1.1262 + /* for examples of distinct implementations which support direct */ 1.1263 + /* composition). */ 1.1264 + /* */ 1.1265 + typedef int 1.1266 + (*FT_Raster_RenderFunc)( FT_Raster raster, 1.1267 + const FT_Raster_Params* params ); 1.1268 + 1.1269 +#define FT_Raster_Render_Func FT_Raster_RenderFunc 1.1270 + 1.1271 + 1.1272 + /*************************************************************************/ 1.1273 + /* */ 1.1274 + /* <Struct> */ 1.1275 + /* FT_Raster_Funcs */ 1.1276 + /* */ 1.1277 + /* <Description> */ 1.1278 + /* A structure used to describe a given raster class to the library. */ 1.1279 + /* */ 1.1280 + /* <Fields> */ 1.1281 + /* glyph_format :: The supported glyph format for this raster. */ 1.1282 + /* */ 1.1283 + /* raster_new :: The raster constructor. */ 1.1284 + /* */ 1.1285 + /* raster_reset :: Used to reset the render pool within the raster. */ 1.1286 + /* */ 1.1287 + /* raster_render :: A function to render a glyph into a given bitmap. */ 1.1288 + /* */ 1.1289 + /* raster_done :: The raster destructor. */ 1.1290 + /* */ 1.1291 + typedef struct FT_Raster_Funcs_ 1.1292 + { 1.1293 + FT_Glyph_Format glyph_format; 1.1294 + FT_Raster_NewFunc raster_new; 1.1295 + FT_Raster_ResetFunc raster_reset; 1.1296 + FT_Raster_SetModeFunc raster_set_mode; 1.1297 + FT_Raster_RenderFunc raster_render; 1.1298 + FT_Raster_DoneFunc raster_done; 1.1299 + 1.1300 + } FT_Raster_Funcs; 1.1301 + 1.1302 + 1.1303 + /* */ 1.1304 + 1.1305 + 1.1306 +FT_END_HEADER 1.1307 + 1.1308 +#endif /* __FTIMAGE_H__ */ 1.1309 + 1.1310 + 1.1311 +/* END */ 1.1312 + 1.1313 + 1.1314 +/* Local Variables: */ 1.1315 +/* coding: utf-8 */ 1.1316 +/* End: */