[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.
This commit is contained in:
Anuj Verma 2020-07-19 07:59:30 +05:30 committed by anujverma
parent e78016b46d
commit f41ee8f0c3
5 changed files with 92 additions and 0 deletions

View File

@ -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.

View File

@ -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 */

View File

@ -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 */

View File

@ -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_ */

View File

@ -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