[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] anuj-distance-field f41ee8f 67/93: [sdf] Added new renderer
From: |
Anuj Verma |
Subject: |
[freetype2] anuj-distance-field f41ee8f 67/93: [sdf] Added new renderer `bsdf'. |
Date: |
Sun, 2 Aug 2020 07:04:25 -0400 (EDT) |
branch: anuj-distance-field
commit f41ee8f0c3480187c677aa6b82dad59e1a3606fe
Author: Anuj Verma <anujv@iitbhilai.ac.in>
Commit: anujverma <anujv@iitbhilai.ac.in>
[sdf] Added new renderer `bsdf'.
* src/sdf/ftsdfrend.* (*): Added new renderer
named `bsdf' which basically convert bitmap
to signed distance fields. This is a part of
the `sdf' module and not a separate module on
it's own.
* src/sdf/module.mk (FTMODULE_H_COMMANDS): Add
the new renderer to the list of modules.
* include/freetype/config/ftmodule.h: Add the
new renderer to default list of modules when
not compiling with GNU Make.
---
[GSoC]ChangeLog | 17 +++++++++++++++
include/freetype/config/ftmodule.h | 1 +
src/sdf/ftsdfrend.c | 43 ++++++++++++++++++++++++++++++++++++++
src/sdf/ftsdfrend.h | 25 ++++++++++++++++++++++
src/sdf/module.mk | 6 ++++++
5 files changed, 92 insertions(+)
diff --git a/[GSoC]ChangeLog b/[GSoC]ChangeLog
index e7857a5..5faae7a 100644
--- a/[GSoC]ChangeLog
+++ b/[GSoC]ChangeLog
@@ -1,3 +1,20 @@
+2020-07-19 Anuj Verma <anujv@iitbhilai.ac.in>
+
+ [sdf] Added new renderer `bsdf'.
+
+ * src/sdf/ftsdfrend.* (*): Added new renderer
+ named `bsdf' which basically convert bitmap
+ to signed distance fields. This is a part of
+ the `sdf' module and not a separate module on
+ it's own.
+
+ * src/sdf/module.mk (FTMODULE_H_COMMANDS): Add
+ the new renderer to the list of modules.
+
+ * include/freetype/config/ftmodule.h: Add the
+ new renderer to default list of modules when
+ not compiling with GNU Make.
+
2020-07-18 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Only track memory in debug mode.
diff --git a/include/freetype/config/ftmodule.h
b/include/freetype/config/ftmodule.h
index 81b6655..2b46009 100644
--- a/include/freetype/config/ftmodule.h
+++ b/include/freetype/config/ftmodule.h
@@ -27,5 +27,6 @@ FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
FT_USE_MODULE( FT_Renderer_Class, ft_sdf_renderer_class )
+FT_USE_MODULE( FT_Renderer_Class, ft_bitmap_sdf_renderer_class )
/* EOF */
diff --git a/src/sdf/ftsdfrend.c b/src/sdf/ftsdfrend.c
index e3e70c6..ffe8f49 100644
--- a/src/sdf/ftsdfrend.c
+++ b/src/sdf/ftsdfrend.c
@@ -393,4 +393,47 @@
(FT_Raster_Funcs*)&ft_sdf_raster /* raster_class */
)
+ /*************************************************************************/
+ /*************************************************************************/
+ /** **/
+ /** BITMAP TO SDF CONVERTER **/
+ /** **/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ static FT_Error
+ ft_bsdf_render( FT_Renderer module,
+ FT_GlyphSlot slot,
+ FT_Render_Mode mode,
+ const FT_Vector* origin )
+ {
+
+ }
+
+ FT_DEFINE_RENDERER(
+ ft_bitmap_sdf_renderer_class,
+
+ FT_MODULE_RENDERER,
+ sizeof( SDF_Renderer_Module ),
+
+ "bsdf",
+ 0x10000L,
+ 0x20000L,
+
+ NULL,
+
+ (FT_Module_Constructor) ft_sdf_init,
+ (FT_Module_Destructor) ft_sdf_done,
+ (FT_Module_Requester) ft_sdf_requester,
+
+ FT_GLYPH_FORMAT_BITMAP,
+
+ (FT_Renderer_RenderFunc) ft_bsdf_render, /* render_glyph */
+ (FT_Renderer_TransformFunc) ft_sdf_transform, /* transform_glyph */
+ (FT_Renderer_GetCBoxFunc) ft_sdf_get_cbox, /* get_glyph_cbox */
+ (FT_Renderer_SetModeFunc) ft_sdf_set_mode, /* set_mode */
+
+ (FT_Raster_Funcs*)NULL /* raster_class */
+ )
+
/* END */
diff --git a/src/sdf/ftsdfrend.h b/src/sdf/ftsdfrend.h
index 262a2a1..3ba7b9d 100644
--- a/src/sdf/ftsdfrend.h
+++ b/src/sdf/ftsdfrend.h
@@ -35,9 +35,34 @@ FT_BEGIN_HEADER
} 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 seperate module, it is a part of the `sdf' module.
+ *
+ */
+ FT_DECLARE_RENDERER( ft_bitmap_sdf_renderer_class )
+
+
FT_END_HEADER
#endif /* FTSDFREND_H_ */
diff --git a/src/sdf/module.mk b/src/sdf/module.mk
index d4253bd..978e13f 100644
--- a/src/sdf/module.mk
+++ b/src/sdf/module.mk
@@ -1,10 +1,16 @@
FTMODULE_H_COMMANDS += SDF_RENDERER
+FTMODULE_H_COMMANDS += BSDF_RENDERER
define SDF_RENDERER
$(OPEN_DRIVER) FT_Renderer_Class, ft_sdf_renderer_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)sdf $(ECHO_DRIVER_DESC)signed distance field
renderer$(ECHO_DRIVER_DONE)
endef
+define BSDF_RENDERER
+$(OPEN_DRIVER) FT_Renderer_Class, ft_bitmap_sdf_renderer_class $(CLOSE_DRIVER)
+$(ECHO_DRIVER)bsdf $(ECHO_DRIVER_DESC)bitmap to signed distance field
converter$(ECHO_DRIVER_DONE)
+endef
+
#EOF
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] anuj-distance-field f41ee8f 67/93: [sdf] Added new renderer `bsdf'.,
Anuj Verma <=