freetype2/[GSoC]ChangeLog

1059 lines
33 KiB
Plaintext
Raw Normal View History

2020-08-6 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf -> bsdf] Added documentation for functions of the `bsdf' renderer.
* src/sdf/ftbsdf.c (*) Added function documentation for
function of the `bsdf' renderer.
2020-08-6 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added documentation for function of the `sdf' renderer.
* src/sdf/ftsdf.c (*): Added function documentation for
function of the `sdf' renderer, and fixed grammar at a
few places.
2020-08-5 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added documentation for some structs.
* src/sdf/ftsdfrend.h
.../ftsdfrend.c
.../ftsdfcommon.h
.../ftsdf.h
: Added documentation for a few structs.
2020-08-5 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf -> bsdf] Extended to work with monochrome bitmaps.
* src/sdf/ftbsdf.c (bsdf_init_distance_map): Handle
monochrome bitmaps and convert them to the internal
intermediate format, which can then be used to
generate SDF.
2020-08-3 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdfrend.c (ft_bsdf_render): Initialize
the target bitmap so as to avoid crashes due to
uninitialized memory.
2020-08-3 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf -> bsdf] Fixed memory leak.
* src/sdf/ftbsdf.c (bsdf_raster_render): Release the
allocated distance map.
Also, added a log of total memory allocated for
generating SDF from bitmap.
2020-08-2 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf -> bsdf] Fixed a bug with `finalize_sdf'.
* src/sdf/ftbsdf.c (finalize_sdf): First check if the
value is withing [-spread, spread] and then cast it
to 6.10 short, otherwise the value can overflow and
give negative result.
Also, flip the sign if the property `flip_sign' is
set to true.
2020-08-1 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf -> bsdf] Added option to use squared distances.
* src/sdf/ftbsdf.c (bsdf_is_edge): Modified the function
to use distance map rather than the alpha values from
the source image.
* src/sdf/ftbsdf.c (bsdf_approximate_edge): Only calculate
approximate edges for edge pixels. Use `bsdf_is_edge' is
to check for edge pixels. For non edge pixel assgn far
away distances.
* src/sdf/ftbsdf.c (finalize_sdf): Handle distances in case
of squared distances.
And also use the macro `VECTOR_LENGTH_16D16' in the entire
code to compute vector length. This takes care of squared
distances.
* src/sdf/ftsdfcommon.c (VECTOR_LENGTH_16D16): Move the macro
`VECTOR_LENGTH_16D16' from `ftsdf.c' to this file because
it is also used by the `bsdf' renderer.
2020-08-1 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftbsdf.c (compare_neighbor): Fix bug.
2020-08-1 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf -> bsdf] Optimized a bit.
* src/sdf/ftbsdf.c (ED: sign => alpha): Renamed sign
2020-08-01 05:59:31 +02:00
to alphas. This is used to store the alpha of the current
pixel mapped to the source image. This let's us store
additional information without increasing memory usage.
* src/sdf/ftbsdf.c (bsdf_init_distance_map): Removed any/all
kind of edge approximation and edge check from the function.
The function simply copy the source bitmap to the distance
map now, preserving alpha values.
* src/sdf/ftbsdf.c (compute_edge_distance): Use the new `alpha'
parameter to compute gradient and approximate distance.
Previously we were using the `dist' variable to store alpha
values, which restricts modifying the `dist' variable because
we need alpha values of neighbor to compute the gradient.
* src/sdf/ftbsdf.c (bsdf_approximate_edge): Now that we can
modify the `dist' variable of the distance map, we can
combine the two nested loops.
* src/sdf/ftbsdf.c (finalize_sdf): Move the `sign' determination
and assignment to this function.
2020-07-31 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftbsdf.c (compute_edge_distance): Grammer fix.
2020-07-31 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf -> bsdf] Add explanation of the approximation.
* src/sdf/ftbsdf.c (compute_gradient => compute_edge_distance):
Renamed to make sense of what the function does.
Also, added the explanation of the algorithm used
and a high level view of how it works.
* src/sdf/ftbsdf.c (compare_neighbor): Fix a bug related
to value approximation before calling `FT_Vector_Length'.
2020-07-30 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdfcommon.h (*): Fix line endings.
Always use LF line endings.
2020-07-30 Anuj Verma <anujv@iitbhilai.ac.in>
[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-07-30 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftbsdf.c (compute_gradient): Use root(2)
for the filter. Also, use the computed gradient
to approximate the edge distance from a pixel's
position according to the Gustavson's algorithm.
2020-07-29 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf -> bsdf] Added function to approximate edge distance.
* src/sdf/ftbsdf.c (bsdf_approximate_edge): The function
uses the Gustavson's algorithm to approximate the edge
from pixel values.
* src/sdf/ftbsdf.c (compute_gradient): The function uses
Sobel's operator to compute the gradient at a pixel.
The is used to detect edge direction.
2020-07-28 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftbsdf.c (_pass): Use function for repetitive task.
Use function `compare_neighbor' for comparing the
neighbors. Makes it easier to tweak the algorithm
and looks better.
* src/sdf/ftbsdf.c (compare_neighbor): Added function
to compare the neighbors and assign values if the
new distance is the shortest.
2020-07-27 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftbsdf.c (bsdf_is_edge): Use macros to
make it look cleaner.
Use `CHECK_NEIGHBOR' macro to check neighbors while
finding edges. Make the code more readable and look
cleaner.
2020-07-27 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf -> bsdf] Fix edge detection bug.
* src/sdf/ftbsdf.c (bsdf_is_edge): [BUG] Check all
neighbors including the diagonal neighbors to
properly determine the edge.
2020-07-27 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf -> bsdf] Added edge detection algorithm.
Added edge detection algorithm. It works by checking
the neighboring pixels and if any neighbor is not
filled (i.e. belongs to background) we mark the
pixel as edge by setting it's distance to 0.
* src/sdf/ftbsdf.c (bsdf_is_edge): Added function to
detect if the pixel is an edge.
2020-07-27 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf -> bsdf] Added the second pass of the '8SED'.
Added the second pass of the 8SED algorithm. The second pass
transverse the bitmap from bottom to top and for each row
it sweeps forward and backward assigning distances to the
grid points.
* src/sdf/ftbsdf.c (second_pas): Added function to do the
second pass of the 8SED algorithm on the bitmap.
2020-07-26 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf -> bsdf] Optimize the first pass of the 8SED.
* src/sdf/ftbsdf.c (first_pass): Optimize the first
pass by first approximating the neighbor's distance
by adding an offset. The offset will be max root(2)
because the maximum be add to a vector is (1, 1).
By approximating we can reduce the number of
`FT_Vector_Length' calls and thus make the process
faster.
2020-07-26 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Fix GNU Make build.
* src/sdf/rules.mk (SDF_DRV_H): Manually add source files
as there is a `ftbsdf.c' file without any `ftbsdf.h'.
* src/sdf/ftbsdf.c: Include `fttrigon.h' for `multi' builds.
2020-07-26 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf -> bsdf] Added first pass of the '8SED' algorithm.
Added the first pass of the 8SED algorithm. The first pass
transverse the bitmap from top to bottom and for each row
it sweeps forward and backward assigning distances to the
grid points.
* src/sdf/ftbsdf.c (ED): Added additional parameter `sign'.
* src/sdf/ftbsdf.c (edt8): Added function to convert bitmap
to SDF using the 8SED algorithm.
* src/sdf/ftbsdf.c (first_pass): Added function to do the
first pass of the 8SED algorithm on the bitmap.
* src/sdf/ftbsdf.c (finalize_sdf): Added function to assign
the final SDF data to the target bitmap.
* src/sdf/ftbsdf.c (*): Various minor or experimental changes.
* src/sdf/ftsdfrend.c (ft_bsdf_render): Fix spacing.
2020-07-25 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftbsdf.c (*): Rename `SDF_TRaster' => `BSDF_TRaster'.
`SDF_TRaster' is for the `sdf' renderer.
2020-07-25 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftbsdf.c: Typo. `FT_16D16' is 16.16 representation.
2020-07-25 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf -> bsdf renderer] Hold a refrence to `FT_Memory'.
Due to the way the 8SED algorithm works we need to keep
a track of distances and nearest point of all the pixels/
grid points.
* src/sdf/ftbsdf.c (BSDF_TRaster): Added struct to
hold the `FT_Memory' reference, to be used to allocate
memory.
* src/sdf/ftbsdf.c (ED, BSDF_Worker): Added few more
essential struct. `ED' contains infomation about the
nearest point. `BSDF_Worker' is used to combine all
the essentail parameters to functions.
* src/sdf/ftbsdf.c (bsdf_copy_source_to_target =>
bsdf_init_distance_map): Renamed.
* src/sdf/ftbsdf.c (*): Various minor changes.
* src/sdf/sdf.c: Change the order of source include
because `ftsdf.c' change some internal freetype
defines which are required in `ftbsdf.c'.
2020-07-25 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf -> bsdf renderer] Convert 8bit bitmap to 16bit.
* src/sdf/ftbsdf.c (bsdf_copy_source_to_target): Added
extra parameter to flip the bitmap vertically.
* src/sdf/ftbsdf.c (bsdf_copy_source_to_target):
Implemented functionality to convert 8bits per
pixel bitmap to a 16bits per pixel bitmap, which
will be used to generate SDF.
2020-07-24 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Started the `bsdf' rasterier.
* src/sdf/ftbsdf.c (*): Fix line endings.
* src/sdf/ftbsdf.c (bsdf_copy_source_to_target): Added
function to copy the source bitmap to the center of
the target bitmap and also convert it to normalized
16 bits per pixel bitmap.
2020-07-19 Anuj Verma <anujv@iitbhilai.ac.in>
[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-07-19 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add alloc/free functions.
* src/sdf/ftsdf.c (*): Add `sdf_alloc' and `sdf_free'
to allocate and deallocate memory respectively.
By using function we can directly use them in the
conditional statements, which is not possible when
using `do {} while ( 0 )'.
* src/sdf/ftsdf.c (SDF_MEMORY_TRACKER_): When not
debugging don't leave the macros empty otherwise
some compiler may emit warning because of empty
`;' semi-colon.
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.
* src/sdf/ftsdf.c (*): Disable total memory
usage tracking if the program is not in
debug mode.
2020-07-18 Anuj Verma <anujv@iitbhilai.ac.in>
[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-07-18 Anuj Verma <anujv@iitbhilai.ac.in>
[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-07-17 Anuj Verma <anujv@iitbhilai.ac.in>
[sdfb] Added new module to generate SDF from bitmap.
* src/sdfb/sdfb.c, src/sdfb/ftsdfbrend.c,
src/sdfb/ftsdfb.c, src/sdfb/ftsdfbrend.h,
src/sdfb/ftsdfb.h, src/sdfb/ftsdfberrs.h:
Added files required by the `sdfb' renderer module.
* src/sdfb/rules.mk, src/sdfb/module.mk: Added
files required to build the `sdfb' module using
the default build system.
* CMakeLists.txt (BASE_SRCS): Add `src/sdfb/sdfb.c'
to the variable.
* include/freetype/config/ftmodule.h: Added `sdfb'
module declaration so that the module can be compiled
when not compiling with GNU make.
* modules.cfg (RASTER_MODULES): Include `sdfb' module
to the default rasterizer module list.
* include/freetype/ftmoderr.h: sdfb module error define
* src/sdf/rules.mk: Add EOF.
2020-07-17 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added memory tracker.
* src/sdf/ftsdf.c (SDF_MemoryUser): Added struct
which is used in place of `FT_Memory::user'.
* src/sdf/ftsdf.c (SDF_ALLOC, SDF_FREE): Added macros
for allocating and deallocating memory. These macros
restore the old `FT_Memory::user' before calling the
relevant allocation/deallocation functions so as to
not cause errors while debugging memory. And later
they add the allocated memory size in a variable.
* src/sdf/ftsdf.c (*): Use `SDF_ALLOC', `SDF_FREE'
instead of the `FT_' variant.
2020-07-15 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdfrend.c (sdf_property_set): Minor fix.
2020-07-14 Anuj Verma <anujv@iitbhilai.ac.in>
[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-07-13 Anuj Verma <anujv@iitbhilai.ac.in>
[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-07-13 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Check for left or right fill.
* src/sdf/ftsdf.c (SDF_Params): Added struct which
contains some internal data required by the rater-
izer (such as left/right fill).
* src/sdf/ftsdf.c (sdf_raster_render): Determine the
fill side and pass it to the `sdf_generate_' funcs.
* src/sdf/ftsdf.c (sdf_generate_): Use the new `SDF_Params'
to generate SDF accordingly.
2020-07-12 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Optimize the coarse grid optimization.
* src/sdf/ftsdf.c (sdf_generate_coarse_grid): Merge
the relevant edge finding loop and shortest dist-
ance search loop. We can find the relevant edges
of a coarse grid and immediately use them to find
the shortest distance of the points in the coarse
grid. This drastically reduce memory usage and
performance.
Also, do the sign assignment of the edges which was
missing.
2020-07-11 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdf.c (*): Fixed warnings.
Fixed various warnings and other few errors.
2020-07-11 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdf.c (sdf_generate_coarse_grid): Comments.
Add more comments explaining the step by step
process of using coarse grid to increase the
performance of nearest distance search.
2020-07-11 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdf.c (sdf_generate_coarse_grid): Memory leak.
Release the allocated lists for the coarse grid after
we are done using them.
2020-07-11 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Completed the coarse grid optimization.
* src/sdf/ftsdf.c (sdf_generate_coarse_grid): Fixed
an issue with position calculation and upside down
images.
2020-07-10 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Partially completed the coarse grid optimization.
* src/sdf/ftsdf.c (sdf_generate_coarse_grid): Added
functionality to check distances of all edges from
the coarse grid and add the relevant edges to the
list.
[Note]: The function is not complete yet.
2020-07-10 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added the coarse grid optimization function.
* src/sdf/ftsdf.c (sdf_generate_coarse_grid): The
function uses coarse grid to optimize nearest edge
search performance.
2020-07-10 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Remove use of `FT_List'.
Simply use a `next' pointer inside `SDF_Edge' and
`SDF_Contour' to create a linked list. This reduces
the number of allocations due to `FT_ListNode', also
we don't need a doubly linked list.
* src/sdf/ftsdf.c (SDF_Edge, SDF_Contour): Remove the
`FT_List' and use a `next' pointer to create the
linked list.
* src/sdf/ftsdf.c(sdf_edge_destructor, sdf_contour_destructor):
Removed, not needed any more.
* src/sdf/ftsdf.c (*): Remove the use of `FT_List_'
functions wherever necessary and sync with the new
list.
2020-07-09 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added subdivision optimization.
* src/sdf/ftsdf.c (sdf_generate_subdivision): The
function generate SDF just like the `sdf_generate'
function, but subdivide the curve into a number of
lines and then use the `sdf_generate_bounding_box'
function to generate SDF.
2020-07-09 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added functions to subdivide a cubic curve.
* src/sdf/ftsdf.c (split_cubic, split_sdf_cubic):
These functions can be used to subdivide a
cubic bezier curve into line segments which can
then be used to generate the SDF.
* src/sdf/ftsdf.c (split_sdf_shape): Added function
to split a cubic into a line segments.
* src/sdf/ftsdf.c (sdf_shape_done): No need to pass
`FT_Memory' as a parameter, it can be accessed
from the `shape' struct.
2020-07-09 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdf.c (split_sdf_shape): Typo.
2020-07-08 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdf.c (split_sdf_shape): Memory leak.
After recursion the edges variable becomes `NULL'
so reassign it to deallocate the list completely.
2020-07-08 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added functions to subdivide a conic curve.
* src/sdf/ftsdf.c (split_conic, split_sdf_conic):
These functions can be used to subdivide a
conic bezier curve into line segments which can
then be used to generate the SDF.
* src/sdf/ftsdf.c (split_sdf_shape): Added function
to split a outline into a line segments.
2020-07-06 13:05:42 +02:00
2020-07-06 Anuj Verma <anujv@iitbhilai.ac.in>
* [GSoC]ChangLog: Fixed typos.
2020-07-06 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdfrend.c (sdf_generate_bounding_box): Due to
the way we use the bounding box, we need to keep a track
of signed distances of each pixel so later the sign can
be determined properly. The method is certainly faster
2020-07-06 13:05:42 +02:00
then checking all the pixels against all the edges,
but also require a decent amount of memory to work.
2020-07-06 05:43:14 +02:00
2020-07-06 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Precompute the orthogonality.
* src/sdf/ftsdf.c (SDF_Signed_Distance): Remove unused
fields.
* src/sdf/ftsdf.c (resolve_corner): The function can be
simplified to a single line. Instead of computing
orthogonality here, we precompute it in the corresponding
`get_min_distance_' functions more efficiently.
* src/sdf/ftsdf.c (get_min_distance_): Precompute orthogonality/
cross product of direction and the distance vector. Since
in these function we know that weather the distance vector
and the direction are perpendicular, we can simply set
the cross to 1 (sin(90) = 1) in case they are perpendicular.
This can reduce the number of `FT_Vector_NormLen' calls.
2020-07-05 13:33:30 +02:00
2020-07-05 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added bounding box optimization.
* src/sdf/ftsdfrend.c (sdf_generate_bounding_box): The
function generate SDF just like the `sdf_generate'
2020-07-06 13:05:42 +02:00
function, but uses bounding box to check pixels
2020-07-05 13:33:30 +02:00
efficiently.
* src/sdf/ftsdfrend.c (get_control_box): Added function
to get control box of a `SDF_Edge'.
2020-07-04 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdfrend.c (sdf_shape_dump): Use `%ld' to
printf `signed long' otherwise it gives wrong output.
2020-07-04 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdfrend.c (ft_sdf_render): Don't negate
unsigned integers.
2020-07-03 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdf.c: Use ASCII single quote (') instead
of back tick (`) for derivatives. Looks cleaner.
2020-07-03 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added function to find shortest distance from a
point to a cubic bezier. Now the sdf module can render
all types of fonts, but still has some issues.
* src/sdf/ftsdf.c (get_min_distance_cubic): The function
calculates shortest distance from a point to a cubic
bezier curve.
* src/sdf/ftsdf.c (sdf_edge_get_min_distance): Add the
`get_min_distance_cubic' function call.
2020-07-03 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdf.c (resolve_corner): [Bug] Remove the
nearest_point check. Two distances can be same and
can give opposite sign, but they may not have a
common nearest_point. Also remove distance check
because due to precision errors the two distances can
be really really close. Therefore use epsilon instead.
* src/sdf/ftsdf.c (sdf_contour_get_min_distance): Use
epsilon for comparing distances.
2020-07-03 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdf.c (sdf_shape_dump): Add more info
to the debug output.
2020-07-03 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdf.c (MAX_NEWTON_ITERATION => MAX_NEWTON_DIVISIONS):
Renamed to avoid confusion.
2020-07-02 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added Newton's method for shortest distance
from a point to a conic.
* src/sdf/ftsdf.c (get_min_distance_conic): Created
2020-07-06 13:05:42 +02:00
a new function with same name which uses Newton's
iteration for finding shortest distance from a point
to a conic curve. This doesn't causes underflow.
* src/sdf/ftsdf.c (USE_NEWTON_FOR_CONIC): This macro
can be used to toggle between Newton or analytical
cubic solving method.
2020-07-01 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdf.c (get_min_distance_conic): Add more
details to why we clamp the roots.
* src/sdf/ftsdf.c: Make sure preprocessor # is always
on the first line.
2020-07-01 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Make squared distances toggleable.
* src/sdf/ftsdf.c (SDF_Signed_Distance): Renamed
squared_distance to distance. It can now represent
both squared as well as actual distances.
* src/sdf/ftsdf.c (USE_SQUARED_DISTANCES): Added macro
which control weather to do computation is squared
distances or actual distances. This can be used to
avoid overflow when generating large SDF bitmaps.
* src/sdf/ftsdf.c: Make sure not to exceed line length
of 78.
2020-07-01 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdf.c (get_min_distance_conic): In case
the cubic equation returns zero root, use endpoints
for calculating the shortest distance.
2020-07-01 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added function to find shortest distance from a
point to a conic bezier. Now the sdf module can render
ttf fonts or fonts with line and conic segments.
* src/sdf/ftsdf.c (get_min_distance_conic): The function
calculates shortest distance from a point to a conic
bezier curve.
* src/sdf/ftsdf.c (sdf_edge_get_min_distance): Add the
`get_min_distance_conic' function call.
2020-07-01 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdf.c (get_min_distance_line): First check
pointer before using or dereferencing them.
2020-06-30 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdf.c: Avoid parentheses if there is only
one statement inside a control-flow statement.
2020-06-30 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added functions to solve polynomial equations.
* src/sdf/ftsdf.c (solve_quadratic_equation,
solve_cubic_equation): Added functions to solve
quadratic and cubic equations. These will be used for
conic bezier curves only.
2020-06-30 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdf.c (square_root, cube_root, arc_cos):
Use FT_16D16 instead of FT_Fixed to avoid confusion.
2020-06-30 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdf.c (cube_root, arc_cos): Added a few
essential math functions.
2020-06-30 13:37:41 +02:00
2020-06-30 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Fixed compilation under gnumake.
2020-07-06 13:05:42 +02:00
* src/sdf/rules.mk (DRV_OBJ_ => DRV_OBJS_): Fixed variable
2020-06-30 13:37:41 +02:00
name so that the sdf can compile.
* src/sdf/module.mk: Fixed spacing.
* src/sdf/*.c: Fixed all compiler warnings.
* [GSoC]ChangLog: Fixed dates.
2020-06-29 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added function to resolve corners in case of
ambiguity.
* src/sdf/ftsdf.c (resolve_corner): Added function
to determine the correct sign in case there are
two sign for the same shortest distance (happens
around corners).
* src/sdf/ftsdf.c: Typo neartest_point -> nearest_point.
2020-06-30 13:37:41 +02:00
2020-06-29 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] The module can now generate signed distance
fields for outline with only lines.
* src/sdf/ftsdf.c (get_min_distance_line): Calculation
mistake.
* src/sdf/ftsdf.c (square_root): Added function to calculate
square root of a 16.16 fixed point integer.
* src/sdf/ftsdf.c (sdf_generate): Assign values to the output
bitmap, currently the output is 6.10 fixed point which can
contain values from [-32, 32]. Also fixed a bug which was
causing upside down images.
* src/sdf/ftsdfrend.c (ft_sdf_render): Fixed alignment issues.
2020-06-30 13:37:41 +02:00
2020-06-28 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added function to find shortest distance from
a point to a line.
* src/sdf/ftsdf.c (get_min_distance_line): The function
calculate the shortest signed distance from a point
to a line segment.
* src/sdf/ftsdf.c (sdf_contour_get_min_distance): Typo.
* src/sdf/ftsdf.c (SDF_Signed_Distance): Use squared
distance instead of actual distance for performance.
2020-06-30 13:37:41 +02:00
2020-06-28 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdf.c (SDF_Iterator_IO): Removed.
* src/sdf/ftsdf.c (sdf_edge_iterator_func => sdf_edge_get_min_distance
sdf_contour_iterator_func => sdf_contour_get_min_distance): Renamed.
Manually iterate through the lists instead of `FT_List_Iterate' to
avoid io structs and looks a bit cleaner.
2020-06-30 13:37:41 +02:00
2020-06-28 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added basic outline of the functions required to
generate sdf.
* src/sdf/ftsdf.c (SDF_Signed_Distance): Added struct which
represent a complete signed distance and can be used to
get cross, dot, sign etc.
* src/sdf/ftsdf.c (SDF_Iterator_IO): This struct will be used
while `FT_List_Iterate'.
2020-07-06 13:05:42 +02:00
* src/sdf/ftsdf.c (sdf_generate): Added function which generate
SDF from `SDF_Shape'.
* src/sdf/ftsdf.c (sdf_edge_iterator_func,
2020-07-06 13:05:42 +02:00
sdf_contour_iterator_func): Added functions
which iterate through contours and edges and return the shortest
distance.
2020-06-30 13:37:41 +02:00
2020-06-27 Anuj Verma <anujv@iitbhilai.ac.in>
2020-06-27 10:43:05 +02:00
[sdf] Added `SDF_Raster_Params' struct which extends
`FT_Raster_Params' and has a few extra fields. This is done
2020-07-06 13:05:42 +02:00
to pass extra data to the sdf rasterizer which is required
while rasterizing.
2020-06-27 10:43:05 +02:00
* src/sdf/ftsdf.h (SDF_Raster_Params): Added a struct which
extends `FT_Raster_Params' and has the `spread' parameter.
Also moved the max, min and default spread values to this
header file.
* src/sdf/ftsdf.c (sdf_raster_render): Added parameter and
attribute checking in order to pick errors and return
early.
* src//sdf/ftsdfrend.c (ft_sdf_render): Setup the `SDF_Raster_Params'
and pass it to the rasterizer instead of `FT_Raster_Params'.
2020-06-30 13:37:41 +02:00
2020-06-27 Anuj Verma <anujv@iitbhilai.ac.in>
* include/freetype/ftimage.h (FT_RASTER_FLAG_): Added
a new raster flag `FT_RASTER_FLAG_SDF'. The `ftsdf'
rasterizer will only render if this flag is set.
* src/sdf/ftsdfrend.c (ft_sdf_render): Set the `flags' field
of `FT_Raster_Params' to `FT_RASTER_FLAG_SDF'.
2020-06-26 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdf.c (sdf_shape_dump): Use `FT_TRACEX'
instead of `printf'.
2020-06-26 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdf.c (sdf_shape_dump): Added function to
dump the `SDF_Shape' on the console for debugging.
2020-06-26 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added functions to de-allocate `SDF_' structs.
* src/sdf/ftsdf.c (SDF_Contour, SDF_Shape): Use `FT_ListRec'
instead of `FT_List' to avoid a few extra allocations.
* src/sdf/ftsdf.c (SDF_Edge, SDF_Contour, SDF_Shape): Added
functions to de-allocate these structs and their members.
* src/sdf/ftsdfrenc.c: Typo.
2020-06-25 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Decompose outline and store it in a temporary
`SDF_Shape' object for easy iteration and pre-computing
some variables.
* src/sdf/ftsdf.c (sdf_outline_decompose): Added function
to decompost outline and store it in a `SDF_Shape' object.
This allows us to pre-compute some variable.
2020-06-25 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added essential enums and structs required.
* src/freetype/internal/fttrace.h: Remove tabs.
* src/sdf/ftsdfrend.c (ft_sdf_render): Calculate padding
using the `spread'.
* src/sdf/ftsdf.c (SDF_Edge_Type, SDF_Edge, SDF_Contour,
SDF_Shape): Added structures and their initializer
functions.
2020-06-23 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added functionality to set and get module properties.
Also added a `spread' property.
* src/freetype/internal/fttrace.h: Added sdf module trace
define.
* src/sdf/ftsdf.c (sdf_TRaster => SDF_TRaster): Use capital
character for structs.
* src/sdf/ftsdfrend.h (SDF_Renderer_Module): Added a struct
which extends the `FT_RendererRec' and added the `spread'
property.
* src/sdf/ftsdfrend.c: Synchronized the code to use the new
`SDF_Renderer_Module' and added functions to get/set the
properties.
2020-06-20 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Implemented a few functions required by a renderer
module.
* src/sdf/ftsdf.c (sdf_TRaster_): Added new structure to hold
the memory allocator `FT_Memory'.
* src/sdf/ftsdf.c (ft_sdf_raster): Implemented a few essential
functions required by `FT_Raster'.
* src/sdf/ftsdfrend.c (ft_sdf_renderer_class): Implemented a few
essential functions required by `FT_Renderer'.
* src/sdf/ftsdfrend.c (ft_sdf_render): Added functionality to
compute shift and padding before rendering the outline.
2020-06-19 Anuj Verma <anujv@iitbhilai.ac.in>
* include/freetype/ftimage.h (FT_Render_Mode_): Added new
pixel mode `FT_PIXEL_MODE_GRAY16' which will be used
to represent signed values while rendering to SDF bitmap.
2020-06-19 05:56:41 +02:00
2020-06-19 Anuj Verma <anujv@iitbhilai.ac.in>
* include/freetype/freetype.h (FT_Render_Mode_): Added new
rendermode `FT_RENDER_MODE_SDF' which will be used by the
`sdf' module to generate signed distance fields from glyph's
outline.
* src/sdf/ftsdfrend.h, src/sdf/module.mk, src/sdf/rules.mk:
Add a new line at the end of files.
2020-06-18 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added the structure of a new module to render
2020-06-18 06:54:13 +02:00
signed distance fields.
* src/sdf/sdf.c, src/sdf/ftsdfrend.c, src/sdf/ftsdf.c,
src/sdf/ftsdfrend.h, src/sdf/ftsdf.h, src/sdf/ftsdferrs.h:
Added files required by the `sdf' renderer module and added
the basic structure and functions required.
* src/sdf/rules.mk, src/sdf/module.mk: Added files required to
build the `sdf' module using the default build system.
* CMakeLists.txt (BASE_SRCS): Add `src/sdf/sdf.c' to the variable.
* include/freetype/config/ftmodule.h: Added `sdf' module
2020-06-18 06:54:13 +02:00
declaration so that the module can be compiled when not compiling
with GNU make.
* modules.cfg (RASTER_MODULES): Include `sdf' module to the default
rasterizer module list.
2020-06-18 06:54:13 +02:00
* include/freetype/ftmoderr.h: sdf module error define