1 /***************************************************************************/
5 /* FreeType utility functions for bitmaps (specification). */
7 /* Copyright 2004-2006, 2008, 2013, 2014 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
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. */
16 /***************************************************************************/
19 #ifndef __FTBITMAP_H__
20 #define __FTBITMAP_H__
24 #include FT_FREETYPE_H
27 #error "freetype.h of FreeType 1 has been loaded!"
28 #error "Please fix the directory search order for header files"
29 #error "so that freetype.h of FreeType 2 is found first."
36 /*************************************************************************/
45 /* Handling FT_Bitmap objects. */
48 /* This section contains functions for handling @FT_Bitmap objects. */
49 /* Note that none of the functions changes the bitmap's `flow' (as */
50 /* indicated by the sign of the `pitch' field in `FT_Bitmap'). */
52 /*************************************************************************/
55 /*************************************************************************/
61 /* Initialize a pointer to an @FT_Bitmap structure. */
64 /* abitmap :: A pointer to the bitmap structure. */
67 FT_Bitmap_New( FT_Bitmap *abitmap );
70 /*************************************************************************/
76 /* Copy a bitmap into another one. */
79 /* library :: A handle to a library object. */
81 /* source :: A handle to the source bitmap. */
84 /* target :: A handle to the target bitmap. */
87 /* FreeType error code. 0~means success. */
90 FT_Bitmap_Copy( FT_Library library,
91 const FT_Bitmap *source,
95 /*************************************************************************/
98 /* FT_Bitmap_Embolden */
101 /* Embolden a bitmap. The new bitmap will be about `xStrength' */
102 /* pixels wider and `yStrength' pixels higher. The left and bottom */
103 /* borders are kept unchanged. */
106 /* library :: A handle to a library object. */
108 /* xStrength :: How strong the glyph is emboldened horizontally. */
109 /* Expressed in 26.6 pixel format. */
111 /* yStrength :: How strong the glyph is emboldened vertically. */
112 /* Expressed in 26.6 pixel format. */
115 /* bitmap :: A handle to the target bitmap. */
118 /* FreeType error code. 0~means success. */
121 /* The current implementation restricts `xStrength' to be less than */
122 /* or equal to~8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO. */
124 /* If you want to embolden the bitmap owned by a @FT_GlyphSlotRec, */
125 /* you should call @FT_GlyphSlot_Own_Bitmap on the slot first. */
127 /* Bitmaps in @FT_PIXEL_MODE_GRAY2 and @FT_PIXEL_MODE_GRAY@ format */
128 /* are converted to @FT_PIXEL_MODE_GRAY format (i.e., 8bpp). */
130 FT_EXPORT( FT_Error )
131 FT_Bitmap_Embolden( FT_Library library,
137 /*************************************************************************/
140 /* FT_Bitmap_Convert */
143 /* Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, 8bpp or 32bpp */
144 /* to a bitmap object with depth 8bpp, making the number of used */
145 /* bytes line (a.k.a. the `pitch') a multiple of `alignment'. */
148 /* library :: A handle to a library object. */
150 /* source :: The source bitmap. */
152 /* alignment :: The pitch of the bitmap is a multiple of this */
153 /* parameter. Common values are 1, 2, or 4. */
156 /* target :: The target bitmap. */
159 /* FreeType error code. 0~means success. */
162 /* It is possible to call @FT_Bitmap_Convert multiple times without */
163 /* calling @FT_Bitmap_Done (the memory is simply reallocated). */
165 /* Use @FT_Bitmap_Done to finally remove the bitmap object. */
167 /* The `library' argument is taken to have access to FreeType's */
168 /* memory handling functions. */
170 FT_EXPORT( FT_Error )
171 FT_Bitmap_Convert( FT_Library library,
172 const FT_Bitmap *source,
177 /*************************************************************************/
180 /* FT_GlyphSlot_Own_Bitmap */
183 /* Make sure that a glyph slot owns `slot->bitmap'. */
186 /* slot :: The glyph slot. */
189 /* FreeType error code. 0~means success. */
192 /* This function is to be used in combination with */
193 /* @FT_Bitmap_Embolden. */
195 FT_EXPORT( FT_Error )
196 FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot );
199 /*************************************************************************/
205 /* Destroy a bitmap object created with @FT_Bitmap_New. */
208 /* library :: A handle to a library object. */
210 /* bitmap :: The bitmap object to be freed. */
213 /* FreeType error code. 0~means success. */
216 /* The `library' argument is taken to have access to FreeType's */
217 /* memory handling functions. */
219 FT_EXPORT( FT_Error )
220 FT_Bitmap_Done( FT_Library library,
229 #endif /* __FTBITMAP_H__ */