Add msdf_shape_simple_edge_colors function

This commit is contained in:
KitsuneAlex 2024-05-11 20:34:25 +02:00
parent a142c3d4b3
commit 8d08d7cec7
No known key found for this signature in database
GPG Key ID: 6B0CE864BB69B7D0
2 changed files with 17 additions and 0 deletions

View File

@ -252,6 +252,14 @@ MSDF_API int msdf_shape_orient_contours(msdf_shape_handle shape) {
return MSDF_SUCCESS; return MSDF_SUCCESS;
} }
MSDF_API int msdf_shape_simple_edge_colors(msdf_shape_handle shape, const double angle_threshold) {
if(shape == nullptr) {
return MSDF_ERR_INVALID_ARG;
}
msdfgen::edgeColoringSimple(*reinterpret_cast<msdfgen::Shape*>(shape), angle_threshold);
return MSDF_SUCCESS;
}
MSDF_API void msdf_shape_free(msdf_shape_handle shape) { MSDF_API void msdf_shape_free(msdf_shape_handle shape) {
delete reinterpret_cast<msdfgen::Shape*>(shape); delete reinterpret_cast<msdfgen::Shape*>(shape);
} }

View File

@ -273,6 +273,15 @@ MSDF_API int msdf_shape_bound_miters(msdf_shape_const_handle shape, msdf_bounds_
*/ */
MSDF_API int msdf_shape_orient_contours(msdf_shape_handle shape); MSDF_API int msdf_shape_orient_contours(msdf_shape_handle shape);
/**
* Colors the edges of the given shape using the default MSDF colors specified by thee
* MSDF_COLOR_ prefixed constants.
* @param shape A pointer to a shape whose edges to color with the default MSDF colors.
* @param angle_threshold The threshold angle in degrees.
* @returns @code MSDF_SUCCESS@endcode on success, otherwise one of the constants prefixed with @code MSDF_ERR_@endcode.
*/
MSDF_API int msdf_shape_simple_edge_colors(msdf_shape_handle shape, double angle_threshold);
/** /**
* Calls the destructor of the given bitmap and frees its memory using the * Calls the destructor of the given bitmap and frees its memory using the
* internal allocator. * internal allocator.