Capi: Composite Method binding

This commit is contained in:
Patryk Kaczmarek 2021-01-26 04:57:56 +01:00 committed by Hermet Park
parent 7d01a1c232
commit 9b4769076f
2 changed files with 22 additions and 0 deletions

View file

@ -105,6 +105,12 @@ typedef enum {
TVG_FILL_RULE_EVEN_ODD TVG_FILL_RULE_EVEN_ODD
} Tvg_Fill_Rule; } Tvg_Fill_Rule;
typedef enum {
TVG_COMPOSITE_METHOD_NONE = 0,
TVG_COMPOSITE_METHOD_CLIP_PATH,
TVG_COMPOSITE_METHOD_ALPHA_MASK
} Tvg_Composite_Method;
typedef struct typedef struct
{ {
float x, y; float x, y;
@ -572,6 +578,17 @@ TVG_EXPORT Tvg_Paint* tvg_paint_duplicate(Tvg_Paint* paint);
*/ */
TVG_EXPORT Tvg_Result tvg_paint_get_bounds(const Tvg_Paint* paint, float* x, float* y, float* w, float* h); TVG_EXPORT Tvg_Result tvg_paint_get_bounds(const Tvg_Paint* paint, float* x, float* y, float* w, float* h);
/*!
* \fn TVG_EXPORT Tvg_Result tvg_paint_set_composite_method(const Tvg_Paint* paint, Tvg_Composite_Method method)
* \brief The function set composition method
* \param[in] paint Tvg_Paint pointer
* \param[in] method Tvg_Composite_Method used composite method
* \return Tvg_Result return value
* - TVG_RESULT_SUCCESS: if ok.
* - TVG_RESULT_INVALID_PARAMETERS: if paint is invalid
*/
TVG_EXPORT Tvg_Result tvg_paint_set_composite_method(const Tvg_Paint* paint, Tvg_Composite_Method method);
/************************************************************************/ /************************************************************************/
/* Shape API */ /* Shape API */
/************************************************************************/ /************************************************************************/

View file

@ -191,6 +191,11 @@ TVG_EXPORT Tvg_Result tvg_paint_get_bounds(const Tvg_Paint* paint, float* x, flo
return (Tvg_Result) reinterpret_cast<const Paint*>(paint)->bounds(x, y, w, h); return (Tvg_Result) reinterpret_cast<const Paint*>(paint)->bounds(x, y, w, h);
} }
TVG_EXPORT Tvg_Result tvg_paint_set_composite_method(const Tvg_Paint* paint, Tvg_Composite_Method method)
{
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
return (Tvg_Result) reinterpret_cast<const Paint*>(paint)->composite(unique_ptr<Paint>((Paint*)(paint)), (CompositeMethod)method);
}
/************************************************************************/ /************************************************************************/
/* Shape API */ /* Shape API */