ftbitmap.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. /***************************************************************************/
  2. /* */
  3. /* ftbitmap.h */
  4. /* */
  5. /* FreeType utility functions for bitmaps (specification). */
  6. /* */
  7. /* Copyright 2004-2006, 2008, 2013 by */
  8. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  9. /* */
  10. /* This file is part of the FreeType project, and may only be used, */
  11. /* modified, and distributed under the terms of the FreeType project */
  12. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  13. /* this file you indicate that you have read the license and */
  14. /* understand and accept it fully. */
  15. /* */
  16. /***************************************************************************/
  17. #ifndef __FTBITMAP_H__
  18. #define __FTBITMAP_H__
  19. #include <ft2build.h>
  20. #include FT_FREETYPE_H
  21. #ifdef FREETYPE_H
  22. #error "freetype.h of FreeType 1 has been loaded!"
  23. #error "Please fix the directory search order for header files"
  24. #error "so that freetype.h of FreeType 2 is found first."
  25. #endif
  26. FT_BEGIN_HEADER
  27. /*************************************************************************/
  28. /* */
  29. /* <Section> */
  30. /* bitmap_handling */
  31. /* */
  32. /* <Title> */
  33. /* Bitmap Handling */
  34. /* */
  35. /* <Abstract> */
  36. /* Handling FT_Bitmap objects. */
  37. /* */
  38. /* <Description> */
  39. /* This section contains functions for converting FT_Bitmap objects. */
  40. /* */
  41. /*************************************************************************/
  42. /*************************************************************************/
  43. /* */
  44. /* <Function> */
  45. /* FT_Bitmap_New */
  46. /* */
  47. /* <Description> */
  48. /* Initialize a pointer to an @FT_Bitmap structure. */
  49. /* */
  50. /* <InOut> */
  51. /* abitmap :: A pointer to the bitmap structure. */
  52. /* */
  53. FT_EXPORT( void )
  54. FT_Bitmap_New( FT_Bitmap *abitmap );
  55. /*************************************************************************/
  56. /* */
  57. /* <Function> */
  58. /* FT_Bitmap_Copy */
  59. /* */
  60. /* <Description> */
  61. /* Copy a bitmap into another one. */
  62. /* */
  63. /* <Input> */
  64. /* library :: A handle to a library object. */
  65. /* */
  66. /* source :: A handle to the source bitmap. */
  67. /* */
  68. /* <Output> */
  69. /* target :: A handle to the target bitmap. */
  70. /* */
  71. /* <Return> */
  72. /* FreeType error code. 0~means success. */
  73. /* */
  74. FT_EXPORT( FT_Error )
  75. FT_Bitmap_Copy( FT_Library library,
  76. const FT_Bitmap *source,
  77. FT_Bitmap *target);
  78. /*************************************************************************/
  79. /* */
  80. /* <Function> */
  81. /* FT_Bitmap_Embolden */
  82. /* */
  83. /* <Description> */
  84. /* Embolden a bitmap. The new bitmap will be about `xStrength' */
  85. /* pixels wider and `yStrength' pixels higher. The left and bottom */
  86. /* borders are kept unchanged. */
  87. /* */
  88. /* <Input> */
  89. /* library :: A handle to a library object. */
  90. /* */
  91. /* xStrength :: How strong the glyph is emboldened horizontally. */
  92. /* Expressed in 26.6 pixel format. */
  93. /* */
  94. /* yStrength :: How strong the glyph is emboldened vertically. */
  95. /* Expressed in 26.6 pixel format. */
  96. /* */
  97. /* <InOut> */
  98. /* bitmap :: A handle to the target bitmap. */
  99. /* */
  100. /* <Return> */
  101. /* FreeType error code. 0~means success. */
  102. /* */
  103. /* <Note> */
  104. /* The current implementation restricts `xStrength' to be less than */
  105. /* or equal to~8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO. */
  106. /* */
  107. /* If you want to embolden the bitmap owned by a @FT_GlyphSlotRec, */
  108. /* you should call @FT_GlyphSlot_Own_Bitmap on the slot first. */
  109. /* */
  110. FT_EXPORT( FT_Error )
  111. FT_Bitmap_Embolden( FT_Library library,
  112. FT_Bitmap* bitmap,
  113. FT_Pos xStrength,
  114. FT_Pos yStrength );
  115. /*************************************************************************/
  116. /* */
  117. /* <Function> */
  118. /* FT_Bitmap_Convert */
  119. /* */
  120. /* <Description> */
  121. /* Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, 8bpp or 32bpp */
  122. /* to a bitmap object with depth 8bpp, making the number of used */
  123. /* bytes line (a.k.a. the `pitch') a multiple of `alignment'. */
  124. /* */
  125. /* <Input> */
  126. /* library :: A handle to a library object. */
  127. /* */
  128. /* source :: The source bitmap. */
  129. /* */
  130. /* alignment :: The pitch of the bitmap is a multiple of this */
  131. /* parameter. Common values are 1, 2, or 4. */
  132. /* */
  133. /* <Output> */
  134. /* target :: The target bitmap. */
  135. /* */
  136. /* <Return> */
  137. /* FreeType error code. 0~means success. */
  138. /* */
  139. /* <Note> */
  140. /* It is possible to call @FT_Bitmap_Convert multiple times without */
  141. /* calling @FT_Bitmap_Done (the memory is simply reallocated). */
  142. /* */
  143. /* Use @FT_Bitmap_Done to finally remove the bitmap object. */
  144. /* */
  145. /* The `library' argument is taken to have access to FreeType's */
  146. /* memory handling functions. */
  147. /* */
  148. FT_EXPORT( FT_Error )
  149. FT_Bitmap_Convert( FT_Library library,
  150. const FT_Bitmap *source,
  151. FT_Bitmap *target,
  152. FT_Int alignment );
  153. /*************************************************************************/
  154. /* */
  155. /* <Function> */
  156. /* FT_GlyphSlot_Own_Bitmap */
  157. /* */
  158. /* <Description> */
  159. /* Make sure that a glyph slot owns `slot->bitmap'. */
  160. /* */
  161. /* <Input> */
  162. /* slot :: The glyph slot. */
  163. /* */
  164. /* <Return> */
  165. /* FreeType error code. 0~means success. */
  166. /* */
  167. /* <Note> */
  168. /* This function is to be used in combination with */
  169. /* @FT_Bitmap_Embolden. */
  170. /* */
  171. FT_EXPORT( FT_Error )
  172. FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot );
  173. /*************************************************************************/
  174. /* */
  175. /* <Function> */
  176. /* FT_Bitmap_Done */
  177. /* */
  178. /* <Description> */
  179. /* Destroy a bitmap object created with @FT_Bitmap_New. */
  180. /* */
  181. /* <Input> */
  182. /* library :: A handle to a library object. */
  183. /* */
  184. /* bitmap :: The bitmap object to be freed. */
  185. /* */
  186. /* <Return> */
  187. /* FreeType error code. 0~means success. */
  188. /* */
  189. /* <Note> */
  190. /* The `library' argument is taken to have access to FreeType's */
  191. /* memory handling functions. */
  192. /* */
  193. FT_EXPORT( FT_Error )
  194. FT_Bitmap_Done( FT_Library library,
  195. FT_Bitmap *bitmap );
  196. /* */
  197. FT_END_HEADER
  198. #endif /* __FTBITMAP_H__ */
  199. /* END */