capi: add tvg_paint_get_transform() api.

This commit is contained in:
Hermet Park 2021-06-03 21:01:54 +09:00 committed by Hermet Park
parent 6b7aa8ad9e
commit b299157123
2 changed files with 20 additions and 0 deletions

View file

@ -721,6 +721,19 @@ TVG_EXPORT Tvg_Result tvg_paint_translate(Tvg_Paint* paint, float x, float y);
TVG_EXPORT Tvg_Result tvg_paint_transform(Tvg_Paint* paint, const Tvg_Matrix* m);
/*!
* \brief Gets the matrix of the affine transformation of the given Tvg_Paint object.
*
* \param[in] paint The Tvg_Paint object of which to get the transformation matrix.
* \param[out] m The 3x3 augmented matrix.
*
* \return Tvg_Result enumeration.
* \retval TVG_RESULT_SUCCESS Succeed.
* \retval TVG_RESULT_INVALID_ARGUMENT A @c nullptr is passed as the argument.
*/
TVG_EXPORT Tvg_Result tvg_paint_get_transform(Tvg_Paint* paint, Tvg_Matrix* m);
/*!
* \brief Sets the opacity of the given Tvg_Paint.
*

View file

@ -161,6 +161,13 @@ TVG_EXPORT Tvg_Result tvg_paint_transform(Tvg_Paint* paint, const Tvg_Matrix* m)
return (Tvg_Result) reinterpret_cast<Paint*>(paint)->transform(*(reinterpret_cast<const Matrix*>(m)));
}
TVG_EXPORT Tvg_Result tvg_paint_get_transform(Tvg_Paint* paint, Tvg_Matrix* m)
{
if (!paint || !m) return TVG_RESULT_INVALID_ARGUMENT;
*reinterpret_cast<Matrix*>(m) = reinterpret_cast<Paint*>(paint)->transform();
return TVG_RESULT_SUCCESS;
}
TVG_EXPORT Tvg_Paint* tvg_paint_duplicate(Tvg_Paint* paint)
{