ReactOS 0.4.16-dev-2354-g16de117
ftbitmap.h
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * ftbitmap.h
4 *
5 * FreeType utility functions for bitmaps (specification).
6 *
7 * Copyright (C) 2004-2020 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 <freetype/freetype.h>
24#include <freetype/ftcolor.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
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 * automatically adjusting the target's bitmap buffer size as needed.
50 *
51 * Note that none of the functions changes the bitmap's 'flow' (as
52 * indicated by the sign of the `pitch` field in @FT_Bitmap).
53 *
54 * To set the flow, assign an appropriate positive or negative value to
55 * the `pitch` field of the target @FT_Bitmap object after calling
56 * @FT_Bitmap_Init but before calling any of the other functions
57 * described here.
58 */
59
60
61 /**************************************************************************
62 *
63 * @function:
64 * FT_Bitmap_Init
65 *
66 * @description:
67 * Initialize a pointer to an @FT_Bitmap structure.
68 *
69 * @inout:
70 * abitmap ::
71 * A pointer to the bitmap structure.
72 *
73 * @note:
74 * A deprecated name for the same function is `FT_Bitmap_New`.
75 */
76 FT_EXPORT( void )
77 FT_Bitmap_Init( FT_Bitmap *abitmap );
78
79
80 /* deprecated */
81 FT_EXPORT( void )
82 FT_Bitmap_New( FT_Bitmap *abitmap );
83
84
85 /**************************************************************************
86 *
87 * @function:
88 * FT_Bitmap_Copy
89 *
90 * @description:
91 * Copy a bitmap into another one.
92 *
93 * @input:
94 * library ::
95 * A handle to a library object.
96 *
97 * source ::
98 * A handle to the source bitmap.
99 *
100 * @output:
101 * target ::
102 * A handle to the target bitmap.
103 *
104 * @return:
105 * FreeType error code. 0~means success.
106 *
107 * @note:
108 * `source->buffer` and `target->buffer` must neither be equal nor
109 * overlap.
110 */
113 const FT_Bitmap *source,
114 FT_Bitmap *target );
115
116
117 /**************************************************************************
118 *
119 * @function:
120 * FT_Bitmap_Embolden
121 *
122 * @description:
123 * Embolden a bitmap. The new bitmap will be about `xStrength` pixels
124 * wider and `yStrength` pixels higher. The left and bottom borders are
125 * kept unchanged.
126 *
127 * @input:
128 * library ::
129 * A handle to a library object.
130 *
131 * xStrength ::
132 * How strong the glyph is emboldened horizontally. Expressed in 26.6
133 * pixel format.
134 *
135 * yStrength ::
136 * How strong the glyph is emboldened vertically. Expressed in 26.6
137 * pixel format.
138 *
139 * @inout:
140 * bitmap ::
141 * A handle to the target bitmap.
142 *
143 * @return:
144 * FreeType error code. 0~means success.
145 *
146 * @note:
147 * The current implementation restricts `xStrength` to be less than or
148 * equal to~8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO.
149 *
150 * If you want to embolden the bitmap owned by a @FT_GlyphSlotRec, you
151 * should call @FT_GlyphSlot_Own_Bitmap on the slot first.
152 *
153 * Bitmaps in @FT_PIXEL_MODE_GRAY2 and @FT_PIXEL_MODE_GRAY@ format are
154 * converted to @FT_PIXEL_MODE_GRAY format (i.e., 8bpp).
155 */
159 FT_Pos xStrength,
160 FT_Pos yStrength );
161
162
163 /**************************************************************************
164 *
165 * @function:
166 * FT_Bitmap_Convert
167 *
168 * @description:
169 * Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, 8bpp or 32bpp to
170 * a bitmap object with depth 8bpp, making the number of used bytes per
171 * line (a.k.a. the 'pitch') a multiple of `alignment`.
172 *
173 * @input:
174 * library ::
175 * A handle to a library object.
176 *
177 * source ::
178 * The source bitmap.
179 *
180 * alignment ::
181 * The pitch of the bitmap is a multiple of this argument. Common
182 * values are 1, 2, or 4.
183 *
184 * @output:
185 * target ::
186 * The target bitmap.
187 *
188 * @return:
189 * FreeType error code. 0~means success.
190 *
191 * @note:
192 * It is possible to call @FT_Bitmap_Convert multiple times without
193 * calling @FT_Bitmap_Done (the memory is simply reallocated).
194 *
195 * Use @FT_Bitmap_Done to finally remove the bitmap object.
196 *
197 * The `library` argument is taken to have access to FreeType's memory
198 * handling functions.
199 *
200 * `source->buffer` and `target->buffer` must neither be equal nor
201 * overlap.
202 */
205 const FT_Bitmap *source,
208
209#ifdef __REACTOS__
211 FT_Bitmap_Convert_ReactOS_Hack( FT_Library library,
212 const FT_Bitmap *source,
215 FT_Bool hack );
216#endif
217
218 /**************************************************************************
219 *
220 * @function:
221 * FT_Bitmap_Blend
222 *
223 * @description:
224 * Blend a bitmap onto another bitmap, using a given color.
225 *
226 * @input:
227 * library ::
228 * A handle to a library object.
229 *
230 * source ::
231 * The source bitmap, which can have any @FT_Pixel_Mode format.
232 *
233 * source_offset ::
234 * The offset vector to the upper left corner of the source bitmap in
235 * 26.6 pixel format. It should represent an integer offset; the
236 * function will set the lowest six bits to zero to enforce that.
237 *
238 * color ::
239 * The color used to draw `source` onto `target`.
240 *
241 * @inout:
242 * target ::
243 * A handle to an `FT_Bitmap` object. It should be either initialized
244 * as empty with a call to @FT_Bitmap_Init, or it should be of type
245 * @FT_PIXEL_MODE_BGRA.
246 *
247 * atarget_offset ::
248 * The offset vector to the upper left corner of the target bitmap in
249 * 26.6 pixel format. It should represent an integer offset; the
250 * function will set the lowest six bits to zero to enforce that.
251 *
252 * @return:
253 * FreeType error code. 0~means success.
254 *
255 * @note:
256 * This function doesn't perform clipping.
257 *
258 * The bitmap in `target` gets allocated or reallocated as needed; the
259 * vector `atarget_offset` is updated accordingly.
260 *
261 * In case of allocation or reallocation, the bitmap's pitch is set to
262 * `4 * width`. Both `source` and `target` must have the same bitmap
263 * flow (as indicated by the sign of the `pitch` field).
264 *
265 * `source->buffer` and `target->buffer` must neither be equal nor
266 * overlap.
267 *
268 * @since:
269 * 2.10
270 */
273 const FT_Bitmap* source,
274 const FT_Vector source_offset,
276 FT_Vector *atarget_offset,
277 FT_Color color );
278
279
280 /**************************************************************************
281 *
282 * @function:
283 * FT_GlyphSlot_Own_Bitmap
284 *
285 * @description:
286 * Make sure that a glyph slot owns `slot->bitmap`.
287 *
288 * @input:
289 * slot ::
290 * The glyph slot.
291 *
292 * @return:
293 * FreeType error code. 0~means success.
294 *
295 * @note:
296 * This function is to be used in combination with @FT_Bitmap_Embolden.
297 */
300
301
302 /**************************************************************************
303 *
304 * @function:
305 * FT_Bitmap_Done
306 *
307 * @description:
308 * Destroy a bitmap object initialized with @FT_Bitmap_Init.
309 *
310 * @input:
311 * library ::
312 * A handle to a library object.
313 *
314 * bitmap ::
315 * The bitmap object to be freed.
316 *
317 * @return:
318 * FreeType error code. 0~means success.
319 *
320 * @note:
321 * The `library` argument is taken to have access to FreeType's memory
322 * handling functions.
323 */
326 FT_Bitmap *bitmap );
327
328
329 /* */
330
331
333
334#endif /* FTBITMAP_H_ */
335
336
337/* END */
_Check_return_ _Ret_maybenull_ _In_ size_t alignment
Definition: align.cpp:48
FT_Library library
Definition: cffdrivr.c:660
FT_GlyphSlot_Own_Bitmap(FT_GlyphSlot slot)
Definition: ftbitmap.c:1172
FT_Bitmap_Blend(FT_Library library, const FT_Bitmap *source, const FT_Vector source_offset, FT_Bitmap *target, FT_Vector *atarget_offset, FT_Color color)
Definition: ftbitmap.c:840
FT_Bitmap_Convert(FT_Library library, const FT_Bitmap *source, FT_Bitmap *target, FT_Int alignment)
Definition: ftbitmap.c:523
FT_BEGIN_HEADER FT_Bitmap_Init(FT_Bitmap *abitmap)
Definition: ftbitmap.c:43
FT_Bitmap_New(FT_Bitmap *abitmap)
Definition: ftbitmap.c:53
FT_Bitmap_Done(FT_Library library, FT_Bitmap *bitmap)
Definition: ftbitmap.c:1197
FT_Bitmap_Embolden(FT_Library library, FT_Bitmap *bitmap, FT_Pos xStrength, FT_Pos yStrength)
Definition: ftbitmap.c:307
FT_Bitmap_Copy(FT_Library library, const FT_Bitmap *source, FT_Bitmap *target)
Definition: ftbitmap.c:63
FT_BEGIN_HEADER struct FT_Color_ FT_Color
#define FT_END_HEADER
Definition: ftheader.h:57
#define FT_BEGIN_HEADER
Definition: ftheader.h:37
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:57
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
int FT_Error
Definition: fttypes.h:299
signed int FT_Int
Definition: fttypes.h:220
GLuint color
Definition: glext.h:6243
#define FT_EXPORT(x)
Definition: vfat.h:185
Definition: uimain.c:89
Definition: tools.h:99