Commit Graph

11 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 f2553d89b2 [sdf,bsdf] Put common propertied and functions in one file.
* src/sdf/ftsdfcommon.h: Added new file which contains
  common function, macros, properties for both `sdf' and
  `bsdf' renderer.

* src/sdf/ftsdf.c, src/sdf/ftsdf.h, src/sdf/ftbsdf.c:
  Remove common properties and include `ftsdfcommon.h'.

* src/sdf/rules.mk (SDF_DRV_H): Add the new `ftsdfcommon.h'
  file to include list.
2020-08-02 16:33:21 +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 c09257f0dd [sdfb] Removed Module.
Remove sdfb module. Instead of a new module
simply create a new renderer in the `sdf'
module for converting bitmaps to SDF.
2020-08-02 16:33:20 +05:30
Anuj Verma f4918e139c Revert "[sdfb] Fix GNU Make build."
This reverts commit 0d9179f4e8cdb02986f5d01f178364e3f2b8dc07.
2020-08-02 16:33:20 +05:30
Anuj Verma fca2ed969c [sdfb] Fix GNU Make build.
* src/sdfb/rules.mk (SDFB_DRV_H): Fix name of
  the module specific error file `ftsdfberrs.h'.

* src/sdf/ftsdf.h (Optimizations): Fix warning.
  `warning: comma at end of enumerator list [-Wpedantic]'

* src/sdf/ftsdf.c (sdf_generate_coarse_grid): Remove
  unused variable `cindex', causes warning.
  `warning: unused variable 'cindex' [-Wunused-variable]'
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 6d4e00ae37 [sdf] Added `SDF_Raster_Params'. 2020-08-02 16:33:17 +05:30
preversewharf45 185d07b0cd added the structure of new `sdf' module 2020-08-02 16:33:16 +05:30