Commit Graph

10 Commits

Author SHA1 Message Date
Anuj Verma d2d939098d [sdf, bsdf] Fix compiler warnings.
* src/sdf/ftsdf.c, src/sdf/ftbsdf.c (*): Fix compiler warnings caused due to signed
  unsigned mismatch (-Wsign-compare).
2020-08-23 18:03:39 +05:30
Anuj Verma 644a6c24fd [sdf] Added brief technical overview of both the rasterizers.
* src/sdf/ftsdf.c (*): Added a technical overview of the working of the `sdf' rasterizer.

* src/sdf/ftbsdf,c (*) : Added a technical overview of the working of the `bsdf'
  rasterizer.
2020-08-21 03:59:23 -07:00
Anuj Verma d1e95d734c [bsdf] Added the interface functions for the `bsdf' rasterizer.
* src/sdf/ftsdf.c (bsdf_raster_): Added interface functions which are called from the
  FreeType core library to rasterize and do various other stuff with the rasterizer.
2020-08-20 21:25:46 -07:00
Anuj Verma f2545feda9 [bsdf] Added function to copy the SDF data into the output bitmap.
* src/sdf/ftbsdf.c (finalize_sdf): The function uses the final data present in the 
  distance map and copies is to the output bitmap. It also converts our data into the
  desired format.
2020-08-20 21:21:33 -07:00
Anuj Verma c6b4053a76 [bsdf] Added the 8SED algorithm.
* src/sdf/ftbsdf.c (edt8): Added function to do the euclidean transform to the 
  distance map. The function basically does the 8SED algorithm on the distance map 
  to compute the distance transform of the bitmap.

* src/sdf/ftbsdf.c (first_pass, second_pass): The first and the second pass of the 8SED
  algorithm.

* src/sdf/ftbsdf.c (compare_neighbor): Helper function to compare the neighbor of
  a pixel which is required in the 8SED algorithm.
2020-08-20 21:19:32 -07:00
Anuj Verma 461d693c29 [bsdf] Added function to copy source bitmap to the distance map.
* src/sdf/ftbsdf.c (bsdf_init_distance_map): The function copies the source bitmap to
  the intermediate distance map which is present within the `worker'.
2020-08-20 21:09:23 -07:00
Anuj Verma e883c6dc50 [bsdf] Added function to approximate edge distances.
* src/sdf/ftbsdf.c (compute_edge_distance): Added function to approximate edges 
  given only the array of alpha values representing pixel coverage. This function uses
  the Gustavson's algorithm for approximating.

* src/sdf/ftbsdf.c (bsdf_approximate_edge): This function loops through the entire
  bitmap and for edge pixel (found using `bsdf_is_edge') compute approximate edge
  distances (using `compute_edge_distance').
2020-08-20 09:25:15 +05:30
Anuj Verma 44e9d12f0f [bsdf] Added function to find edge pixels given a grid of alpha values.
* src/sdf/ftbsdf.c (bsdf_is_edge): The function find the edge pixel in a distance map
  which is basically a 2D array of alpha values which represent coverage in the
  original input bitmap.
2020-08-20 09:20:26 +05:30
Anuj Verma 2aeee74c0c [bsdf] Added essential structures required by the `bsdf' rasterizer.
* src/sdf/ftbsdf.c (*): Added all the essential structures required internally by the
  `bsdf' rasterizer as well as the initializer for the `ED' struct.
2020-08-20 09:17:38 +05:30
Anuj Verma 29de1ff668 [sdf] Added all the necessary filed required by the module.
Added the necessary files required by the `sdf' module. These include files
for both the `sdf' and the `bsdf' renderers. Here is breakdown of what the
specific files will contain:

* src/sdf/ftsdfrend.*: Both the renderers.

* src/sdf/ftsdf.*: The rasterizer for the `sdf' renderer.

* src/sdf/ftbsdf.c: The rasterizer for the `bsdf' renderer.

* src/sdf/ftsdfcommon.h: Commmon properties and functions for both the
  rasterizers.

* src/sdf/ftsdferrs.h: Common error define.

* src/sdf/sdf.c: For building a single object of the entire module.
2020-08-16 17:09:22 +05:30