ftimage.h 81 KB

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