PageRenderTime 57ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/src/freetype/include/freetype/ftimage.h

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