sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Loading...
Searching...
No Matches
ftrender.h
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * ftrender.h
4 *
5 * FreeType renderer modules public interface (specification).
6 *
7 * Copyright (C) 1996-2025 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
23#ifndef FTRENDER_H_
24#define FTRENDER_H_
25
26
27#include <freetype/ftmodapi.h>
28#include <freetype/ftglyph.h>
29
30
31FT_BEGIN_HEADER
32
33
34 /**************************************************************************
35 *
36 * @section:
37 * module_management
38 *
39 */
40
41
42 /* create a new glyph object */
43 typedef FT_Error
44 (*FT_Glyph_InitFunc)( FT_Glyph glyph,
45 FT_GlyphSlot slot );
46
47 /* destroys a given glyph object */
48 typedef void
49 (*FT_Glyph_DoneFunc)( FT_Glyph glyph );
50
51 typedef void
52 (*FT_Glyph_TransformFunc)( FT_Glyph glyph,
53 const FT_Matrix* matrix,
54 const FT_Vector* delta );
55
56 typedef void
57 (*FT_Glyph_GetBBoxFunc)( FT_Glyph glyph,
58 FT_BBox* abbox );
59
60 typedef FT_Error
61 (*FT_Glyph_CopyFunc)( FT_Glyph source,
62 FT_Glyph target );
63
64 typedef FT_Error
65 (*FT_Glyph_PrepareFunc)( FT_Glyph glyph,
66 FT_GlyphSlot slot );
67
68/* deprecated */
69#define FT_Glyph_Init_Func FT_Glyph_InitFunc
70#define FT_Glyph_Done_Func FT_Glyph_DoneFunc
71#define FT_Glyph_Transform_Func FT_Glyph_TransformFunc
72#define FT_Glyph_BBox_Func FT_Glyph_GetBBoxFunc
73#define FT_Glyph_Copy_Func FT_Glyph_CopyFunc
74#define FT_Glyph_Prepare_Func FT_Glyph_PrepareFunc
75
76
78 {
79 FT_Long glyph_size;
80 FT_Glyph_Format glyph_format;
81
82 FT_Glyph_InitFunc glyph_init;
83 FT_Glyph_DoneFunc glyph_done;
84 FT_Glyph_CopyFunc glyph_copy;
85 FT_Glyph_TransformFunc glyph_transform;
86 FT_Glyph_GetBBoxFunc glyph_bbox;
87 FT_Glyph_PrepareFunc glyph_prepare;
88 };
89
90
91 typedef FT_Error
92 (*FT_Renderer_RenderFunc)( FT_Renderer renderer,
93 FT_GlyphSlot slot,
94 FT_Render_Mode mode,
95 const FT_Vector* origin );
96
97 typedef FT_Error
98 (*FT_Renderer_TransformFunc)( FT_Renderer renderer,
99 FT_GlyphSlot slot,
100 const FT_Matrix* matrix,
101 const FT_Vector* delta );
102
103
104 typedef void
105 (*FT_Renderer_GetCBoxFunc)( FT_Renderer renderer,
106 FT_GlyphSlot slot,
107 FT_BBox* cbox );
108
109
110 typedef FT_Error
111 (*FT_Renderer_SetModeFunc)( FT_Renderer renderer,
112 FT_ULong mode_tag,
113 FT_Pointer mode_ptr );
114
115/* deprecated identifiers */
116#define FTRenderer_render FT_Renderer_RenderFunc
117#define FTRenderer_transform FT_Renderer_TransformFunc
118#define FTRenderer_getCBox FT_Renderer_GetCBoxFunc
119#define FTRenderer_setMode FT_Renderer_SetModeFunc
120
121
122 /**************************************************************************
123 *
124 * @struct:
125 * FT_Renderer_Class
126 *
127 * @description:
128 * The renderer module class descriptor.
129 *
130 * @fields:
131 * root ::
132 * The root @FT_Module_Class fields.
133 *
134 * glyph_format ::
135 * The glyph image format this renderer handles.
136 *
137 * render_glyph ::
138 * A method used to render the image that is in a given glyph slot into
139 * a bitmap.
140 *
141 * transform_glyph ::
142 * A method used to transform the image that is in a given glyph slot.
143 *
144 * get_glyph_cbox ::
145 * A method used to access the glyph's cbox.
146 *
147 * set_mode ::
148 * A method used to pass additional parameters.
149 *
150 * raster_class ::
151 * For @FT_GLYPH_FORMAT_OUTLINE renderers only. This is a pointer to
152 * its raster's class.
153 */
154 typedef struct FT_Renderer_Class_
155 {
156 FT_Module_Class root;
157
158 FT_Glyph_Format glyph_format;
159
160 FT_Renderer_RenderFunc render_glyph;
161 FT_Renderer_TransformFunc transform_glyph;
162 FT_Renderer_GetCBoxFunc get_glyph_cbox;
163 FT_Renderer_SetModeFunc set_mode;
164
165 const FT_Raster_Funcs* raster_class;
166
167 } FT_Renderer_Class;
168
169
170 /**************************************************************************
171 *
172 * @function:
173 * FT_Get_Renderer
174 *
175 * @description:
176 * Retrieve the current renderer for a given glyph format.
177 *
178 * @input:
179 * library ::
180 * A handle to the library object.
181 *
182 * format ::
183 * The glyph format.
184 *
185 * @return:
186 * A renderer handle. 0~if none found.
187 *
188 * @note:
189 * An error will be returned if a module already exists by that name, or
190 * if the module requires a version of FreeType that is too great.
191 *
192 * To add a new renderer, simply use @FT_Add_Module. To retrieve a
193 * renderer by its name, use @FT_Get_Module.
194 */
195 FT_EXPORT( FT_Renderer )
196 FT_Get_Renderer( FT_Library library,
197 FT_Glyph_Format format );
198
199
200 /**************************************************************************
201 *
202 * @function:
203 * FT_Set_Renderer
204 *
205 * @description:
206 * Set the current renderer to use, and set additional mode.
207 *
208 * @inout:
209 * library ::
210 * A handle to the library object.
211 *
212 * @input:
213 * renderer ::
214 * A handle to the renderer object.
215 *
216 * num_params ::
217 * The number of additional parameters.
218 *
219 * parameters ::
220 * Additional parameters.
221 *
222 * @return:
223 * FreeType error code. 0~means success.
224 *
225 * @note:
226 * In case of success, the renderer will be used to convert glyph images
227 * in the renderer's known format into bitmaps.
228 *
229 * This doesn't change the current renderer for other formats.
230 *
231 * Currently, no FreeType renderer module uses `parameters`; you should
232 * thus always pass `NULL` as the value.
233 */
234 FT_EXPORT( FT_Error )
235 FT_Set_Renderer( FT_Library library,
236 FT_Renderer renderer,
237 FT_UInt num_params,
238 FT_Parameter* parameters );
239
240 /* */
241
242
243FT_END_HEADER
244
245#endif /* FTRENDER_H_ */
246
247
248/* END */