nuclear@0: /***************************************************************************/ nuclear@0: /* */ nuclear@0: /* ftimage.h */ nuclear@0: /* */ nuclear@0: /* FreeType glyph image formats and default raster interface */ nuclear@0: /* (specification). */ nuclear@0: /* */ nuclear@0: /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ nuclear@0: /* 2010 by */ nuclear@0: /* David Turner, Robert Wilhelm, and Werner Lemberg. */ nuclear@0: /* */ nuclear@0: /* This file is part of the FreeType project, and may only be used, */ nuclear@0: /* modified, and distributed under the terms of the FreeType project */ nuclear@0: /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ nuclear@0: /* this file you indicate that you have read the license and */ nuclear@0: /* understand and accept it fully. */ nuclear@0: /* */ nuclear@0: /***************************************************************************/ nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* Note: A `raster' is simply a scan-line converter, used to render */ nuclear@0: /* FT_Outlines into FT_Bitmaps. */ nuclear@0: /* */ nuclear@0: /*************************************************************************/ nuclear@0: nuclear@0: nuclear@0: #ifndef __FTIMAGE_H__ nuclear@0: #define __FTIMAGE_H__ nuclear@0: nuclear@0: nuclear@0: /* _STANDALONE_ is from ftgrays.c */ nuclear@0: #ifndef _STANDALONE_ nuclear@0: #include nuclear@0: #endif nuclear@0: nuclear@0: nuclear@0: FT_BEGIN_HEADER nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /*
*/ nuclear@0: /* basic_types */ nuclear@0: /* */ nuclear@0: /*************************************************************************/ nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FT_Pos */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* The type FT_Pos is used to store vectorial coordinates. Depending */ nuclear@0: /* on the context, these can represent distances in integer font */ nuclear@0: /* units, or 16.16, or 26.6 fixed float pixel coordinates. */ nuclear@0: /* */ nuclear@0: typedef signed long FT_Pos; nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FT_Vector */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* A simple structure used to store a 2D vector; coordinates are of */ nuclear@0: /* the FT_Pos type. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* x :: The horizontal coordinate. */ nuclear@0: /* y :: The vertical coordinate. */ nuclear@0: /* */ nuclear@0: typedef struct FT_Vector_ nuclear@0: { nuclear@0: FT_Pos x; nuclear@0: FT_Pos y; nuclear@0: nuclear@0: } FT_Vector; nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FT_BBox */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* A structure used to hold an outline's bounding box, i.e., the */ nuclear@0: /* coordinates of its extrema in the horizontal and vertical */ nuclear@0: /* directions. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* xMin :: The horizontal minimum (left-most). */ nuclear@0: /* */ nuclear@0: /* yMin :: The vertical minimum (bottom-most). */ nuclear@0: /* */ nuclear@0: /* xMax :: The horizontal maximum (right-most). */ nuclear@0: /* */ nuclear@0: /* yMax :: The vertical maximum (top-most). */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* The bounding box is specified with the coordinates of the lower */ nuclear@0: /* left and the upper right corner. In PostScript, those values are */ nuclear@0: /* often called (llx,lly) and (urx,ury), respectively. */ nuclear@0: /* */ nuclear@0: /* If `yMin' is negative, this value gives the glyph's descender. */ nuclear@0: /* Otherwise, the glyph doesn't descend below the baseline. */ nuclear@0: /* Similarly, if `ymax' is positive, this value gives the glyph's */ nuclear@0: /* ascender. */ nuclear@0: /* */ nuclear@0: /* `xMin' gives the horizontal distance from the glyph's origin to */ nuclear@0: /* the left edge of the glyph's bounding box. If `xMin' is negative, */ nuclear@0: /* the glyph extends to the left of the origin. */ nuclear@0: /* */ nuclear@0: typedef struct FT_BBox_ nuclear@0: { nuclear@0: FT_Pos xMin, yMin; nuclear@0: FT_Pos xMax, yMax; nuclear@0: nuclear@0: } FT_BBox; nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FT_Pixel_Mode */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* An enumeration type used to describe the format of pixels in a */ nuclear@0: /* given bitmap. Note that additional formats may be added in the */ nuclear@0: /* future. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FT_PIXEL_MODE_NONE :: */ nuclear@0: /* Value~0 is reserved. */ nuclear@0: /* */ nuclear@0: /* FT_PIXEL_MODE_MONO :: */ nuclear@0: /* A monochrome bitmap, using 1~bit per pixel. Note that pixels */ nuclear@0: /* are stored in most-significant order (MSB), which means that */ nuclear@0: /* the left-most pixel in a byte has value 128. */ nuclear@0: /* */ nuclear@0: /* FT_PIXEL_MODE_GRAY :: */ nuclear@0: /* An 8-bit bitmap, generally used to represent anti-aliased glyph */ nuclear@0: /* images. Each pixel is stored in one byte. Note that the number */ nuclear@0: /* of `gray' levels is stored in the `num_grays' field of the */ nuclear@0: /* @FT_Bitmap structure (it generally is 256). */ nuclear@0: /* */ nuclear@0: /* FT_PIXEL_MODE_GRAY2 :: */ nuclear@0: /* A 2-bit per pixel bitmap, used to represent embedded */ nuclear@0: /* anti-aliased bitmaps in font files according to the OpenType */ nuclear@0: /* specification. We haven't found a single font using this */ nuclear@0: /* format, however. */ nuclear@0: /* */ nuclear@0: /* FT_PIXEL_MODE_GRAY4 :: */ nuclear@0: /* A 4-bit per pixel bitmap, representing embedded anti-aliased */ nuclear@0: /* bitmaps in font files according to the OpenType specification. */ nuclear@0: /* We haven't found a single font using this format, however. */ nuclear@0: /* */ nuclear@0: /* FT_PIXEL_MODE_LCD :: */ nuclear@0: /* An 8-bit bitmap, representing RGB or BGR decimated glyph images */ nuclear@0: /* used for display on LCD displays; the bitmap is three times */ nuclear@0: /* wider than the original glyph image. See also */ nuclear@0: /* @FT_RENDER_MODE_LCD. */ nuclear@0: /* */ nuclear@0: /* FT_PIXEL_MODE_LCD_V :: */ nuclear@0: /* An 8-bit bitmap, representing RGB or BGR decimated glyph images */ nuclear@0: /* used for display on rotated LCD displays; the bitmap is three */ nuclear@0: /* times taller than the original glyph image. See also */ nuclear@0: /* @FT_RENDER_MODE_LCD_V. */ nuclear@0: /* */ nuclear@0: typedef enum FT_Pixel_Mode_ nuclear@0: { nuclear@0: FT_PIXEL_MODE_NONE = 0, nuclear@0: FT_PIXEL_MODE_MONO, nuclear@0: FT_PIXEL_MODE_GRAY, nuclear@0: FT_PIXEL_MODE_GRAY2, nuclear@0: FT_PIXEL_MODE_GRAY4, nuclear@0: FT_PIXEL_MODE_LCD, nuclear@0: FT_PIXEL_MODE_LCD_V, nuclear@0: nuclear@0: FT_PIXEL_MODE_MAX /* do not remove */ nuclear@0: nuclear@0: } FT_Pixel_Mode; nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* ft_pixel_mode_xxx */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* A list of deprecated constants. Use the corresponding */ nuclear@0: /* @FT_Pixel_Mode values instead. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* ft_pixel_mode_none :: See @FT_PIXEL_MODE_NONE. */ nuclear@0: /* ft_pixel_mode_mono :: See @FT_PIXEL_MODE_MONO. */ nuclear@0: /* ft_pixel_mode_grays :: See @FT_PIXEL_MODE_GRAY. */ nuclear@0: /* ft_pixel_mode_pal2 :: See @FT_PIXEL_MODE_GRAY2. */ nuclear@0: /* ft_pixel_mode_pal4 :: See @FT_PIXEL_MODE_GRAY4. */ nuclear@0: /* */ nuclear@0: #define ft_pixel_mode_none FT_PIXEL_MODE_NONE nuclear@0: #define ft_pixel_mode_mono FT_PIXEL_MODE_MONO nuclear@0: #define ft_pixel_mode_grays FT_PIXEL_MODE_GRAY nuclear@0: #define ft_pixel_mode_pal2 FT_PIXEL_MODE_GRAY2 nuclear@0: #define ft_pixel_mode_pal4 FT_PIXEL_MODE_GRAY4 nuclear@0: nuclear@0: /* */ nuclear@0: nuclear@0: #if 0 nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FT_Palette_Mode */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* THIS TYPE IS DEPRECATED. DO NOT USE IT! */ nuclear@0: /* */ nuclear@0: /* An enumeration type to describe the format of a bitmap palette, */ nuclear@0: /* used with ft_pixel_mode_pal4 and ft_pixel_mode_pal8. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* ft_palette_mode_rgb :: The palette is an array of 3-byte RGB */ nuclear@0: /* records. */ nuclear@0: /* */ nuclear@0: /* ft_palette_mode_rgba :: The palette is an array of 4-byte RGBA */ nuclear@0: /* records. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* As ft_pixel_mode_pal2, pal4 and pal8 are currently unused by */ nuclear@0: /* FreeType, these types are not handled by the library itself. */ nuclear@0: /* */ nuclear@0: typedef enum FT_Palette_Mode_ nuclear@0: { nuclear@0: ft_palette_mode_rgb = 0, nuclear@0: ft_palette_mode_rgba, nuclear@0: nuclear@0: ft_palette_mode_max /* do not remove */ nuclear@0: nuclear@0: } FT_Palette_Mode; nuclear@0: nuclear@0: /* */ nuclear@0: nuclear@0: #endif nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FT_Bitmap */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* A structure used to describe a bitmap or pixmap to the raster. */ nuclear@0: /* Note that we now manage pixmaps of various depths through the */ nuclear@0: /* `pixel_mode' field. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* rows :: The number of bitmap rows. */ nuclear@0: /* */ nuclear@0: /* width :: The number of pixels in bitmap row. */ nuclear@0: /* */ nuclear@0: /* pitch :: The pitch's absolute value is the number of bytes */ nuclear@0: /* taken by one bitmap row, including padding. */ nuclear@0: /* However, the pitch is positive when the bitmap has */ nuclear@0: /* a `down' flow, and negative when it has an `up' */ nuclear@0: /* flow. In all cases, the pitch is an offset to add */ nuclear@0: /* to a bitmap pointer in order to go down one row. */ nuclear@0: /* */ nuclear@0: /* Note that `padding' means the alignment of a */ nuclear@0: /* bitmap to a byte border, and FreeType functions */ nuclear@0: /* normally align to the smallest possible integer */ nuclear@0: /* value. */ nuclear@0: /* */ nuclear@0: /* For the B/W rasterizer, `pitch' is always an even */ nuclear@0: /* number. */ nuclear@0: /* */ nuclear@0: /* To change the pitch of a bitmap (say, to make it a */ nuclear@0: /* multiple of 4), use @FT_Bitmap_Convert. */ nuclear@0: /* Alternatively, you might use callback functions to */ nuclear@0: /* directly render to the application's surface; see */ nuclear@0: /* the file `example2.cpp' in the tutorial for a */ nuclear@0: /* demonstration. */ nuclear@0: /* */ nuclear@0: /* buffer :: A typeless pointer to the bitmap buffer. This */ nuclear@0: /* value should be aligned on 32-bit boundaries in */ nuclear@0: /* most cases. */ nuclear@0: /* */ nuclear@0: /* num_grays :: This field is only used with */ nuclear@0: /* @FT_PIXEL_MODE_GRAY; it gives the number of gray */ nuclear@0: /* levels used in the bitmap. */ nuclear@0: /* */ nuclear@0: /* pixel_mode :: The pixel mode, i.e., how pixel bits are stored. */ nuclear@0: /* See @FT_Pixel_Mode for possible values. */ nuclear@0: /* */ nuclear@0: /* palette_mode :: This field is intended for paletted pixel modes; */ nuclear@0: /* it indicates how the palette is stored. Not */ nuclear@0: /* used currently. */ nuclear@0: /* */ nuclear@0: /* palette :: A typeless pointer to the bitmap palette; this */ nuclear@0: /* field is intended for paletted pixel modes. Not */ nuclear@0: /* used currently. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* For now, the only pixel modes supported by FreeType are mono and */ nuclear@0: /* grays. However, drivers might be added in the future to support */ nuclear@0: /* more `colorful' options. */ nuclear@0: /* */ nuclear@0: typedef struct FT_Bitmap_ nuclear@0: { nuclear@0: int rows; nuclear@0: int width; nuclear@0: int pitch; nuclear@0: unsigned char* buffer; nuclear@0: short num_grays; nuclear@0: char pixel_mode; nuclear@0: char palette_mode; nuclear@0: void* palette; nuclear@0: nuclear@0: } FT_Bitmap; nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /*
*/ nuclear@0: /* outline_processing */ nuclear@0: /* */ nuclear@0: /*************************************************************************/ nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FT_Outline */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* This structure is used to describe an outline to the scan-line */ nuclear@0: /* converter. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* n_contours :: The number of contours in the outline. */ nuclear@0: /* */ nuclear@0: /* n_points :: The number of points in the outline. */ nuclear@0: /* */ nuclear@0: /* points :: A pointer to an array of `n_points' @FT_Vector */ nuclear@0: /* elements, giving the outline's point coordinates. */ nuclear@0: /* */ nuclear@0: /* tags :: A pointer to an array of `n_points' chars, giving */ nuclear@0: /* each outline point's type. */ nuclear@0: /* */ nuclear@0: /* If bit~0 is unset, the point is `off' the curve, */ nuclear@0: /* i.e., a Bézier control point, while it is `on' if */ nuclear@0: /* set. */ nuclear@0: /* */ nuclear@0: /* Bit~1 is meaningful for `off' points only. If set, */ nuclear@0: /* it indicates a third-order Bézier arc control point; */ nuclear@0: /* and a second-order control point if unset. */ nuclear@0: /* */ nuclear@0: /* If bit~2 is set, bits 5-7 contain the drop-out mode */ nuclear@0: /* (as defined in the OpenType specification; the value */ nuclear@0: /* is the same as the argument to the SCANMODE */ nuclear@0: /* instruction). */ nuclear@0: /* */ nuclear@0: /* Bits 3 and~4 are reserved for internal purposes. */ nuclear@0: /* */ nuclear@0: /* contours :: An array of `n_contours' shorts, giving the end */ nuclear@0: /* point of each contour within the outline. For */ nuclear@0: /* example, the first contour is defined by the points */ nuclear@0: /* `0' to `contours[0]', the second one is defined by */ nuclear@0: /* the points `contours[0]+1' to `contours[1]', etc. */ nuclear@0: /* */ nuclear@0: /* flags :: A set of bit flags used to characterize the outline */ nuclear@0: /* and give hints to the scan-converter and hinter on */ nuclear@0: /* how to convert/grid-fit it. See @FT_OUTLINE_FLAGS. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* The B/W rasterizer only checks bit~2 in the `tags' array for the */ nuclear@0: /* first point of each contour. The drop-out mode as given with */ nuclear@0: /* @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and */ nuclear@0: /* @FT_OUTLINE_INCLUDE_STUBS in `flags' is then overridden. */ nuclear@0: /* */ nuclear@0: typedef struct FT_Outline_ nuclear@0: { nuclear@0: short n_contours; /* number of contours in glyph */ nuclear@0: short n_points; /* number of points in the glyph */ nuclear@0: nuclear@0: FT_Vector* points; /* the outline's points */ nuclear@0: char* tags; /* the points flags */ nuclear@0: short* contours; /* the contour end points */ nuclear@0: nuclear@0: int flags; /* outline masks */ nuclear@0: nuclear@0: } FT_Outline; nuclear@0: nuclear@0: /* Following limits must be consistent with */ nuclear@0: /* FT_Outline.{n_contours,n_points} */ nuclear@0: #define FT_OUTLINE_CONTOURS_MAX SHRT_MAX nuclear@0: #define FT_OUTLINE_POINTS_MAX SHRT_MAX nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FT_OUTLINE_FLAGS */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* A list of bit-field constants use for the flags in an outline's */ nuclear@0: /* `flags' field. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FT_OUTLINE_NONE :: */ nuclear@0: /* Value~0 is reserved. */ nuclear@0: /* */ nuclear@0: /* FT_OUTLINE_OWNER :: */ nuclear@0: /* If set, this flag indicates that the outline's field arrays */ nuclear@0: /* (i.e., `points', `flags', and `contours') are `owned' by the */ nuclear@0: /* outline object, and should thus be freed when it is destroyed. */ nuclear@0: /* */ nuclear@0: /* FT_OUTLINE_EVEN_ODD_FILL :: */ nuclear@0: /* By default, outlines are filled using the non-zero winding rule. */ nuclear@0: /* If set to 1, the outline will be filled using the even-odd fill */ nuclear@0: /* rule (only works with the smooth rasterizer). */ nuclear@0: /* */ nuclear@0: /* FT_OUTLINE_REVERSE_FILL :: */ nuclear@0: /* By default, outside contours of an outline are oriented in */ nuclear@0: /* clock-wise direction, as defined in the TrueType specification. */ nuclear@0: /* This flag is set if the outline uses the opposite direction */ nuclear@0: /* (typically for Type~1 fonts). This flag is ignored by the scan */ nuclear@0: /* converter. */ nuclear@0: /* */ nuclear@0: /* FT_OUTLINE_IGNORE_DROPOUTS :: */ nuclear@0: /* By default, the scan converter will try to detect drop-outs in */ nuclear@0: /* an outline and correct the glyph bitmap to ensure consistent */ nuclear@0: /* shape continuity. If set, this flag hints the scan-line */ nuclear@0: /* converter to ignore such cases. See below for more information. */ nuclear@0: /* */ nuclear@0: /* FT_OUTLINE_SMART_DROPOUTS :: */ nuclear@0: /* Select smart dropout control. If unset, use simple dropout */ nuclear@0: /* control. Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See */ nuclear@0: /* below for more information. */ nuclear@0: /* */ nuclear@0: /* FT_OUTLINE_INCLUDE_STUBS :: */ nuclear@0: /* If set, turn pixels on for `stubs', otherwise exclude them. */ nuclear@0: /* Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See below for */ nuclear@0: /* more information. */ nuclear@0: /* */ nuclear@0: /* FT_OUTLINE_HIGH_PRECISION :: */ nuclear@0: /* This flag indicates that the scan-line converter should try to */ nuclear@0: /* convert this outline to bitmaps with the highest possible */ nuclear@0: /* quality. It is typically set for small character sizes. Note */ nuclear@0: /* that this is only a hint that might be completely ignored by a */ nuclear@0: /* given scan-converter. */ nuclear@0: /* */ nuclear@0: /* FT_OUTLINE_SINGLE_PASS :: */ nuclear@0: /* This flag is set to force a given scan-converter to only use a */ nuclear@0: /* single pass over the outline to render a bitmap glyph image. */ nuclear@0: /* Normally, it is set for very large character sizes. It is only */ nuclear@0: /* a hint that might be completely ignored by a given */ nuclear@0: /* scan-converter. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* The flags @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, */ nuclear@0: /* and @FT_OUTLINE_INCLUDE_STUBS are ignored by the smooth */ nuclear@0: /* rasterizer. */ nuclear@0: /* */ nuclear@0: /* There exists a second mechanism to pass the drop-out mode to the */ nuclear@0: /* B/W rasterizer; see the `tags' field in @FT_Outline. */ nuclear@0: /* */ nuclear@0: /* Please refer to the description of the `SCANTYPE' instruction in */ nuclear@0: /* the OpenType specification (in file `ttinst1.doc') how simple */ nuclear@0: /* drop-outs, smart drop-outs, and stubs are defined. */ nuclear@0: /* */ nuclear@0: #define FT_OUTLINE_NONE 0x0 nuclear@0: #define FT_OUTLINE_OWNER 0x1 nuclear@0: #define FT_OUTLINE_EVEN_ODD_FILL 0x2 nuclear@0: #define FT_OUTLINE_REVERSE_FILL 0x4 nuclear@0: #define FT_OUTLINE_IGNORE_DROPOUTS 0x8 nuclear@0: #define FT_OUTLINE_SMART_DROPOUTS 0x10 nuclear@0: #define FT_OUTLINE_INCLUDE_STUBS 0x20 nuclear@0: nuclear@0: #define FT_OUTLINE_HIGH_PRECISION 0x100 nuclear@0: #define FT_OUTLINE_SINGLE_PASS 0x200 nuclear@0: nuclear@0: nuclear@0: /************************************************************************* nuclear@0: * nuclear@0: * @enum: nuclear@0: * ft_outline_flags nuclear@0: * nuclear@0: * @description: nuclear@0: * These constants are deprecated. Please use the corresponding nuclear@0: * @FT_OUTLINE_FLAGS values. nuclear@0: * nuclear@0: * @values: nuclear@0: * ft_outline_none :: See @FT_OUTLINE_NONE. nuclear@0: * ft_outline_owner :: See @FT_OUTLINE_OWNER. nuclear@0: * ft_outline_even_odd_fill :: See @FT_OUTLINE_EVEN_ODD_FILL. nuclear@0: * ft_outline_reverse_fill :: See @FT_OUTLINE_REVERSE_FILL. nuclear@0: * ft_outline_ignore_dropouts :: See @FT_OUTLINE_IGNORE_DROPOUTS. nuclear@0: * ft_outline_high_precision :: See @FT_OUTLINE_HIGH_PRECISION. nuclear@0: * ft_outline_single_pass :: See @FT_OUTLINE_SINGLE_PASS. nuclear@0: */ nuclear@0: #define ft_outline_none FT_OUTLINE_NONE nuclear@0: #define ft_outline_owner FT_OUTLINE_OWNER nuclear@0: #define ft_outline_even_odd_fill FT_OUTLINE_EVEN_ODD_FILL nuclear@0: #define ft_outline_reverse_fill FT_OUTLINE_REVERSE_FILL nuclear@0: #define ft_outline_ignore_dropouts FT_OUTLINE_IGNORE_DROPOUTS nuclear@0: #define ft_outline_high_precision FT_OUTLINE_HIGH_PRECISION nuclear@0: #define ft_outline_single_pass FT_OUTLINE_SINGLE_PASS nuclear@0: nuclear@0: /* */ nuclear@0: nuclear@0: #define FT_CURVE_TAG( flag ) ( flag & 3 ) nuclear@0: nuclear@0: #define FT_CURVE_TAG_ON 1 nuclear@0: #define FT_CURVE_TAG_CONIC 0 nuclear@0: #define FT_CURVE_TAG_CUBIC 2 nuclear@0: nuclear@0: #define FT_CURVE_TAG_HAS_SCANMODE 4 nuclear@0: nuclear@0: #define FT_CURVE_TAG_TOUCH_X 8 /* reserved for the TrueType hinter */ nuclear@0: #define FT_CURVE_TAG_TOUCH_Y 16 /* reserved for the TrueType hinter */ nuclear@0: nuclear@0: #define FT_CURVE_TAG_TOUCH_BOTH ( FT_CURVE_TAG_TOUCH_X | \ nuclear@0: FT_CURVE_TAG_TOUCH_Y ) nuclear@0: nuclear@0: #define FT_Curve_Tag_On FT_CURVE_TAG_ON nuclear@0: #define FT_Curve_Tag_Conic FT_CURVE_TAG_CONIC nuclear@0: #define FT_Curve_Tag_Cubic FT_CURVE_TAG_CUBIC nuclear@0: #define FT_Curve_Tag_Touch_X FT_CURVE_TAG_TOUCH_X nuclear@0: #define FT_Curve_Tag_Touch_Y FT_CURVE_TAG_TOUCH_Y nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FT_Outline_MoveToFunc */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* A function pointer type used to describe the signature of a `move */ nuclear@0: /* to' function during outline walking/decomposition. */ nuclear@0: /* */ nuclear@0: /* A `move to' is emitted to start a new contour in an outline. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* to :: A pointer to the target point of the `move to'. */ nuclear@0: /* */ nuclear@0: /* user :: A typeless pointer which is passed from the caller of the */ nuclear@0: /* decomposition function. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* Error code. 0~means success. */ nuclear@0: /* */ nuclear@0: typedef int nuclear@0: (*FT_Outline_MoveToFunc)( const FT_Vector* to, nuclear@0: void* user ); nuclear@0: nuclear@0: #define FT_Outline_MoveTo_Func FT_Outline_MoveToFunc nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FT_Outline_LineToFunc */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* A function pointer type used to describe the signature of a `line */ nuclear@0: /* to' function during outline walking/decomposition. */ nuclear@0: /* */ nuclear@0: /* A `line to' is emitted to indicate a segment in the outline. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* to :: A pointer to the target point of the `line to'. */ nuclear@0: /* */ nuclear@0: /* user :: A typeless pointer which is passed from the caller of the */ nuclear@0: /* decomposition function. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* Error code. 0~means success. */ nuclear@0: /* */ nuclear@0: typedef int nuclear@0: (*FT_Outline_LineToFunc)( const FT_Vector* to, nuclear@0: void* user ); nuclear@0: nuclear@0: #define FT_Outline_LineTo_Func FT_Outline_LineToFunc nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FT_Outline_ConicToFunc */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* A function pointer type used to describe the signature of a `conic */ nuclear@0: /* to' function during outline walking or decomposition. */ nuclear@0: /* */ nuclear@0: /* A `conic to' is emitted to indicate a second-order Bézier arc in */ nuclear@0: /* the outline. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* control :: An intermediate control point between the last position */ nuclear@0: /* and the new target in `to'. */ nuclear@0: /* */ nuclear@0: /* to :: A pointer to the target end point of the conic arc. */ nuclear@0: /* */ nuclear@0: /* user :: A typeless pointer which is passed from the caller of */ nuclear@0: /* the decomposition function. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* Error code. 0~means success. */ nuclear@0: /* */ nuclear@0: typedef int nuclear@0: (*FT_Outline_ConicToFunc)( const FT_Vector* control, nuclear@0: const FT_Vector* to, nuclear@0: void* user ); nuclear@0: nuclear@0: #define FT_Outline_ConicTo_Func FT_Outline_ConicToFunc nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FT_Outline_CubicToFunc */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* A function pointer type used to describe the signature of a `cubic */ nuclear@0: /* to' function during outline walking or decomposition. */ nuclear@0: /* */ nuclear@0: /* A `cubic to' is emitted to indicate a third-order Bézier arc. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* control1 :: A pointer to the first Bézier control point. */ nuclear@0: /* */ nuclear@0: /* control2 :: A pointer to the second Bézier control point. */ nuclear@0: /* */ nuclear@0: /* to :: A pointer to the target end point. */ nuclear@0: /* */ nuclear@0: /* user :: A typeless pointer which is passed from the caller of */ nuclear@0: /* the decomposition function. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* Error code. 0~means success. */ nuclear@0: /* */ nuclear@0: typedef int nuclear@0: (*FT_Outline_CubicToFunc)( const FT_Vector* control1, nuclear@0: const FT_Vector* control2, nuclear@0: const FT_Vector* to, nuclear@0: void* user ); nuclear@0: nuclear@0: #define FT_Outline_CubicTo_Func FT_Outline_CubicToFunc nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FT_Outline_Funcs */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* A structure to hold various function pointers used during outline */ nuclear@0: /* decomposition in order to emit segments, conic, and cubic Béziers. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* move_to :: The `move to' emitter. */ nuclear@0: /* */ nuclear@0: /* line_to :: The segment emitter. */ nuclear@0: /* */ nuclear@0: /* conic_to :: The second-order Bézier arc emitter. */ nuclear@0: /* */ nuclear@0: /* cubic_to :: The third-order Bézier arc emitter. */ nuclear@0: /* */ nuclear@0: /* shift :: The shift that is applied to coordinates before they */ nuclear@0: /* are sent to the emitter. */ nuclear@0: /* */ nuclear@0: /* delta :: The delta that is applied to coordinates before they */ nuclear@0: /* are sent to the emitter, but after the shift. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* The point coordinates sent to the emitters are the transformed */ nuclear@0: /* version of the original coordinates (this is important for high */ nuclear@0: /* accuracy during scan-conversion). The transformation is simple: */ nuclear@0: /* */ nuclear@0: /* { */ nuclear@0: /* x' = (x << shift) - delta */ nuclear@0: /* y' = (x << shift) - delta */ nuclear@0: /* } */ nuclear@0: /* */ nuclear@0: /* Set the values of `shift' and `delta' to~0 to get the original */ nuclear@0: /* point coordinates. */ nuclear@0: /* */ nuclear@0: typedef struct FT_Outline_Funcs_ nuclear@0: { nuclear@0: FT_Outline_MoveToFunc move_to; nuclear@0: FT_Outline_LineToFunc line_to; nuclear@0: FT_Outline_ConicToFunc conic_to; nuclear@0: FT_Outline_CubicToFunc cubic_to; nuclear@0: nuclear@0: int shift; nuclear@0: FT_Pos delta; nuclear@0: nuclear@0: } FT_Outline_Funcs; nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /*
*/ nuclear@0: /* basic_types */ nuclear@0: /* */ nuclear@0: /*************************************************************************/ nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FT_IMAGE_TAG */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* This macro converts four-letter tags to an unsigned long type. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* Since many 16-bit compilers don't like 32-bit enumerations, you */ nuclear@0: /* should redefine this macro in case of problems to something like */ nuclear@0: /* this: */ nuclear@0: /* */ nuclear@0: /* { */ nuclear@0: /* #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) value */ nuclear@0: /* } */ nuclear@0: /* */ nuclear@0: /* to get a simple enumeration without assigning special numbers. */ nuclear@0: /* */ nuclear@0: #ifndef FT_IMAGE_TAG nuclear@0: #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) \ nuclear@0: value = ( ( (unsigned long)_x1 << 24 ) | \ nuclear@0: ( (unsigned long)_x2 << 16 ) | \ nuclear@0: ( (unsigned long)_x3 << 8 ) | \ nuclear@0: (unsigned long)_x4 ) nuclear@0: #endif /* FT_IMAGE_TAG */ nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FT_Glyph_Format */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* An enumeration type used to describe the format of a given glyph */ nuclear@0: /* image. Note that this version of FreeType only supports two image */ nuclear@0: /* formats, even though future font drivers will be able to register */ nuclear@0: /* their own format. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FT_GLYPH_FORMAT_NONE :: */ nuclear@0: /* The value~0 is reserved. */ nuclear@0: /* */ nuclear@0: /* FT_GLYPH_FORMAT_COMPOSITE :: */ nuclear@0: /* The glyph image is a composite of several other images. This */ nuclear@0: /* format is _only_ used with @FT_LOAD_NO_RECURSE, and is used to */ nuclear@0: /* report compound glyphs (like accented characters). */ nuclear@0: /* */ nuclear@0: /* FT_GLYPH_FORMAT_BITMAP :: */ nuclear@0: /* The glyph image is a bitmap, and can be described as an */ nuclear@0: /* @FT_Bitmap. You generally need to access the `bitmap' field of */ nuclear@0: /* the @FT_GlyphSlotRec structure to read it. */ nuclear@0: /* */ nuclear@0: /* FT_GLYPH_FORMAT_OUTLINE :: */ nuclear@0: /* The glyph image is a vectorial outline made of line segments */ nuclear@0: /* and Bézier arcs; it can be described as an @FT_Outline; you */ nuclear@0: /* generally want to access the `outline' field of the */ nuclear@0: /* @FT_GlyphSlotRec structure to read it. */ nuclear@0: /* */ nuclear@0: /* FT_GLYPH_FORMAT_PLOTTER :: */ nuclear@0: /* The glyph image is a vectorial path with no inside and outside */ nuclear@0: /* contours. Some Type~1 fonts, like those in the Hershey family, */ nuclear@0: /* contain glyphs in this format. These are described as */ nuclear@0: /* @FT_Outline, but FreeType isn't currently capable of rendering */ nuclear@0: /* them correctly. */ nuclear@0: /* */ nuclear@0: typedef enum FT_Glyph_Format_ nuclear@0: { nuclear@0: FT_IMAGE_TAG( FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0 ), nuclear@0: nuclear@0: FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ), nuclear@0: FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP, 'b', 'i', 't', 's' ), nuclear@0: FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE, 'o', 'u', 't', 'l' ), nuclear@0: FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER, 'p', 'l', 'o', 't' ) nuclear@0: nuclear@0: } FT_Glyph_Format; nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* ft_glyph_format_xxx */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* A list of deprecated constants. Use the corresponding */ nuclear@0: /* @FT_Glyph_Format values instead. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* ft_glyph_format_none :: See @FT_GLYPH_FORMAT_NONE. */ nuclear@0: /* ft_glyph_format_composite :: See @FT_GLYPH_FORMAT_COMPOSITE. */ nuclear@0: /* ft_glyph_format_bitmap :: See @FT_GLYPH_FORMAT_BITMAP. */ nuclear@0: /* ft_glyph_format_outline :: See @FT_GLYPH_FORMAT_OUTLINE. */ nuclear@0: /* ft_glyph_format_plotter :: See @FT_GLYPH_FORMAT_PLOTTER. */ nuclear@0: /* */ nuclear@0: #define ft_glyph_format_none FT_GLYPH_FORMAT_NONE nuclear@0: #define ft_glyph_format_composite FT_GLYPH_FORMAT_COMPOSITE nuclear@0: #define ft_glyph_format_bitmap FT_GLYPH_FORMAT_BITMAP nuclear@0: #define ft_glyph_format_outline FT_GLYPH_FORMAT_OUTLINE nuclear@0: #define ft_glyph_format_plotter FT_GLYPH_FORMAT_PLOTTER nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /*************************************************************************/ nuclear@0: /*************************************************************************/ nuclear@0: /***** *****/ nuclear@0: /***** R A S T E R D E F I N I T I O N S *****/ nuclear@0: /***** *****/ nuclear@0: /*************************************************************************/ nuclear@0: /*************************************************************************/ nuclear@0: /*************************************************************************/ nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* A raster is a scan converter, in charge of rendering an outline into */ nuclear@0: /* a a bitmap. This section contains the public API for rasters. */ nuclear@0: /* */ nuclear@0: /* Note that in FreeType 2, all rasters are now encapsulated within */ nuclear@0: /* specific modules called `renderers'. See `freetype/ftrender.h' for */ nuclear@0: /* more details on renderers. */ nuclear@0: /* */ nuclear@0: /*************************************************************************/ nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /*
*/ nuclear@0: /* raster */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* Scanline Converter */ nuclear@0: /* */ nuclear@0: /* <Abstract> */ nuclear@0: /* How vectorial outlines are converted into bitmaps and pixmaps. */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* This section contains technical definitions. */ nuclear@0: /* */ nuclear@0: /*************************************************************************/ nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <Type> */ nuclear@0: /* FT_Raster */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* A handle (pointer) to a raster object. Each object can be used */ nuclear@0: /* independently to convert an outline into a bitmap or pixmap. */ nuclear@0: /* */ nuclear@0: typedef struct FT_RasterRec_* FT_Raster; nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <Struct> */ nuclear@0: /* FT_Span */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* A structure used to model a single span of gray (or black) pixels */ nuclear@0: /* when rendering a monochrome or anti-aliased bitmap. */ nuclear@0: /* */ nuclear@0: /* <Fields> */ nuclear@0: /* x :: The span's horizontal start position. */ nuclear@0: /* */ nuclear@0: /* len :: The span's length in pixels. */ nuclear@0: /* */ nuclear@0: /* coverage :: The span color/coverage, ranging from 0 (background) */ nuclear@0: /* to 255 (foreground). Only used for anti-aliased */ nuclear@0: /* rendering. */ nuclear@0: /* */ nuclear@0: /* <Note> */ nuclear@0: /* This structure is used by the span drawing callback type named */ nuclear@0: /* @FT_SpanFunc which takes the y~coordinate of the span as a */ nuclear@0: /* a parameter. */ nuclear@0: /* */ nuclear@0: /* The coverage value is always between 0 and 255. If you want less */ nuclear@0: /* gray values, the callback function has to reduce them. */ nuclear@0: /* */ nuclear@0: typedef struct FT_Span_ nuclear@0: { nuclear@0: short x; nuclear@0: unsigned short len; nuclear@0: unsigned char coverage; nuclear@0: nuclear@0: } FT_Span; nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <FuncType> */ nuclear@0: /* FT_SpanFunc */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* A function used as a call-back by the anti-aliased renderer in */ nuclear@0: /* order to let client applications draw themselves the gray pixel */ nuclear@0: /* spans on each scan line. */ nuclear@0: /* */ nuclear@0: /* <Input> */ nuclear@0: /* y :: The scanline's y~coordinate. */ nuclear@0: /* */ nuclear@0: /* count :: The number of spans to draw on this scanline. */ nuclear@0: /* */ nuclear@0: /* spans :: A table of `count' spans to draw on the scanline. */ nuclear@0: /* */ nuclear@0: /* user :: User-supplied data that is passed to the callback. */ nuclear@0: /* */ nuclear@0: /* <Note> */ nuclear@0: /* This callback allows client applications to directly render the */ nuclear@0: /* gray spans of the anti-aliased bitmap to any kind of surfaces. */ nuclear@0: /* */ nuclear@0: /* This can be used to write anti-aliased outlines directly to a */ nuclear@0: /* given background bitmap, and even perform translucency. */ nuclear@0: /* */ nuclear@0: /* Note that the `count' field cannot be greater than a fixed value */ nuclear@0: /* defined by the `FT_MAX_GRAY_SPANS' configuration macro in */ nuclear@0: /* `ftoption.h'. By default, this value is set to~32, which means */ nuclear@0: /* that if there are more than 32~spans on a given scanline, the */ nuclear@0: /* callback is called several times with the same `y' parameter in */ nuclear@0: /* order to draw all callbacks. */ nuclear@0: /* */ nuclear@0: /* Otherwise, the callback is only called once per scan-line, and */ nuclear@0: /* only for those scanlines that do have `gray' pixels on them. */ nuclear@0: /* */ nuclear@0: typedef void nuclear@0: (*FT_SpanFunc)( int y, nuclear@0: int count, nuclear@0: const FT_Span* spans, nuclear@0: void* user ); nuclear@0: nuclear@0: #define FT_Raster_Span_Func FT_SpanFunc nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <FuncType> */ nuclear@0: /* FT_Raster_BitTest_Func */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* THIS TYPE IS DEPRECATED. DO NOT USE IT. */ nuclear@0: /* */ nuclear@0: /* A function used as a call-back by the monochrome scan-converter */ nuclear@0: /* to test whether a given target pixel is already set to the drawing */ nuclear@0: /* `color'. These tests are crucial to implement drop-out control */ nuclear@0: /* per-se the TrueType spec. */ nuclear@0: /* */ nuclear@0: /* <Input> */ nuclear@0: /* y :: The pixel's y~coordinate. */ nuclear@0: /* */ nuclear@0: /* x :: The pixel's x~coordinate. */ nuclear@0: /* */ nuclear@0: /* user :: User-supplied data that is passed to the callback. */ nuclear@0: /* */ nuclear@0: /* <Return> */ nuclear@0: /* 1~if the pixel is `set', 0~otherwise. */ nuclear@0: /* */ nuclear@0: typedef int nuclear@0: (*FT_Raster_BitTest_Func)( int y, nuclear@0: int x, nuclear@0: void* user ); nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <FuncType> */ nuclear@0: /* FT_Raster_BitSet_Func */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* THIS TYPE IS DEPRECATED. DO NOT USE IT. */ nuclear@0: /* */ nuclear@0: /* A function used as a call-back by the monochrome scan-converter */ nuclear@0: /* to set an individual target pixel. This is crucial to implement */ nuclear@0: /* drop-out control according to the TrueType specification. */ nuclear@0: /* */ nuclear@0: /* <Input> */ nuclear@0: /* y :: The pixel's y~coordinate. */ nuclear@0: /* */ nuclear@0: /* x :: The pixel's x~coordinate. */ nuclear@0: /* */ nuclear@0: /* user :: User-supplied data that is passed to the callback. */ nuclear@0: /* */ nuclear@0: /* <Return> */ nuclear@0: /* 1~if the pixel is `set', 0~otherwise. */ nuclear@0: /* */ nuclear@0: typedef void nuclear@0: (*FT_Raster_BitSet_Func)( int y, nuclear@0: int x, nuclear@0: void* user ); nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <Enum> */ nuclear@0: /* FT_RASTER_FLAG_XXX */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* A list of bit flag constants as used in the `flags' field of a */ nuclear@0: /* @FT_Raster_Params structure. */ nuclear@0: /* */ nuclear@0: /* <Values> */ nuclear@0: /* FT_RASTER_FLAG_DEFAULT :: This value is 0. */ nuclear@0: /* */ nuclear@0: /* FT_RASTER_FLAG_AA :: This flag is set to indicate that an */ nuclear@0: /* anti-aliased glyph image should be */ nuclear@0: /* generated. Otherwise, it will be */ nuclear@0: /* monochrome (1-bit). */ nuclear@0: /* */ nuclear@0: /* FT_RASTER_FLAG_DIRECT :: This flag is set to indicate direct */ nuclear@0: /* rendering. In this mode, client */ nuclear@0: /* applications must provide their own span */ nuclear@0: /* callback. This lets them directly */ nuclear@0: /* draw or compose over an existing bitmap. */ nuclear@0: /* If this bit is not set, the target */ nuclear@0: /* pixmap's buffer _must_ be zeroed before */ nuclear@0: /* rendering. */ nuclear@0: /* */ nuclear@0: /* Note that for now, direct rendering is */ nuclear@0: /* only possible with anti-aliased glyphs. */ nuclear@0: /* */ nuclear@0: /* FT_RASTER_FLAG_CLIP :: This flag is only used in direct */ nuclear@0: /* rendering mode. If set, the output will */ nuclear@0: /* be clipped to a box specified in the */ nuclear@0: /* `clip_box' field of the */ nuclear@0: /* @FT_Raster_Params structure. */ nuclear@0: /* */ nuclear@0: /* Note that by default, the glyph bitmap */ nuclear@0: /* is clipped to the target pixmap, except */ nuclear@0: /* in direct rendering mode where all spans */ nuclear@0: /* are generated if no clipping box is set. */ nuclear@0: /* */ nuclear@0: #define FT_RASTER_FLAG_DEFAULT 0x0 nuclear@0: #define FT_RASTER_FLAG_AA 0x1 nuclear@0: #define FT_RASTER_FLAG_DIRECT 0x2 nuclear@0: #define FT_RASTER_FLAG_CLIP 0x4 nuclear@0: nuclear@0: /* deprecated */ nuclear@0: #define ft_raster_flag_default FT_RASTER_FLAG_DEFAULT nuclear@0: #define ft_raster_flag_aa FT_RASTER_FLAG_AA nuclear@0: #define ft_raster_flag_direct FT_RASTER_FLAG_DIRECT nuclear@0: #define ft_raster_flag_clip FT_RASTER_FLAG_CLIP nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <Struct> */ nuclear@0: /* FT_Raster_Params */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* A structure to hold the arguments used by a raster's render */ nuclear@0: /* function. */ nuclear@0: /* */ nuclear@0: /* <Fields> */ nuclear@0: /* target :: The target bitmap. */ nuclear@0: /* */ nuclear@0: /* source :: A pointer to the source glyph image (e.g., an */ nuclear@0: /* @FT_Outline). */ nuclear@0: /* */ nuclear@0: /* flags :: The rendering flags. */ nuclear@0: /* */ nuclear@0: /* gray_spans :: The gray span drawing callback. */ nuclear@0: /* */ nuclear@0: /* black_spans :: The black span drawing callback. UNIMPLEMENTED! */ nuclear@0: /* */ nuclear@0: /* bit_test :: The bit test callback. UNIMPLEMENTED! */ nuclear@0: /* */ nuclear@0: /* bit_set :: The bit set callback. UNIMPLEMENTED! */ nuclear@0: /* */ nuclear@0: /* user :: User-supplied data that is passed to each drawing */ nuclear@0: /* callback. */ nuclear@0: /* */ nuclear@0: /* clip_box :: An optional clipping box. It is only used in */ nuclear@0: /* direct rendering mode. Note that coordinates here */ nuclear@0: /* should be expressed in _integer_ pixels (and not in */ nuclear@0: /* 26.6 fixed-point units). */ nuclear@0: /* */ nuclear@0: /* <Note> */ nuclear@0: /* An anti-aliased glyph bitmap is drawn if the @FT_RASTER_FLAG_AA */ nuclear@0: /* bit flag is set in the `flags' field, otherwise a monochrome */ nuclear@0: /* bitmap is generated. */ nuclear@0: /* */ nuclear@0: /* If the @FT_RASTER_FLAG_DIRECT bit flag is set in `flags', the */ nuclear@0: /* raster will call the `gray_spans' callback to draw gray pixel */ nuclear@0: /* spans, in the case of an aa glyph bitmap, it will call */ nuclear@0: /* `black_spans', and `bit_test' and `bit_set' in the case of a */ nuclear@0: /* monochrome bitmap. This allows direct composition over a */ nuclear@0: /* pre-existing bitmap through user-provided callbacks to perform the */ nuclear@0: /* span drawing/composition. */ nuclear@0: /* */ nuclear@0: /* Note that the `bit_test' and `bit_set' callbacks are required when */ nuclear@0: /* rendering a monochrome bitmap, as they are crucial to implement */ nuclear@0: /* correct drop-out control as defined in the TrueType specification. */ nuclear@0: /* */ nuclear@0: typedef struct FT_Raster_Params_ nuclear@0: { nuclear@0: const FT_Bitmap* target; nuclear@0: const void* source; nuclear@0: int flags; nuclear@0: FT_SpanFunc gray_spans; nuclear@0: FT_SpanFunc black_spans; /* doesn't work! */ nuclear@0: FT_Raster_BitTest_Func bit_test; /* doesn't work! */ nuclear@0: FT_Raster_BitSet_Func bit_set; /* doesn't work! */ nuclear@0: void* user; nuclear@0: FT_BBox clip_box; nuclear@0: nuclear@0: } FT_Raster_Params; nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <FuncType> */ nuclear@0: /* FT_Raster_NewFunc */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* A function used to create a new raster object. */ nuclear@0: /* */ nuclear@0: /* <Input> */ nuclear@0: /* memory :: A handle to the memory allocator. */ nuclear@0: /* */ nuclear@0: /* <Output> */ nuclear@0: /* raster :: A handle to the new raster object. */ nuclear@0: /* */ nuclear@0: /* <Return> */ nuclear@0: /* Error code. 0~means success. */ nuclear@0: /* */ nuclear@0: /* <Note> */ nuclear@0: /* The `memory' parameter is a typeless pointer in order to avoid */ nuclear@0: /* un-wanted dependencies on the rest of the FreeType code. In */ nuclear@0: /* practice, it is an @FT_Memory object, i.e., a handle to the */ nuclear@0: /* standard FreeType memory allocator. However, this field can be */ nuclear@0: /* completely ignored by a given raster implementation. */ nuclear@0: /* */ nuclear@0: typedef int nuclear@0: (*FT_Raster_NewFunc)( void* memory, nuclear@0: FT_Raster* raster ); nuclear@0: nuclear@0: #define FT_Raster_New_Func FT_Raster_NewFunc nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <FuncType> */ nuclear@0: /* FT_Raster_DoneFunc */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* A function used to destroy a given raster object. */ nuclear@0: /* */ nuclear@0: /* <Input> */ nuclear@0: /* raster :: A handle to the raster object. */ nuclear@0: /* */ nuclear@0: typedef void nuclear@0: (*FT_Raster_DoneFunc)( FT_Raster raster ); nuclear@0: nuclear@0: #define FT_Raster_Done_Func FT_Raster_DoneFunc nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <FuncType> */ nuclear@0: /* FT_Raster_ResetFunc */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* FreeType provides an area of memory called the `render pool', */ nuclear@0: /* available to all registered rasters. This pool can be freely used */ nuclear@0: /* during a given scan-conversion but is shared by all rasters. Its */ nuclear@0: /* content is thus transient. */ nuclear@0: /* */ nuclear@0: /* This function is called each time the render pool changes, or just */ nuclear@0: /* after a new raster object is created. */ nuclear@0: /* */ nuclear@0: /* <Input> */ nuclear@0: /* raster :: A handle to the new raster object. */ nuclear@0: /* */ nuclear@0: /* pool_base :: The address in memory of the render pool. */ nuclear@0: /* */ nuclear@0: /* pool_size :: The size in bytes of the render pool. */ nuclear@0: /* */ nuclear@0: /* <Note> */ nuclear@0: /* Rasters can ignore the render pool and rely on dynamic memory */ nuclear@0: /* allocation if they want to (a handle to the memory allocator is */ nuclear@0: /* passed to the raster constructor). However, this is not */ nuclear@0: /* recommended for efficiency purposes. */ nuclear@0: /* */ nuclear@0: typedef void nuclear@0: (*FT_Raster_ResetFunc)( FT_Raster raster, nuclear@0: unsigned char* pool_base, nuclear@0: unsigned long pool_size ); nuclear@0: nuclear@0: #define FT_Raster_Reset_Func FT_Raster_ResetFunc nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <FuncType> */ nuclear@0: /* FT_Raster_SetModeFunc */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* This function is a generic facility to change modes or attributes */ nuclear@0: /* in a given raster. This can be used for debugging purposes, or */ nuclear@0: /* simply to allow implementation-specific `features' in a given */ nuclear@0: /* raster module. */ nuclear@0: /* */ nuclear@0: /* <Input> */ nuclear@0: /* raster :: A handle to the new raster object. */ nuclear@0: /* */ nuclear@0: /* mode :: A 4-byte tag used to name the mode or property. */ nuclear@0: /* */ nuclear@0: /* args :: A pointer to the new mode/property to use. */ nuclear@0: /* */ nuclear@0: typedef int nuclear@0: (*FT_Raster_SetModeFunc)( FT_Raster raster, nuclear@0: unsigned long mode, nuclear@0: void* args ); nuclear@0: nuclear@0: #define FT_Raster_Set_Mode_Func FT_Raster_SetModeFunc nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <FuncType> */ nuclear@0: /* FT_Raster_RenderFunc */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* Invoke a given raster to scan-convert a given glyph image into a */ nuclear@0: /* target bitmap. */ nuclear@0: /* */ nuclear@0: /* <Input> */ nuclear@0: /* raster :: A handle to the raster object. */ nuclear@0: /* */ nuclear@0: /* params :: A pointer to an @FT_Raster_Params structure used to */ nuclear@0: /* store the rendering parameters. */ nuclear@0: /* */ nuclear@0: /* <Return> */ nuclear@0: /* Error code. 0~means success. */ nuclear@0: /* */ nuclear@0: /* <Note> */ nuclear@0: /* The exact format of the source image depends on the raster's glyph */ nuclear@0: /* format defined in its @FT_Raster_Funcs structure. It can be an */ nuclear@0: /* @FT_Outline or anything else in order to support a large array of */ nuclear@0: /* glyph formats. */ nuclear@0: /* */ nuclear@0: /* Note also that the render function can fail and return a */ nuclear@0: /* `FT_Err_Unimplemented_Feature' error code if the raster used does */ nuclear@0: /* not support direct composition. */ nuclear@0: /* */ nuclear@0: /* XXX: For now, the standard raster doesn't support direct */ nuclear@0: /* composition but this should change for the final release (see */ nuclear@0: /* the files `demos/src/ftgrays.c' and `demos/src/ftgrays2.c' */ nuclear@0: /* for examples of distinct implementations which support direct */ nuclear@0: /* composition). */ nuclear@0: /* */ nuclear@0: typedef int nuclear@0: (*FT_Raster_RenderFunc)( FT_Raster raster, nuclear@0: const FT_Raster_Params* params ); nuclear@0: nuclear@0: #define FT_Raster_Render_Func FT_Raster_RenderFunc nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <Struct> */ nuclear@0: /* FT_Raster_Funcs */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* A structure used to describe a given raster class to the library. */ nuclear@0: /* */ nuclear@0: /* <Fields> */ nuclear@0: /* glyph_format :: The supported glyph format for this raster. */ nuclear@0: /* */ nuclear@0: /* raster_new :: The raster constructor. */ nuclear@0: /* */ nuclear@0: /* raster_reset :: Used to reset the render pool within the raster. */ nuclear@0: /* */ nuclear@0: /* raster_render :: A function to render a glyph into a given bitmap. */ nuclear@0: /* */ nuclear@0: /* raster_done :: The raster destructor. */ nuclear@0: /* */ nuclear@0: typedef struct FT_Raster_Funcs_ nuclear@0: { nuclear@0: FT_Glyph_Format glyph_format; nuclear@0: FT_Raster_NewFunc raster_new; nuclear@0: FT_Raster_ResetFunc raster_reset; nuclear@0: FT_Raster_SetModeFunc raster_set_mode; nuclear@0: FT_Raster_RenderFunc raster_render; nuclear@0: FT_Raster_DoneFunc raster_done; nuclear@0: nuclear@0: } FT_Raster_Funcs; nuclear@0: nuclear@0: nuclear@0: /* */ nuclear@0: nuclear@0: nuclear@0: FT_END_HEADER nuclear@0: nuclear@0: #endif /* __FTIMAGE_H__ */ nuclear@0: nuclear@0: nuclear@0: /* END */ nuclear@0: nuclear@0: nuclear@0: /* Local Variables: */ nuclear@0: /* coding: utf-8 */ nuclear@0: /* End: */