sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Loading...
Searching...
No Matches
ftsdf.h
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * ftsdf.h
4 *
5 * Signed Distance Field support (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 FTSDF_H_
26#define FTSDF_H_
27
28#include <ft2build.h>
29#include FT_CONFIG_CONFIG_H
30#include <freetype/ftimage.h>
31
32/* common properties and function */
33#include "ftsdfcommon.h"
34
35FT_BEGIN_HEADER
36
37 /**************************************************************************
38 *
39 * @struct:
40 * SDF_Raster_Params
41 *
42 * @description:
43 * This struct must be passed to the raster render function
44 * @FT_Raster_RenderFunc instead of @FT_Raster_Params because the
45 * rasterizer requires some additional information to render properly.
46 *
47 * @fields:
48 * root ::
49 * The native raster parameters structure.
50 *
51 * spread ::
52 * This is an essential parameter/property required by the renderer.
53 * `spread` defines the maximum unsigned value that is present in the
54 * final SDF output. For the default value check file
55 * `ftsdfcommon.h`.
56 *
57 * flip_sign ::
58 * By default positive values indicate positions inside of contours,
59 * i.e., filled by a contour. If this property is true then that
60 * output will be the opposite of the default, i.e., negative values
61 * indicate positions inside of contours.
62 *
63 * flip_y ::
64 * Setting this parameter to true makes the output image flipped
65 * along the y-axis.
66 *
67 * overlaps ::
68 * Set this to true to generate SDF for glyphs having overlapping
69 * contours. The overlapping support is limited to glyphs that do not
70 * have self-intersecting contours. Also, removing overlaps require a
71 * considerable amount of extra memory; additionally, it will not work
72 * if generating SDF from bitmap.
73 *
74 * @note:
75 * All properties are valid for both the 'sdf' and 'bsdf' renderers; the
76 * exception is `overlaps`, which gets ignored by the 'bsdf' renderer.
77 *
78 */
79 typedef struct SDF_Raster_Params_
80 {
81 FT_Raster_Params root;
82 FT_UInt spread;
83 FT_Bool flip_sign;
84 FT_Bool flip_y;
85 FT_Bool overlaps;
86
87 } SDF_Raster_Params;
88
89
90 /* rasterizer to convert outline to SDF */
91 FT_EXPORT_VAR( const FT_Raster_Funcs ) ft_sdf_raster;
92
93 /* rasterizer to convert bitmap to SDF */
94 FT_EXPORT_VAR( const FT_Raster_Funcs ) ft_bitmap_sdf_raster;
95
96FT_END_HEADER
97
98#endif /* FTSDF_H_ */
99
100
101/* END */