mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
api: remove a beta api.
- Result Picture::viewbox(float* x, float* y, float* w, float* h) const; //c++ - vg_Result tvg_picture_get_viewbox(const Tvg_Paint* paint, float* x, float* y, float* w, float* h); //c @Issue: https://github.com/thorvg/thorvg/issues/1372
This commit is contained in:
parent
f633717e9f
commit
5ceeb32ef0
8 changed files with 4 additions and 55 deletions
|
@ -1238,15 +1238,6 @@ public:
|
||||||
*/
|
*/
|
||||||
uint32_t mesh(const Polygon** triangles) const noexcept;
|
uint32_t mesh(const Polygon** triangles) const noexcept;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Gets the position and the size of the loaded SVG picture.
|
|
||||||
*
|
|
||||||
* @warning Please do not use it, this API is not official one. It could be modified in the next version.
|
|
||||||
*
|
|
||||||
* @BETA_API
|
|
||||||
*/
|
|
||||||
Result viewbox(float* x, float* y, float* w, float* h) const noexcept;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates a new Picture object.
|
* @brief Creates a new Picture object.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1920,14 +1920,6 @@ TVG_API Tvg_Result tvg_picture_set_size(Tvg_Paint* paint, float w, float h);
|
||||||
TVG_API Tvg_Result tvg_picture_get_size(const Tvg_Paint* paint, float* w, float* h);
|
TVG_API Tvg_Result tvg_picture_get_size(const Tvg_Paint* paint, float* w, float* h);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Gets the position and the size of the loaded picture. (BETA_API)
|
|
||||||
*
|
|
||||||
* \warning Please do not use it, this API is not official one. It can be modified in the next version.
|
|
||||||
*/
|
|
||||||
TVG_API Tvg_Result tvg_picture_get_viewbox(const Tvg_Paint* paint, float* x, float* y, float* w, float* h);
|
|
||||||
|
|
||||||
|
|
||||||
/** \} */ // end defgroup ThorVGCapi_Picture
|
/** \} */ // end defgroup ThorVGCapi_Picture
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -508,13 +508,6 @@ TVG_API Tvg_Result tvg_picture_get_size(const Tvg_Paint* paint, float* w, float*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TVG_API Tvg_Result tvg_picture_get_viewbox(const Tvg_Paint* paint, float* x, float* y, float* w, float* h)
|
|
||||||
{
|
|
||||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
|
||||||
return (Tvg_Result) reinterpret_cast<const Picture*>(paint)->viewbox(x, y, w, h);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* Gradient API */
|
/* Gradient API */
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
|
@ -31,11 +31,6 @@ namespace tvg
|
||||||
class LoadModule
|
class LoadModule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//default view box, if any.
|
|
||||||
float vx = 0;
|
|
||||||
float vy = 0;
|
|
||||||
float vw = 0;
|
|
||||||
float vh = 0;
|
|
||||||
float w = 0, h = 0; //default image size
|
float w = 0, h = 0; //default image size
|
||||||
ColorSpace cs = ColorSpace::Unsupported; //must be clarified at open()
|
ColorSpace cs = ColorSpace::Unsupported; //must be clarified at open()
|
||||||
|
|
||||||
|
|
|
@ -75,13 +75,6 @@ Result Picture::load(uint32_t* data, uint32_t w, uint32_t h, bool copy) noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Result Picture::viewbox(float* x, float* y, float* w, float* h) const noexcept
|
|
||||||
{
|
|
||||||
if (pImpl->viewbox(x, y, w, h)) return Result::Success;
|
|
||||||
return Result::InsufficientCondition;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Result Picture::size(float w, float h) noexcept
|
Result Picture::size(float w, float h) noexcept
|
||||||
{
|
{
|
||||||
if (pImpl->size(w, h)) return Result::Success;
|
if (pImpl->size(w, h)) return Result::Success;
|
||||||
|
|
|
@ -181,16 +181,6 @@ struct Picture::Impl
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool viewbox(float* x, float* y, float* w, float* h)
|
|
||||||
{
|
|
||||||
if (!loader) return false;
|
|
||||||
if (x) *x = loader->vx;
|
|
||||||
if (y) *y = loader->vy;
|
|
||||||
if (w) *w = loader->vw;
|
|
||||||
if (h) *h = loader->vh;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool size(float w, float h)
|
bool size(float w, float h)
|
||||||
{
|
{
|
||||||
this->w = w;
|
this->w = w;
|
||||||
|
|
|
@ -54,6 +54,10 @@ private:
|
||||||
SvgViewFlag viewFlag = SvgViewFlag::None;
|
SvgViewFlag viewFlag = SvgViewFlag::None;
|
||||||
AspectRatioAlign align = AspectRatioAlign::XMidYMid;
|
AspectRatioAlign align = AspectRatioAlign::XMidYMid;
|
||||||
AspectRatioMeetOrSlice meetOrSlice = AspectRatioMeetOrSlice::Meet;
|
AspectRatioMeetOrSlice meetOrSlice = AspectRatioMeetOrSlice::Meet;
|
||||||
|
float vx = 0;
|
||||||
|
float vy = 0;
|
||||||
|
float vw = 0;
|
||||||
|
float vh = 0;
|
||||||
|
|
||||||
bool header();
|
bool header();
|
||||||
void clear();
|
void clear();
|
||||||
|
|
|
@ -123,15 +123,6 @@ TEST_CASE("Load Svg Data in Picture", "[capiPicture]")
|
||||||
REQUIRE(w == Approx(wNew).epsilon(0.0000001));
|
REQUIRE(w == Approx(wNew).epsilon(0.0000001));
|
||||||
REQUIRE(h == Approx(hNew).epsilon(0.0000001));
|
REQUIRE(h == Approx(hNew).epsilon(0.0000001));
|
||||||
|
|
||||||
|
|
||||||
//Verify Position
|
|
||||||
float x, y;
|
|
||||||
REQUIRE(tvg_picture_get_viewbox(picture, &x, &y, &w, &h) == TVG_RESULT_SUCCESS);
|
|
||||||
REQUIRE(x == Approx(0).epsilon(0.0000001));
|
|
||||||
REQUIRE(y == Approx(0).epsilon(0.0000001));
|
|
||||||
REQUIRE(w == Approx(600).epsilon(0.0000001));
|
|
||||||
REQUIRE(h == Approx(600).epsilon(0.0000001));
|
|
||||||
|
|
||||||
REQUIRE(tvg_paint_del(picture) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_paint_del(picture) == TVG_RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue