OLD | NEW |
| (Empty) |
1 /***************************************************************************/ | |
2 /* */ | |
3 /* ftbitmap.h */ | |
4 /* */ | |
5 /* FreeType utility functions for bitmaps (specification). */ | |
6 /* */ | |
7 /* Copyright 2004-2006, 2008, 2013, 2014 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 | |
33 FT_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_New */ | |
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 FT_EXPORT( void ) | |
67 FT_Bitmap_New( FT_Bitmap *abitmap ); | |
68 | |
69 | |
70 /*************************************************************************/ | |
71 /* */ | |
72 /* <Function> */ | |
73 /* FT_Bitmap_Copy */ | |
74 /* */ | |
75 /* <Description> */ | |
76 /* Copy a bitmap into another one. */ | |
77 /* */ | |
78 /* <Input> */ | |
79 /* library :: A handle to a library object. */ | |
80 /* */ | |
81 /* source :: A handle to the source bitmap. */ | |
82 /* */ | |
83 /* <Output> */ | |
84 /* target :: A handle to the target bitmap. */ | |
85 /* */ | |
86 /* <Return> */ | |
87 /* FreeType error code. 0~means success. */ | |
88 /* */ | |
89 FT_EXPORT( FT_Error ) | |
90 FT_Bitmap_Copy( FT_Library library, | |
91 const FT_Bitmap *source, | |
92 FT_Bitmap *target); | |
93 | |
94 | |
95 /*************************************************************************/ | |
96 /* */ | |
97 /* <Function> */ | |
98 /* FT_Bitmap_Embolden */ | |
99 /* */ | |
100 /* <Description> */ | |
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. */ | |
104 /* */ | |
105 /* <Input> */ | |
106 /* library :: A handle to a library object. */ | |
107 /* */ | |
108 /* xStrength :: How strong the glyph is emboldened horizontally. */ | |
109 /* Expressed in 26.6 pixel format. */ | |
110 /* */ | |
111 /* yStrength :: How strong the glyph is emboldened vertically. */ | |
112 /* Expressed in 26.6 pixel format. */ | |
113 /* */ | |
114 /* <InOut> */ | |
115 /* bitmap :: A handle to the target bitmap. */ | |
116 /* */ | |
117 /* <Return> */ | |
118 /* FreeType error code. 0~means success. */ | |
119 /* */ | |
120 /* <Note> */ | |
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. */ | |
123 /* */ | |
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. */ | |
126 /* */ | |
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). */ | |
129 /* */ | |
130 FT_EXPORT( FT_Error ) | |
131 FT_Bitmap_Embolden( FT_Library library, | |
132 FT_Bitmap* bitmap, | |
133 FT_Pos xStrength, | |
134 FT_Pos yStrength ); | |
135 | |
136 | |
137 /*************************************************************************/ | |
138 /* */ | |
139 /* <Function> */ | |
140 /* FT_Bitmap_Convert */ | |
141 /* */ | |
142 /* <Description> */ | |
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'. */ | |
146 /* */ | |
147 /* <Input> */ | |
148 /* library :: A handle to a library object. */ | |
149 /* */ | |
150 /* source :: The source bitmap. */ | |
151 /* */ | |
152 /* alignment :: The pitch of the bitmap is a multiple of this */ | |
153 /* parameter. Common values are 1, 2, or 4. */ | |
154 /* */ | |
155 /* <Output> */ | |
156 /* target :: The target bitmap. */ | |
157 /* */ | |
158 /* <Return> */ | |
159 /* FreeType error code. 0~means success. */ | |
160 /* */ | |
161 /* <Note> */ | |
162 /* It is possible to call @FT_Bitmap_Convert multiple times without */ | |
163 /* calling @FT_Bitmap_Done (the memory is simply reallocated). */ | |
164 /* */ | |
165 /* Use @FT_Bitmap_Done to finally remove the bitmap object. */ | |
166 /* */ | |
167 /* The `library' argument is taken to have access to FreeType's */ | |
168 /* memory handling functions. */ | |
169 /* */ | |
170 FT_EXPORT( FT_Error ) | |
171 FT_Bitmap_Convert( FT_Library library, | |
172 const FT_Bitmap *source, | |
173 FT_Bitmap *target, | |
174 FT_Int alignment ); | |
175 | |
176 | |
177 /*************************************************************************/ | |
178 /* */ | |
179 /* <Function> */ | |
180 /* FT_GlyphSlot_Own_Bitmap */ | |
181 /* */ | |
182 /* <Description> */ | |
183 /* Make sure that a glyph slot owns `slot->bitmap'. */ | |
184 /* */ | |
185 /* <Input> */ | |
186 /* slot :: The glyph slot. */ | |
187 /* */ | |
188 /* <Return> */ | |
189 /* FreeType error code. 0~means success. */ | |
190 /* */ | |
191 /* <Note> */ | |
192 /* This function is to be used in combination with */ | |
193 /* @FT_Bitmap_Embolden. */ | |
194 /* */ | |
195 FT_EXPORT( FT_Error ) | |
196 FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot ); | |
197 | |
198 | |
199 /*************************************************************************/ | |
200 /* */ | |
201 /* <Function> */ | |
202 /* FT_Bitmap_Done */ | |
203 /* */ | |
204 /* <Description> */ | |
205 /* Destroy a bitmap object created with @FT_Bitmap_New. */ | |
206 /* */ | |
207 /* <Input> */ | |
208 /* library :: A handle to a library object. */ | |
209 /* */ | |
210 /* bitmap :: The bitmap object to be freed. */ | |
211 /* */ | |
212 /* <Return> */ | |
213 /* FreeType error code. 0~means success. */ | |
214 /* */ | |
215 /* <Note> */ | |
216 /* The `library' argument is taken to have access to FreeType's */ | |
217 /* memory handling functions. */ | |
218 /* */ | |
219 FT_EXPORT( FT_Error ) | |
220 FT_Bitmap_Done( FT_Library library, | |
221 FT_Bitmap *bitmap ); | |
222 | |
223 | |
224 /* */ | |
225 | |
226 | |
227 FT_END_HEADER | |
228 | |
229 #endif /* __FTBITMAP_H__ */ | |
230 | |
231 | |
232 /* END */ | |
OLD | NEW |