summaryrefslogtreecommitdiff
path: root/src/sdf/ftsdfrend.h
blob: 80ebd2bccf6ff44c7985660144f9b226e8c0f9ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100

#ifndef FTSDFREND_H_
#define FTSDFREND_H_


#include <freetype/ftrender.h>
#include <freetype/ftmodapi.h>
#include <freetype/internal/ftobjs.h>


FT_BEGIN_HEADER

  /**************************************************************************
   *
   * @struct:
   *   SDF_Renderer_Module
   *
   * @description:
   *   This struct extends the native renderer struct `FT_RendererRec'.
   *   It is basically used to store various parameters required by the
   *   renderer and some additional parameters which can be used to
   *   tweak the output of the renderer.
   *
   * @fields:
   *   root ::
   *     The native rendere struct.
   *
   *   spread ::
   *     This is and essential parameter/property required by the
   *     rendere. `spread' defines the maximum unsigned value that
   *     will be present in the final SDF output. For default value
   *     check `ftsdfcommon.h'.
   *
   *   flip_sign ::
   *     By default the position values are inside the contours i.e.
   *     filled by a contour. If this property is true then that output
   *     will be opposite from the default i.e. negative will be filled
   *     by a contour.
   *
   *   flip_y ::
   *     Setting this parameter to true maked the output image flipped
   *     along the y-axis.
   *   
   *   overlaps ::
   *     Set this to true to generate SDF for glyphs having overlapping
   *     contours. The overlapping support is limited to glyph which do
   *     not have self intersecting contours. Also, removing overlaps
   *     require a considerable amount of extra memory and this is not
   *     valid while generating SDF from bitmap.
   *
   * @note:
   *   All properties except `overlaps' is valid for both `sdf' and
   *   `bsdf' renderer.
   *
   */
  typedef struct  SDF_Renderer_Module_
  {
    FT_RendererRec  root;
    FT_UInt         spread;
    FT_Bool         flip_sign;
    FT_Bool         flip_y;
    FT_Bool         overlaps;

  } SDF_Renderer_Module, *SDF_Renderer;


  /**************************************************************************
   *
   * @renderer:
   *   ft_sdf_renderer_class
   *
   * @description:
   *   Renderer to convert `FT_Outline' to signed distance fields.
   *
   */
  FT_DECLARE_RENDERER( ft_sdf_renderer_class )


  /**************************************************************************
   *
   * @renderer:
   *   ft_bitmap_sdf_renderer_class
   *
   * @description:
   *   This is not exactly a renderer, it's just a converter which
   *   convert bitmaps to signed distance fields.
   *
   * @note:
   *   This is not a separate module, it is a part of the `sdf' module.
   *
   */
  FT_DECLARE_RENDERER( ft_bitmap_sdf_renderer_class )


FT_END_HEADER

#endif /* FTSDFREND_H_ */


/* END */