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