mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-13 19:44:28 +00:00
capi: tvg_paint_transform -> tvg_paint_set_transform
This commit is contained in:
parent
0dab343ba1
commit
2780d77a52
4 changed files with 4 additions and 4 deletions
|
@ -780,7 +780,7 @@ TVG_EXPORT Tvg_Result tvg_paint_translate(Tvg_Paint* paint, float x, float y);
|
|||
* \retval TVG_RESULT_INVALID_ARGUMENT A @c nullptr is passed as the argument.
|
||||
* \retval TVG_RESULT_FAILED_ALLOCATION An internal error with memory allocation.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_paint_transform(Tvg_Paint* paint, const Tvg_Matrix* m);
|
||||
TVG_EXPORT Tvg_Result tvg_paint_set_transform(Tvg_Paint* paint, const Tvg_Matrix* m);
|
||||
|
||||
|
||||
/*!
|
||||
|
|
|
@ -162,7 +162,7 @@ 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)
|
||||
TVG_EXPORT Tvg_Result tvg_paint_set_transform(Tvg_Paint* paint, const Tvg_Matrix* m)
|
||||
{
|
||||
if (!paint || !m) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Paint*>(paint)->transform(*(reinterpret_cast<const Matrix*>(m)));
|
||||
|
|
|
@ -191,7 +191,7 @@ void testCapi()
|
|||
tvg_picture_get_size(pict, &w, &h);
|
||||
tvg_picture_set_size(pict, w/2, h/2);
|
||||
Tvg_Matrix m = {0.8f, 0.0f, 400.0f, 0.0f, 0.8f, 400.0f, 0.0f, 0.0f, 1.0f};
|
||||
tvg_paint_transform(pict, &m);
|
||||
tvg_paint_set_transform(pict, &m);
|
||||
|
||||
// Set a composite shape
|
||||
Tvg_Paint* comp = tvg_shape_new();
|
||||
|
|
|
@ -31,7 +31,7 @@ TEST_CASE("Paint Transform", "[capiPaint]")
|
|||
|
||||
Tvg_Matrix matrix_set = {1, 0, 0, 0, 1, 0, 0, 0, 1}, matrix_get;
|
||||
|
||||
REQUIRE(tvg_paint_transform(paint, &matrix_set) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_paint_set_transform(paint, &matrix_set) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_paint_get_transform(paint, &matrix_get) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(matrix_get.e11 == Approx(matrix_set.e11).margin(0.000001));
|
||||
REQUIRE(matrix_get.e12 == Approx(matrix_set.e12).margin(0.000001));
|
||||
|
|
Loading…
Add table
Reference in a new issue