1 /***************************************************************************/
5 /* FreeType glyph image formats and default raster interface */
8 /* Copyright 1996-2001 by */
9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
11 /* This file is part of the FreeType project, and may only be used, */
12 /* modified, and distributed under the terms of the FreeType project */
13 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
14 /* this file you indicate that you have read the license and */
15 /* understand and accept it fully. */
17 /***************************************************************************/
19 /*************************************************************************/
21 /* Note: A `raster' is simply a scan-line converter, used to render */
22 /* FT_Outlines into FT_Bitmaps. */
24 /*************************************************************************/
37 /*************************************************************************/
42 /*************************************************************************/
45 /*************************************************************************/
51 /* The type FT_Pos is a 32-bit integer used to store vectorial */
52 /* coordinates. Depending on the context, these can represent */
53 /* distances in integer font units, or 26.6 fixed float pixel */
56 typedef signed long FT_Pos;
59 /*************************************************************************/
65 /* A simple structure used to store a 2D vector; coordinates are of */
66 /* the FT_Pos type. */
69 /* x :: The horizontal coordinate. */
70 /* y :: The vertical coordinate. */
72 typedef struct FT_Vector_
80 /*************************************************************************/
86 /* A structure used to hold an outline's bounding box, i.e., the */
87 /* coordinates of its extrema in the horizontal and vertical */
91 /* xMin :: The horizontal minimum (left-most). */
93 /* yMin :: The vertical minimum (bottom-most). */
95 /* xMax :: The horizontal maximum (right-most). */
97 /* yMax :: The vertical maximum (top-most). */
99 typedef struct FT_BBox_
107 /*************************************************************************/
113 /* An enumeration type used to describe the format of pixels in a */
114 /* given bitmap. Note that additional formats may be added in the */
118 /* ft_pixel_mode_mono :: A monochrome bitmap (1 bit/pixel). */
120 /* ft_pixel_mode_grays :: An 8-bit gray-levels bitmap. Note that the */
121 /* total number of gray levels is given in the */
122 /* `num_grays' field of the FT_Bitmap */
125 /* ft_pixel_mode_pal2 :: A 2-bit paletted bitmap. */
126 /* Currently unused by FreeType. */
128 /* ft_pixel_mode_pal4 :: A 4-bit paletted bitmap. */
129 /* Currently unused by FreeType. */
131 /* ft_pixel_mode_pal8 :: An 8-bit paletted bitmap. */
132 /* Currently unused by FreeType. */
134 /* ft_pixel_mode_rgb15 :: A 15-bit RGB bitmap. Uses 5:5:5 encoding. */
135 /* Currently unused by FreeType. */
137 /* ft_pixel_mode_rgb16 :: A 16-bit RGB bitmap. Uses 5:6:5 encoding. */
138 /* Currently unused by FreeType. */
140 /* ft_pixel_mode_rgb24 :: A 24-bit RGB bitmap. */
141 /* Currently unused by FreeType. */
143 /* ft_pixel_mode_rgb32 :: A 32-bit RGB bitmap. */
144 /* Currently unused by FreeType. */
147 /* Some anti-aliased bitmaps might be embedded in TrueType fonts */
148 /* using formats pal2 or pal4, though no fonts presenting those have */
149 /* been found to date. */
151 typedef enum FT_Pixel_Mode_
153 ft_pixel_mode_none = 0,
164 ft_pixel_mode_max /* do not remove */
169 /*************************************************************************/
172 /* FT_Palette_Mode */
175 /* An enumeration type used to describe the format of a bitmap */
176 /* palette, used with ft_pixel_mode_pal4 and ft_pixel_mode_pal8. */
179 /* ft_palette_mode_rgb :: The palette is an array of 3-bytes RGB */
182 /* ft_palette_mode_rgba :: The palette is an array of 4-bytes RGBA */
186 /* As ft_pixel_mode_pal2, pal4 and pal8 are currently unused by */
187 /* FreeType, these types are not handled by the library itself. */
189 typedef enum FT_Palette_Mode_
191 ft_palette_mode_rgb = 0,
192 ft_palette_mode_rgba,
194 ft_palettte_mode_max /* do not remove */
199 /*************************************************************************/
205 /* A structure used to describe a bitmap or pixmap to the raster. */
206 /* Note that we now manage pixmaps of various depths through the */
207 /* `pixel_mode' field. */
210 /* rows :: The number of bitmap rows. */
212 /* width :: The number of pixels in bitmap row. */
214 /* pitch :: The pitch's absolute value is the number of bytes */
215 /* taken by one bitmap row, including padding. */
216 /* However, the pitch is positive when the bitmap has */
217 /* a `down' flow, and negative when it has an `up' */
218 /* flow. In all cases, the pitch is an offset to add */
219 /* to a bitmap pointer in order to go down one row. */
221 /* buffer :: A typeless pointer to the bitmap buffer. This */
222 /* value should be aligned on 32-bit boundaries in */
225 /* num_grays :: This field is only used with */
226 /* `ft_pixel_mode_grays'; it gives the number of gray */
227 /* levels used in the bitmap. */
229 /* pixel_mode :: The pixel_mode, i.e., how pixel bits are stored. */
231 /* palette_mode :: This field is only used with paletted pixel modes; */
232 /* it indicates how the palette is stored. */
234 /* palette :: A typeless pointer to the bitmap palette; only */
235 /* used for paletted pixel modes. */
238 /* For now, the only pixel mode supported by FreeType are mono and */
239 /* grays. However, drivers might be added in the future to support */
240 /* more `colorful' options. */
242 /* When using pixel modes pal2, pal4 and pal8 with a void `palette' */
243 /* field, a gray pixmap with respectively 4, 16, and 256 levels of */
244 /* gray is assumed. This, in order to be compatible with some */
245 /* embedded bitmap formats defined in the TrueType specification. */
247 /* Note that no font was found presenting such embedded bitmaps, so */
248 /* this is currently completely unhandled by the library. */
250 typedef struct FT_Bitmap_
255 unsigned char* buffer;
264 /*************************************************************************/
267 /* outline_processing */
269 /*************************************************************************/
272 /*************************************************************************/
278 /* This structure is used to describe an outline to the scan-line */
282 /* n_contours :: The number of contours in the outline. */
284 /* n_points :: The number of points in the outline. */
286 /* points :: A pointer to an array of `n_points' FT_Vector */
287 /* elements, giving the outline's point coordinates. */
289 /* tags :: A pointer to an array of `n_points' chars, giving */
290 /* each outline point's type. If bit 0 is unset, the */
291 /* point is `off' the curve, i.e. a Bezier control */
292 /* point, while it is `on' when set. */
294 /* Bit 1 is meaningful for `off' points only. If set, */
295 /* it indicates a third-order Bezier arc control point; */
296 /* and a second-order control point if unset. */
298 /* contours :: An array of `n_contours' shorts, giving the end */
299 /* point of each contour within the outline. For */
300 /* example, the first contour is defined by the points */
301 /* `0' to `contours[0]', the second one is defined by */
302 /* the points `contours[0]+1' to `contours[1]', etc. */
304 /* flags :: A set of bit flags used to characterize the outline */
305 /* and give hints to the scan-converter and hinter on */
306 /* how to convert/grid-fit it. See FT_Outline_Flags. */
308 typedef struct FT_Outline_
310 short n_contours; /* number of contours in glyph */
311 short n_points; /* number of points in the glyph */
313 FT_Vector* points; /* the outline's points */
314 char* tags; /* the points flags */
315 short* contours; /* the contour end points */
317 int flags; /* outline masks */
322 /*************************************************************************/
325 /* FT_Outline_Flags */
328 /* A simple type used to enumerates the flags in an outline's */
329 /* `outline_flags' field. */
332 /* ft_outline_owner :: If set, this flag indicates that the */
333 /* outline's field arrays (i.e. */
334 /* `points', `flags' & `contours') are */
335 /* `owned' by the outline object, and */
336 /* should thus be freed when it is */
339 /* ft_outline_even_odd_fill :: By default, outlines are filled using */
340 /* the non-zero winding rule. If set to */
341 /* 1, the outline will be filled using */
342 /* the even-odd fill rule (only works */
343 /* with the smooth raster). */
345 /* ft_outline_reverse_fill :: By default, outside contours of an */
346 /* outline are oriented in clock-wise */
347 /* direction, as defined in the TrueType */
348 /* specification. This flag is set if */
349 /* the outline uses the opposite */
350 /* direction (typically for Type 1 */
351 /* fonts). This flag is ignored by the */
352 /* scan-converter. However, it is very */
353 /* important for the auto-hinter. */
355 /* ft_outline_ignore_dropouts :: By default, the scan converter will */
356 /* try to detect drop-outs in an outline */
357 /* and correct the glyph bitmap to */
358 /* ensure consistent shape continuity. */
359 /* If set, this flag hints the scan-line */
360 /* converter to ignore such cases. */
362 /* ft_outline_high_precision :: This flag indicates that the */
363 /* scan-line converter should try to */
364 /* convert this outline to bitmaps with */
365 /* the highest possible quality. It is */
366 /* typically set for small character */
367 /* sizes. Note that this is only a */
368 /* hint, that might be completely */
369 /* ignored by a given scan-converter. */
371 /* ft_outline_single_pass :: This flag is set to force a given */
372 /* scan-converter to only use a single */
373 /* pass over the outline to render a */
374 /* bitmap glyph image. Normally, it is */
375 /* set for very large character sizes. */
376 /* It is only a hint, that might be */
377 /* completely ignored by a given */
378 /* scan-converter. */
380 typedef enum FT_Outline_Flags_
383 ft_outline_owner = 1,
384 ft_outline_even_odd_fill = 2,
385 ft_outline_reverse_fill = 4,
386 ft_outline_ignore_dropouts = 8,
387 ft_outline_high_precision = 256,
388 ft_outline_single_pass = 512
394 #define FT_CURVE_TAG( flag ) ( flag & 3 )
396 #define FT_Curve_Tag_On 1
397 #define FT_Curve_Tag_Conic 0
398 #define FT_Curve_Tag_Cubic 2
400 #define FT_Curve_Tag_Touch_X 8 /* reserved for the TrueType hinter */
401 #define FT_Curve_Tag_Touch_Y 16 /* reserved for the TrueType hinter */
403 #define FT_Curve_Tag_Touch_Both ( FT_Curve_Tag_Touch_X | \
404 FT_Curve_Tag_Touch_Y )
407 /*************************************************************************/
410 /* FT_Outline_MoveTo_Func */
413 /* A function pointer type used to describe the signature of a `move */
414 /* to' function during outline walking/decomposition. */
416 /* A `move to' is emitted to start a new contour in an outline. */
419 /* to :: A pointer to the target point of the `move to'. */
421 /* user :: A typeless pointer which is passed from the caller of the */
422 /* decomposition function. */
425 /* Error code. 0 means success. */
428 (*FT_Outline_MoveTo_Func)( FT_Vector* to,
432 /*************************************************************************/
435 /* FT_Outline_LineTo_Func */
438 /* A function pointer type used to describe the signature of a `line */
439 /* to' function during outline walking/decomposition. */
441 /* A `line to' is emitted to indicate a segment in the outline. */
444 /* to :: A pointer to the target point of the `line to'. */
446 /* user :: A typeless pointer which is passed from the caller of the */
447 /* decomposition function. */
450 /* Error code. 0 means success. */
453 (*FT_Outline_LineTo_Func)( FT_Vector* to,
457 /*************************************************************************/
460 /* FT_Outline_ConicTo_Func */
463 /* A function pointer type use to describe the signature of a `conic */
464 /* to' function during outline walking/decomposition. */
466 /* A `conic to' is emitted to indicate a second-order Bezier arc in */
470 /* control :: An intermediate control point between the last position */
471 /* and the new target in `to'. */
473 /* to :: A pointer to the target end point of the conic arc. */
475 /* user :: A typeless pointer which is passed from the caller of */
476 /* the decomposition function. */
479 /* Error code. 0 means success. */
482 (*FT_Outline_ConicTo_Func)( FT_Vector* control,
487 /*************************************************************************/
490 /* FT_Outline_CubicTo_Func */
493 /* A function pointer type used to describe the signature of a `cubic */
494 /* to' function during outline walking/decomposition. */
496 /* A `cubic to' is emitted to indicate a third-order Bezier arc. */
499 /* control1 :: A pointer to the first Bezier control point. */
501 /* control2 :: A pointer to the second Bezier control point. */
503 /* to :: A pointer to the target end point. */
505 /* user :: A typeless pointer which is passed from the caller of */
506 /* the decomposition function. */
509 /* Error code. 0 means success. */
512 (*FT_Outline_CubicTo_Func)( FT_Vector* control1,
518 /*************************************************************************/
521 /* FT_Outline_Funcs */
524 /* A structure to hold various function pointers used during outline */
525 /* decomposition in order to emit segments, conic, and cubic Beziers, */
526 /* as well as `move to' and `close to' operations. */
529 /* move_to :: The `move to' emitter. */
531 /* line_to :: The segment emitter. */
533 /* conic_to :: The second-order Bezier arc emitter. */
535 /* cubic_to :: The third-order Bezier arc emitter. */
537 /* shift :: The shift that is applied to coordinates before they */
538 /* are sent to the emitter. */
540 /* delta :: The delta that is applied to coordinates before they */
541 /* are sent to the emitter, but after the shift. */
544 /* The point coordinates sent to the emitters are the transformed */
545 /* version of the original coordinates (this is important for high */
546 /* accuracy during scan-conversion). The transformation is simple: */
548 /* x' = (x << shift) - delta */
549 /* y' = (x << shift) - delta */
551 /* Set the value of `shift' and `delta' to 0 to get the original */
552 /* point coordinates. */
554 typedef struct FT_Outline_Funcs_
556 FT_Outline_MoveTo_Func move_to;
557 FT_Outline_LineTo_Func line_to;
558 FT_Outline_ConicTo_Func conic_to;
559 FT_Outline_CubicTo_Func cubic_to;
567 /*************************************************************************/
572 /*************************************************************************/
575 /*************************************************************************/
581 /* This macro converts four letter tags into an unsigned long. */
584 #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) \
585 value = ( ( (unsigned long)_x1 << 24 ) | \
586 ( (unsigned long)_x2 << 16 ) | \
587 ( (unsigned long)_x3 << 8 ) | \
589 #endif /* FT_IMAGE_TAG */
592 /*************************************************************************/
595 /* FT_Glyph_Format */
598 /* An enumeration type used to describe the format of a given glyph */
599 /* image. Note that this version of FreeType only supports two image */
600 /* formats, even though future font drivers will be able to register */
601 /* their own format. */
604 /* ft_glyph_format_composite :: The glyph image is a composite of */
605 /* several other images. This glyph */
606 /* format is _only_ used with the */
607 /* FT_LOAD_FLAG_NO_RECURSE flag (XXX: */
608 /* Which is currently unimplemented). */
610 /* ft_glyph_format_bitmap :: The glyph image is a bitmap, and can */
611 /* be described as a FT_Bitmap. */
613 /* ft_glyph_format_outline :: The glyph image is a vectorial image */
614 /* made of bezier control points, and */
615 /* can be described as a FT_Outline. */
617 /* ft_glyph_format_plotter :: The glyph image is a vectorial image */
618 /* made of plotter lines (some T1 fonts */
619 /* like Hershey contain glyph in this */
622 typedef enum FT_Glyph_Format_
624 FT_IMAGE_TAG( ft_glyph_format_none, 0, 0, 0, 0 ),
626 FT_IMAGE_TAG( ft_glyph_format_composite, 'c', 'o', 'm', 'p' ),
627 FT_IMAGE_TAG( ft_glyph_format_bitmap, 'b', 'i', 't', 's' ),
628 FT_IMAGE_TAG( ft_glyph_format_outline, 'o', 'u', 't', 'l' ),
629 FT_IMAGE_TAG( ft_glyph_format_plotter, 'p', 'l', 'o', 't' )
634 /*************************************************************************/
635 /*************************************************************************/
636 /*************************************************************************/
638 /***** R A S T E R D E F I N I T I O N S *****/
640 /*************************************************************************/
641 /*************************************************************************/
642 /*************************************************************************/
645 /*************************************************************************/
647 /* A raster is a scan converter, in charge of rendering an outline into */
648 /* a a bitmap. This section contains the public API for rasters. */
650 /* Note that in FreeType 2, all rasters are now encapsulated within */
651 /* specific modules called `renderers'. See `freetype/ftrender.h' for */
652 /* more details on renderers. */
654 /*************************************************************************/
657 /*************************************************************************/
663 /* Scanline converter */
666 /* How vectorial outlines are converted into bitmaps and pixmaps. */
669 /* This section contains technical definitions. */
671 /*************************************************************************/
674 /*************************************************************************/
680 /* A handle (pointer) to a raster object. Each object can be used */
681 /* independently to convert an outline into a bitmap or pixmap. */
683 typedef struct FT_RasterRec_* FT_Raster;
686 /*************************************************************************/
692 /* A structure used to model a single span of gray (or black) pixels */
693 /* when rendering a monochrome or anti-aliased bitmap. */
696 /* x :: The span's horizontal start position. */
698 /* len :: The span's length in pixels. */
700 /* coverage :: The span color/coverage, ranging from 0 (background) */
701 /* to 255 (foreground). Only used for anti-aliased */
705 /* This structure is used by the span drawing callback type named */
706 /* FT_Raster_Span_Func(), which takes the y-coordinate of the span as */
709 /* The coverage value is always between 0 and 255, even if the number */
710 /* of gray levels have been set through FT_Set_Gray_Levels(). */
712 typedef struct FT_Span_
716 unsigned char coverage;
721 /*************************************************************************/
724 /* FT_Raster_Span_Func */
727 /* A function used as a call-back by the anti-aliased renderer in */
728 /* order to let client applications draw themselves the gray pixel */
729 /* spans on each scan line. */
732 /* y :: The scanline's y-coordinate. */
734 /* count :: The number of spans to draw on this scanline. */
736 /* spans :: A table of `count' spans to draw on the scanline. */
738 /* user :: User-supplied data that is passed to the callback. */
741 /* This callback allows client applications to directly render the */
742 /* gray spans of the anti-aliased bitmap to any kind of surfaces. */
744 /* This can be used to write anti-aliased outlines directly to a */
745 /* given background bitmap, and even perform translucency. */
747 /* Note that the `count' field cannot be greater than a fixed value */
748 /* defined by the FT_MAX_GRAY_SPANS configuration macro in */
749 /* ftoption.h. By default, this value is set to 32, which means that */
750 /* if there are more than 32 spans on a given scanline, the callback */
751 /* will be called several times with the same `y' parameter in order */
752 /* to draw all callbacks. */
754 /* Otherwise, the callback is only called once per scan-line, and */
755 /* only for those scanlines that do have `gray' pixels on them. */
758 (*FT_Raster_Span_Func)( int y,
764 /*************************************************************************/
767 /* FT_Raster_BitTest_Func */
770 /* A function used as a call-back by the monochrome scan-converter */
771 /* to test whether a given target pixel is already set to the drawing */
772 /* `color'. These tests are crucial to implement drop-out control */
773 /* per-se the TrueType spec. */
776 /* y :: The pixel's y-coordinate. */
778 /* x :: The pixel's x-coordinate. */
780 /* user :: User-supplied data that is passed to the callback. */
783 /* 1 if the pixel is `set', 0 otherwise. */
786 (*FT_Raster_BitTest_Func)( int y,
791 /*************************************************************************/
794 /* FT_Raster_BitSet_Func */
797 /* A function used as a call-back by the monochrome scan-converter */
798 /* to set an individual target pixel. This is crucial to implement */
799 /* drop-out control according to the TrueType specification. */
802 /* y :: The pixel's y-coordinate. */
804 /* x :: The pixel's x-coordinate. */
806 /* user :: User-supplied data that is passed to the callback. */
809 /* 1 if the pixel is `set', 0 otherwise. */
812 (*FT_Raster_BitSet_Func)( int y,
817 /*************************************************************************/
823 /* An enumeration to list the bit flags as used in the `flags' field */
824 /* of a FT_Raster_Params structure. */
827 /* ft_raster_flag_default :: This value is 0. */
829 /* ft_raster_flag_aa :: This flag is set to indicate that an */
830 /* anti-aliased glyph image should be */
831 /* generated. Otherwise, it will be */
832 /* monochrome (1-bit) */
834 /* ft_raster_flag_direct :: This flag is set to indicate direct */
835 /* rendering. In this mode, client */
836 /* applications must provide their own span */
837 /* callback. This lets them directly */
838 /* draw or compose over an existing bitmap. */
839 /* If this bit is not set, the target */
840 /* pixmap's buffer _must_ be zeroed before */
843 /* Note that for now, direct rendering is */
844 /* only possible with anti-aliased glyphs. */
846 /* ft_raster_flag_clip :: This flag is only used in direct */
847 /* rendering mode. If set, the output will */
848 /* be clipped to a box specified in the */
849 /* "clip_box" field of the FT_Raster_Params */
852 /* Note that by default, the glyph bitmap */
853 /* is clipped to the target pixmap, except */
854 /* in direct rendering mode where all spans */
855 /* are generated if no clipping box is set. */
859 ft_raster_flag_default = 0,
860 ft_raster_flag_aa = 1,
861 ft_raster_flag_direct = 2,
862 ft_raster_flag_clip = 4
867 /*************************************************************************/
870 /* FT_Raster_Params */
873 /* A structure to hold the arguments used by a raster's render */
877 /* target :: The target bitmap. */
879 /* source :: A pointer to the source glyph image (e.g. an */
882 /* flags :: The rendering flags. */
884 /* gray_spans :: The gray span drawing callback. */
886 /* black_spans :: The black span drawing callback. */
888 /* bit_test :: The bit test callback. */
890 /* bit_set :: The bit set callback. */
892 /* user :: User-supplied data that is passed to each drawing */
895 /* clip_box :: an optional clipping box. It is only used in */
896 /* direct rendering mode */
899 /* An anti-aliased glyph bitmap is drawn if the ft_raster_flag_aa bit */
900 /* flag is set in the `flags' field, otherwise a monochrome bitmap */
901 /* will be generated. */
903 /* If the ft_raster_flag_direct bit flag is set in `flags', the */
904 /* raster will call the `gray_spans' callback to draw gray pixel */
905 /* spans, in the case of an aa glyph bitmap, it will call */
906 /* `black_spans', and `bit_test' and `bit_set' in the case of a */
907 /* monochrome bitmap. This allows direct composition over a */
908 /* pre-existing bitmap through user-provided callbacks to perform the */
909 /* span drawing/composition. */
911 /* Note that the `bit_test' and `bit_set' callbacks are required when */
912 /* rendering a monochrome bitmap, as they are crucial to implement */
913 /* correct drop-out control as defined in the TrueType specification. */
915 typedef struct FT_Raster_Params_
920 FT_Raster_Span_Func gray_spans;
921 FT_Raster_Span_Func black_spans;
922 FT_Raster_BitTest_Func bit_test;
923 FT_Raster_BitSet_Func bit_set;
930 /*************************************************************************/
933 /* FT_Raster_New_Func */
936 /* A function used to create a new raster object. */
939 /* memory :: A handle to the memory allocator. */
942 /* raster :: A handle to the new raster object. */
945 /* Error code. 0 means success. */
948 /* The `memory' parameter is a typeless pointer in order to avoid */
949 /* un-wanted dependencies on the rest of the FreeType code. In */
950 /* practice, it is a FT_Memory, i.e., a handle to the standard */
951 /* FreeType memory allocator. However, this field can be completely */
952 /* ignored by a given raster implementation. */
955 (*FT_Raster_New_Func)( void* memory,
959 /*************************************************************************/
962 /* FT_Raster_Done_Func */
965 /* A function used to destroy a given raster object. */
968 /* raster :: A handle to the raster object. */
971 (*FT_Raster_Done_Func)( FT_Raster raster );
974 /*************************************************************************/
977 /* FT_Raster_Reset_Func */
980 /* FreeType provides an area of memory called the `render pool', */
981 /* available to all registered rasters. This pool can be freely used */
982 /* during a given scan-conversion but is shared by all rasters. Its */
983 /* content is thus transient. */
985 /* This function is called each time the render pool changes, or just */
986 /* after a new raster object is created. */
989 /* raster :: A handle to the new raster object. */
991 /* pool_base :: The address in memory of the render pool. */
993 /* pool_size :: The size in bytes of the render pool. */
996 /* Rasters can ignore the render pool and rely on dynamic memory */
997 /* allocation if they want to (a handle to the memory allocator is */
998 /* passed to the raster constructor). However, this is not */
999 /* recommended for efficiency purposes. */
1002 (*FT_Raster_Reset_Func)( FT_Raster raster,
1003 unsigned char* pool_base,
1004 unsigned long pool_size );
1007 /*************************************************************************/
1010 /* FT_Raster_Set_Mode_Func */
1013 /* This function is a generic facility to change modes or attributes */
1014 /* in a given raster. This can be used for debugging purposes, or */
1015 /* simply to allow implementation-specific `features' in a given */
1016 /* raster module. */
1019 /* raster :: A handle to the new raster object. */
1021 /* mode :: A 4-byte tag used to name the mode or property. */
1023 /* args :: A pointer to the new mode/property to use. */
1026 (*FT_Raster_Set_Mode_Func)( FT_Raster raster,
1031 /*************************************************************************/
1034 /* FT_Raster_Render_Func */
1037 /* Invokes a given raster to scan-convert a given glyph image into a */
1038 /* target bitmap. */
1041 /* raster :: A handle to the raster object. */
1043 /* params :: A pointer to a FT_Raster_Params structure used to store */
1044 /* the rendering parameters. */
1047 /* Error code. 0 means success. */
1050 /* The exact format of the source image depends on the raster's glyph */
1051 /* format defined in its FT_Raster_Funcs structure. It can be an */
1052 /* FT_Outline or anything else in order to support a large array of */
1053 /* glyph formats. */
1055 /* Note also that the render function can fail and return a */
1056 /* FT_Err_Unimplemented_Feature error code if the raster used does */
1057 /* not support direct composition. */
1059 /* XXX: For now, the standard raster doesn't support direct */
1060 /* composition but this should change for the final release (see */
1061 /* the files demos/src/ftgrays.c and demos/src/ftgrays2.c for */
1062 /* examples of distinct implementations which support direct */
1066 (*FT_Raster_Render_Func)( FT_Raster raster,
1067 FT_Raster_Params* params );
1070 /*************************************************************************/
1073 /* FT_Raster_Funcs */
1076 /* A structure used to describe a given raster class to the library. */
1079 /* glyph_format :: The supported glyph format for this raster. */
1081 /* raster_new :: The raster constructor. */
1083 /* raster_reset :: Used to reset the render pool within the raster. */
1085 /* raster_render :: A function to render a glyph into a given bitmap. */
1087 /* raster_done :: The raster destructor. */
1089 typedef struct FT_Raster_Funcs_
1091 FT_Glyph_Format glyph_format;
1092 FT_Raster_New_Func raster_new;
1093 FT_Raster_Reset_Func raster_reset;
1094 FT_Raster_Set_Mode_Func raster_set_mode;
1095 FT_Raster_Render_Func raster_render;
1096 FT_Raster_Done_Func raster_done;
1106 #endif /* __FTIMAGE_H__ */