1 /***************************************************************************/
5 /* FreeType utility functions for bitmaps (specification). */
7 /* Copyright 2004-2018 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 /***************************************************************************/
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 /* A deprecated name for the same function is `FT_Bitmap_New'. */
70 FT_Bitmap_Init( FT_Bitmap
*abitmap
);
75 FT_Bitmap_New( FT_Bitmap
*abitmap
);
78 /*************************************************************************/
84 /* Copy a bitmap into another one. */
87 /* library :: A handle to a library object. */
89 /* source :: A handle to the source bitmap. */
92 /* target :: A handle to the target bitmap. */
95 /* FreeType error code. 0~means success. */
98 FT_Bitmap_Copy( FT_Library library
,
99 const FT_Bitmap
*source
,
103 /*************************************************************************/
106 /* FT_Bitmap_Embolden */
109 /* Embolden a bitmap. The new bitmap will be about `xStrength' */
110 /* pixels wider and `yStrength' pixels higher. The left and bottom */
111 /* borders are kept unchanged. */
114 /* library :: A handle to a library object. */
116 /* xStrength :: How strong the glyph is emboldened horizontally. */
117 /* Expressed in 26.6 pixel format. */
119 /* yStrength :: How strong the glyph is emboldened vertically. */
120 /* Expressed in 26.6 pixel format. */
123 /* bitmap :: A handle to the target bitmap. */
126 /* FreeType error code. 0~means success. */
129 /* The current implementation restricts `xStrength' to be less than */
130 /* or equal to~8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO. */
132 /* If you want to embolden the bitmap owned by a @FT_GlyphSlotRec, */
133 /* you should call @FT_GlyphSlot_Own_Bitmap on the slot first. */
135 /* Bitmaps in @FT_PIXEL_MODE_GRAY2 and @FT_PIXEL_MODE_GRAY@ format */
136 /* are converted to @FT_PIXEL_MODE_GRAY format (i.e., 8bpp). */
138 FT_EXPORT( FT_Error
)
139 FT_Bitmap_Embolden( FT_Library library
,
145 /*************************************************************************/
148 /* FT_Bitmap_Convert */
151 /* Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, 8bpp or 32bpp */
152 /* to a bitmap object with depth 8bpp, making the number of used */
153 /* bytes line (a.k.a. the `pitch') a multiple of `alignment'. */
156 /* library :: A handle to a library object. */
158 /* source :: The source bitmap. */
160 /* alignment :: The pitch of the bitmap is a multiple of this */
161 /* parameter. Common values are 1, 2, or 4. */
164 /* target :: The target bitmap. */
167 /* FreeType error code. 0~means success. */
170 /* It is possible to call @FT_Bitmap_Convert multiple times without */
171 /* calling @FT_Bitmap_Done (the memory is simply reallocated). */
173 /* Use @FT_Bitmap_Done to finally remove the bitmap object. */
175 /* The `library' argument is taken to have access to FreeType's */
176 /* memory handling functions. */
178 FT_EXPORT( FT_Error
)
179 FT_Bitmap_Convert( FT_Library library
,
180 const FT_Bitmap
*source
,
185 /*************************************************************************/
188 /* FT_GlyphSlot_Own_Bitmap */
191 /* Make sure that a glyph slot owns `slot->bitmap'. */
194 /* slot :: The glyph slot. */
197 /* FreeType error code. 0~means success. */
200 /* This function is to be used in combination with */
201 /* @FT_Bitmap_Embolden. */
203 FT_EXPORT( FT_Error
)
204 FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot
);
207 /*************************************************************************/
213 /* Destroy a bitmap object initialized with @FT_Bitmap_Init. */
216 /* library :: A handle to a library object. */
218 /* bitmap :: The bitmap object to be freed. */
221 /* FreeType error code. 0~means success. */
224 /* The `library' argument is taken to have access to FreeType's */
225 /* memory handling functions. */
227 FT_EXPORT( FT_Error
)
228 FT_Bitmap_Done( FT_Library library
,
237 #endif /* FTBITMAP_H_ */