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