1 /****************************************************************************
5 * Signed Distance Field renderer interface (specification).
7 * Copyright (C) 2020-2023 by
8 * David Turner, Robert Wilhelm, and Werner Lemberg.
10 * Written by Anuj Verma.
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.
24 #include <freetype/ftrender.h>
25 #include <freetype/ftmodapi.h>
26 #include <freetype/internal/ftobjs.h>
31 /**************************************************************************
37 * This struct extends the native renderer struct `FT_RendererRec`. It
38 * is basically used to store various parameters required by the
39 * renderer and some additional parameters that can be used to tweak the
40 * output of the renderer.
44 * The native rendere struct.
47 * This is an essential parameter/property required by the renderer.
48 * `spread` defines the maximum unsigned value that is present in the
49 * final SDF output. For the default value check file
53 * By default positive values indicate positions inside of contours,
54 * i.e., filled by a contour. If this property is true then that
55 * output will be the opposite of the default, i.e., negative values
56 * indicate positions inside of contours.
59 * Setting this parameter to true makes the output image flipped
63 * Set this to true to generate SDF for glyphs having overlapping
64 * contours. The overlapping support is limited to glyphs that do not
65 * have self-intersecting contours. Also, removing overlaps require a
66 * considerable amount of extra memory; additionally, it will not work
67 * if generating SDF from bitmap.
70 * All properties except `overlaps` are valid for both the 'sdf' and
74 typedef struct SDF_Renderer_Module_
82 } SDF_Renderer_Module, *SDF_Renderer;
85 /**************************************************************************
88 * ft_sdf_renderer_class
91 * Renderer to convert @FT_Outline to signed distance fields.
94 FT_DECLARE_RENDERER( ft_sdf_renderer_class )
97 /**************************************************************************
100 * ft_bitmap_sdf_renderer_class
103 * This is not exactly a renderer; it is just a converter that
104 * transforms bitmaps to signed distance fields.
107 * This is not a separate module, it is part of the 'sdf' module.
110 FT_DECLARE_RENDERER( ft_bitmap_sdf_renderer_class )
115 #endif /* FTSDFREND_H_ */