1/***************************************************************************/
2/* */
3/* ftbitmap.h */
4/* */
5/* FreeType utility functions for bitmaps (specification). */
6/* */
7/* Copyright 2004-2018 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
18
19#ifndef FTBITMAP_H_
20#define FTBITMAP_H_
21
22
23#include <ft2build.h>
24#include FT_FREETYPE_H
25
26#ifdef 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."
30#endif
31
32
33FT_BEGIN_HEADER
34
35
36 /*************************************************************************/
37 /* */
38 /* <Section> */
39 /* bitmap_handling */
40 /* */
41 /* <Title> */
42 /* Bitmap Handling */
43 /* */
44 /* <Abstract> */
45 /* Handling FT_Bitmap objects. */
46 /* */
47 /* <Description> */
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'). */
51 /* */
52 /*************************************************************************/
53
54
55 /*************************************************************************/
56 /* */
57 /* <Function> */
58 /* FT_Bitmap_Init */
59 /* */
60 /* <Description> */
61 /* Initialize a pointer to an @FT_Bitmap structure. */
62 /* */
63 /* <InOut> */
64 /* abitmap :: A pointer to the bitmap structure. */
65 /* */
66 /* <Note> */
67 /* A deprecated name for the same function is `FT_Bitmap_New'. */
68 /* */
69 FT_EXPORT( void )
70 FT_Bitmap_Init( FT_Bitmap *abitmap );
71
72
73 /* deprecated */
74 FT_EXPORT( void )
75 FT_Bitmap_New( FT_Bitmap *abitmap );
76
77
78 /*************************************************************************/
79 /* */
80 /* <Function> */
81 /* FT_Bitmap_Copy */
82 /* */
83 /* <Description> */
84 /* Copy a bitmap into another one. */
85 /* */
86 /* <Input> */
87 /* library :: A handle to a library object. */
88 /* */
89 /* source :: A handle to the source bitmap. */
90 /* */
91 /* <Output> */
92 /* target :: A handle to the target bitmap. */
93 /* */
94 /* <Return> */
95 /* FreeType error code. 0~means success. */
96 /* */
97 FT_EXPORT( FT_Error )
98 FT_Bitmap_Copy( FT_Library library,
99 const FT_Bitmap *source,
100 FT_Bitmap *target );
101
102
103 /*************************************************************************/
104 /* */
105 /* <Function> */
106 /* FT_Bitmap_Embolden */
107 /* */
108 /* <Description> */
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. */
112 /* */
113 /* <Input> */
114 /* library :: A handle to a library object. */
115 /* */
116 /* xStrength :: How strong the glyph is emboldened horizontally. */
117 /* Expressed in 26.6 pixel format. */
118 /* */
119 /* yStrength :: How strong the glyph is emboldened vertically. */
120 /* Expressed in 26.6 pixel format. */
121 /* */
122 /* <InOut> */
123 /* bitmap :: A handle to the target bitmap. */
124 /* */
125 /* <Return> */
126 /* FreeType error code. 0~means success. */
127 /* */
128 /* <Note> */
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. */
131 /* */
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. */
134 /* */
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). */
137 /* */
138 FT_EXPORT( FT_Error )
139 FT_Bitmap_Embolden( FT_Library library,
140 FT_Bitmap* bitmap,
141 FT_Pos xStrength,
142 FT_Pos yStrength );
143
144
145 /*************************************************************************/
146 /* */
147 /* <Function> */
148 /* FT_Bitmap_Convert */
149 /* */
150 /* <Description> */
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'. */
154 /* */
155 /* <Input> */
156 /* library :: A handle to a library object. */
157 /* */
158 /* source :: The source bitmap. */
159 /* */
160 /* alignment :: The pitch of the bitmap is a multiple of this */
161 /* parameter. Common values are 1, 2, or 4. */
162 /* */
163 /* <Output> */
164 /* target :: The target bitmap. */
165 /* */
166 /* <Return> */
167 /* FreeType error code. 0~means success. */
168 /* */
169 /* <Note> */
170 /* It is possible to call @FT_Bitmap_Convert multiple times without */
171 /* calling @FT_Bitmap_Done (the memory is simply reallocated). */
172 /* */
173 /* Use @FT_Bitmap_Done to finally remove the bitmap object. */
174 /* */
175 /* The `library' argument is taken to have access to FreeType's */
176 /* memory handling functions. */
177 /* */
178 FT_EXPORT( FT_Error )
179 FT_Bitmap_Convert( FT_Library library,
180 const FT_Bitmap *source,
181 FT_Bitmap *target,
182 FT_Int alignment );
183
184
185 /*************************************************************************/
186 /* */
187 /* <Function> */
188 /* FT_GlyphSlot_Own_Bitmap */
189 /* */
190 /* <Description> */
191 /* Make sure that a glyph slot owns `slot->bitmap'. */
192 /* */
193 /* <Input> */
194 /* slot :: The glyph slot. */
195 /* */
196 /* <Return> */
197 /* FreeType error code. 0~means success. */
198 /* */
199 /* <Note> */
200 /* This function is to be used in combination with */
201 /* @FT_Bitmap_Embolden. */
202 /* */
203 FT_EXPORT( FT_Error )
204 FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot );
205
206
207 /*************************************************************************/
208 /* */
209 /* <Function> */
210 /* FT_Bitmap_Done */
211 /* */
212 /* <Description> */
213 /* Destroy a bitmap object initialized with @FT_Bitmap_Init. */
214 /* */
215 /* <Input> */
216 /* library :: A handle to a library object. */
217 /* */
218 /* bitmap :: The bitmap object to be freed. */
219 /* */
220 /* <Return> */
221 /* FreeType error code. 0~means success. */
222 /* */
223 /* <Note> */
224 /* The `library' argument is taken to have access to FreeType's */
225 /* memory handling functions. */
226 /* */
227 FT_EXPORT( FT_Error )
228 FT_Bitmap_Done( FT_Library library,
229 FT_Bitmap *bitmap );
230
231
232 /* */
233
234
235FT_END_HEADER
236
237#endif /* FTBITMAP_H_ */
238
239
240/* END */
241