Commit Graph

9 Commits

Author SHA1 Message Date
Anuj Verma f644a47aae [sdf] Added overlap support (currently only for TrueType).
* src/sdf/ftsdfrend.h (SDF_Renderer_Module): Removed the
  expermental `optimization' property.
  Added another property `overlaps', which can be used to
  turn on the overlap support.

* src/sdf/ftsdf.h (SDF_Raster_Params): Ditto as above.

* src/sdf/ftsdfrend.c (*): Added functionality to set
  and get the new `overlaps' property.

* src/sdf/ftsdf.c (sdf_raster_render):
  Removed support for all the optimization modes and
  only keep the subdivision optimization and the new
  overlap support function.

* src/sdf/ftsdf.c (sdf_generate_coarse_grid): Turned
  off until we can find a way to make it faster.

* src/sdf/ftsdf.c (sdf_generate_with_overlaps): Added
  a function to generate SDF for shapes with overlapping
  contours. It basically generate SDF for separate contours
  in seperate bitmaps and then combine them to remove
  overlaps.
2020-08-12 10:14:35 +05:30
Anuj Verma 45398811c7 [sdf] Added documentation for some structs.
* src/sdf/ftsdfrend.h
      .../ftsdfrend.c
      .../ftsdfcommon.h
      .../ftsdf.h
  : Added documentation for a few structs.
2020-08-05 17:55:02 +05:30
Anuj Verma 1d51c5ef7b [sdf] Added interface functions for `bsdf' converter.
* src/base/ftobjs.c (FT_Render_Glyph_Internal): Remove
  the bitmap check which prevent calling renderers
  if the glyph is already a bitmap. The `bsdf' renderer
  requires a bitmap for conversion.

* src/base/ftobjs.c (ft_add_renderer): Remove the glyph
  format check which ensures that the glyph format for
  a renderer is `FT_GLYPH_FORMAT_OUTLINE', again the `bsdf'
  renderer has `FT_GLYPH_FORMAT_BITMAP' as a glyph format,
  so we need to remove the condition to initialize the
  renderer properly.

* src/sdf/ftbsdf.c (*): Added a rasterizer for the
  `bsdf' renderer and created necessary functions.

* src/sdf/ftbsdf.h: Add forward declaration of the
  rasterizer.

* src/sdf/ftsdfrend.c (ft_bitmap_sdf_renderer_class):
  Define the new `bsdf' rendere and add the
  `FT_Renderer_RenderFunc' function, the rest is
  same as the `sdf' renderer.

* src/sdf/ftsdfrend.h: Add forward declaration of the
  renderer.

* src/sdf/rules.mk (SDF_DRV_SRC): Add the new `ftbsdf.c'
  file to the compile list.

* src/sdf/sdf.c: Inclue the `ftbsdf.c' file if making
  single object.
2020-08-02 16:33:20 +05:30
Anuj Verma f41ee8f0c3 [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-08-02 16:33:20 +05:30
Anuj Verma d40fc55dad [sdf] Temporary change.
Added new property to dynamically change the
optimization to be used to generate the SDF.
This can be used to compare the performance of
different optimization techniques without going
and recompiling the program.
And will also be used in the demo to check the
performance.
2020-08-02 16:33:19 +05:30
Anuj Verma dd5276601c [sdf] Added more properties.
Added two properties:
- `flip_y': To flip the generated SDF along the y axis.
- `flip_sign': By default outside is treated to have
   negative sign, setting `flip_sign' to 1 the outside
   pixels will have positive sign.

* src/sdf/ftsdf.* (*): Use the newly added properties.

* src/sdf/ftsdfrend.* (*): Add the newly added properties,
  and add functionality to set them using `FT_Property_Set'.
2020-08-02 16:33:19 +05:30
Anuj Verma d21ceef7b4 [sdf] Added functionality to set and get module properties. 2020-08-02 16:33:16 +05:30
Anuj Verma 08ba8d1422 added new `FT_RENDER_MODE_SDF' 2020-08-02 16:33:16 +05:30
preversewharf45 185d07b0cd added the structure of new `sdf' module 2020-08-02 16:33:16 +05:30