[sdf] Add raster parameters structure. * src/sdf/ftsdf.h (SDF_Raster_Params): New structure. * src/sdf/sdf.c: Include source files in order to make a single object of the module.
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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
diff --git a/ChangeLog b/ChangeLog
index b8d6f17..807d05c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2020-08-17 Anuj Verma <anujv@iitbhilai.ac.in>
+ [sdf] Add raster parameters structure.
+
+ * src/sdf/ftsdf.h (SDF_Raster_Params): New structure.
+
+ * src/sdf/sdf.c: Include source files in order to make a single
+ object of the module.
+
+2020-08-17 Anuj Verma <anujv@iitbhilai.ac.in>
+
[sdf] Add 'sdf' renderer.
* src/sdf/ftsdf.c: Add 'sdf' renderer along with its interface
diff --git a/src/sdf/ftsdf.h b/src/sdf/ftsdf.h
index 8e52a68..eda86d9 100644
--- a/src/sdf/ftsdf.h
+++ b/src/sdf/ftsdf.h
@@ -2,6 +2,68 @@
#ifndef FTSDF_H_
#define FTSDF_H_
+#include <ft2build.h>
+#include FT_CONFIG_CONFIG_H
+#include <freetype/ftimage.h>
+
+/* common properties and function */
+#include "ftsdfcommon.h"
+
+FT_BEGIN_HEADER
+
+ /**************************************************************************
+ *
+ * @struct:
+ * SDF_Raster_Params
+ *
+ * @description:
+ * This struct must be passed to the raster render function
+ * @FT_Raster_RenderFunc instead of @FT_Raster_Params because the
+ * rasterizer requires some additional information to render properly.
+ *
+ * @fields:
+ * root ::
+ * The native raster parameters structure.
+ *
+ * spread ::
+ * This is an essential parameter/property required by the renderer.
+ * `spread` defines the maximum unsigned value that is present in the
+ * final SDF output. For the default value check file
+ * `ftsdfcommon.h`.
+ *
+ * flip_sign ::
+ * By default positive values indicate positions inside of contours,
+ * i.e., filled by a contour. If this property is true then that
+ * output will be the opposite of the default, i.e., negative values
+ * indicate positions inside of contours.
+ *
+ * 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 glyphs that do not
+ * have self-intersecting contours. Also, removing overlaps require a
+ * considerable amount of extra memory; additionally, it will not work
+ * if generating SDF from bitmap.
+ *
+ * @note:
+ * All properties are valid for both the 'sdf' and 'bsdf' renderers; the
+ * exception is `overlaps`, which gets ignored by the 'bsdf' renderer.
+ *
+ */
+ typedef struct SDF_Raster_Params_
+ {
+ FT_Raster_Params root;
+ FT_UInt spread;
+ FT_Bool flip_sign;
+ FT_Bool flip_y;
+ FT_Bool overlaps;
+
+ } SDF_Raster_Params;
+
+FT_END_HEADER
#endif /* FTSDF_H_ */
diff --git a/src/sdf/ftsdfrend.h b/src/sdf/ftsdfrend.h
index 00f0238..33e9338 100644
--- a/src/sdf/ftsdfrend.h
+++ b/src/sdf/ftsdfrend.h
@@ -50,6 +50,7 @@ FT_BEGIN_HEADER
* @note:
* All properties except `overlaps` are valid for both the 'sdf' and
* 'bsdf' renderers.
+ *
*/
typedef struct SDF_Renderer_Module_
{
diff --git a/src/sdf/sdf.c b/src/sdf/sdf.c
index 93a4c65..7867787 100644
--- a/src/sdf/sdf.c
+++ b/src/sdf/sdf.c
@@ -1,3 +1,8 @@
+#define FT_MAKE_OPTION_SINGLE_OBJECT
+
+#include "ftsdfrend.c"
+#include "ftbsdf.c"
+#include "ftsdf.c"
/* END */