sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Loading...
Searching...
No Matches
ftsdfrend.h
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * ftsdfrend.h
4 *
5 * Signed Distance Field renderer interface (specification).
6 *
7 * Copyright (C) 2020-2025 by
8 * David Turner, Robert Wilhelm, and Werner Lemberg.
9 *
10 * Written by Anuj Verma.
11 *
12 * This file is part of the FreeType project, and may only be used,
13 * modified, and distributed under the terms of the FreeType project
14 * license, LICENSE.TXT. By continuing to use, modify, or distribute
15 * this file you indicate that you have read the license and
16 * understand and accept it fully.
17 *
18 */
19
20
25#ifndef FTSDFREND_H_
26#define FTSDFREND_H_
27
28#include <freetype/ftrender.h>
29#include <freetype/ftmodapi.h>
31
32FT_BEGIN_HEADER
33
34
35 /**************************************************************************
36 *
37 * @struct:
38 * SDF_Renderer_Module
39 *
40 * @description:
41 * This struct extends the native renderer struct `FT_RendererRec`. It
42 * is basically used to store various parameters required by the
43 * renderer and some additional parameters that can be used to tweak the
44 * output of the renderer.
45 *
46 * @fields:
47 * root ::
48 * The native rendere struct.
49 *
50 * spread ::
51 * This is an essential parameter/property required by the renderer.
52 * `spread` defines the maximum unsigned value that is present in the
53 * final SDF output. For the default value check file
54 * `ftsdfcommon.h`.
55 *
56 * flip_sign ::
57 * By default positive values indicate positions inside of contours,
58 * i.e., filled by a contour. If this property is true then that
59 * output will be the opposite of the default, i.e., negative values
60 * indicate positions inside of contours.
61 *
62 * flip_y ::
63 * Setting this parameter to true makes the output image flipped
64 * along the y-axis.
65 *
66 * overlaps ::
67 * Set this to true to generate SDF for glyphs having overlapping
68 * contours. The overlapping support is limited to glyphs that do not
69 * have self-intersecting contours. Also, removing overlaps require a
70 * considerable amount of extra memory; additionally, it will not work
71 * if generating SDF from bitmap.
72 *
73 * @note:
74 * All properties except `overlaps` are valid for both the 'sdf' and
75 * 'bsdf' renderers.
76 *
77 */
78 typedef struct SDF_Renderer_Module_
79 {
80 FT_RendererRec root;
81 FT_UInt spread;
82 FT_Bool flip_sign;
83 FT_Bool flip_y;
84 FT_Bool overlaps;
85
86 } SDF_Renderer_Module, *SDF_Renderer;
87
88
89 /**************************************************************************
90 *
91 * @renderer:
92 * ft_sdf_renderer_class
93 *
94 * @description:
95 * Renderer to convert @FT_Outline to signed distance fields.
96 *
97 */
98 FT_DECLARE_RENDERER( ft_sdf_renderer_class )
99
100
101 /**************************************************************************
102 *
103 * @renderer:
104 * ft_bitmap_sdf_renderer_class
105 *
106 * @description:
107 * This is not exactly a renderer; it is just a converter that
108 * transforms bitmaps to signed distance fields.
109 *
110 * @note:
111 * This is not a separate module, it is part of the 'sdf' module.
112 *
113 */
114 FT_DECLARE_RENDERER( ft_bitmap_sdf_renderer_class )
115
116
117FT_END_HEADER
118
119#endif /* FTSDFREND_H_ */
120
121
122/* END */