mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
api: remove deprecations
issue: https://github.com/thorvg/thorvg/issues/1372
This commit is contained in:
parent
40b82c26f5
commit
01559a45c0
9 changed files with 0 additions and 282 deletions
54
inc/thorvg.h
54
inc/thorvg.h
|
@ -457,11 +457,6 @@ public:
|
||||||
*/
|
*/
|
||||||
uint32_t id = 0;
|
uint32_t id = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Paint::type()
|
|
||||||
*/
|
|
||||||
TVG_DEPRECATED uint32_t identifier() const noexcept;
|
|
||||||
|
|
||||||
_TVG_DECLARE_PRIVATE(Paint);
|
_TVG_DECLARE_PRIVATE(Paint);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -563,11 +558,6 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual Type type() const noexcept = 0;
|
virtual Type type() const noexcept = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Fill::type()
|
|
||||||
*/
|
|
||||||
TVG_DEPRECATED uint32_t identifier() const noexcept;
|
|
||||||
|
|
||||||
_TVG_DECLARE_PRIVATE(Fill);
|
_TVG_DECLARE_PRIVATE(Fill);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -751,11 +741,6 @@ public:
|
||||||
*/
|
*/
|
||||||
Type type() const noexcept override;
|
Type type() const noexcept override;
|
||||||
|
|
||||||
/**
|
|
||||||
* @see LinearGradient::type()
|
|
||||||
*/
|
|
||||||
TVG_DEPRECATED static uint32_t identifier() noexcept;
|
|
||||||
|
|
||||||
_TVG_DECLARE_PRIVATE(LinearGradient);
|
_TVG_DECLARE_PRIVATE(LinearGradient);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -816,11 +801,6 @@ public:
|
||||||
*/
|
*/
|
||||||
Type type() const noexcept override;
|
Type type() const noexcept override;
|
||||||
|
|
||||||
/**
|
|
||||||
* @see RadialGradient::type()
|
|
||||||
*/
|
|
||||||
TVG_DEPRECATED static uint32_t identifier() noexcept;
|
|
||||||
|
|
||||||
_TVG_DECLARE_PRIVATE(RadialGradient);
|
_TVG_DECLARE_PRIVATE(RadialGradient);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -940,23 +920,6 @@ public:
|
||||||
*/
|
*/
|
||||||
Result appendCircle(float cx, float cy, float rx, float ry) noexcept;
|
Result appendCircle(float cx, float cy, float rx, float ry) noexcept;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Appends a circular arc to the path.
|
|
||||||
*
|
|
||||||
* The arc is treated as a new sub-path - it is not connected with the previous sub-path.
|
|
||||||
* The current point value is set to the end-point of the arc in case @p pie is @c false, and to the center of the arc otherwise.
|
|
||||||
*
|
|
||||||
* @param[in] cx The horizontal coordinate of the center of the arc.
|
|
||||||
* @param[in] cy The vertical coordinate of the center of the arc.
|
|
||||||
* @param[in] radius The radius of the arc.
|
|
||||||
* @param[in] startAngle The start angle of the arc given in degrees, measured counter-clockwise from the horizontal line.
|
|
||||||
* @param[in] sweep The central angle of the arc given in degrees, measured counter-clockwise from @p startAngle.
|
|
||||||
* @param[in] pie Specifies whether to draw radii from the arc's center to both of its end-point - drawn if @c true.
|
|
||||||
*
|
|
||||||
* @note Setting @p sweep value greater than 360 degrees, is equivalent to calling appendCircle(cx, cy, radius, radius).
|
|
||||||
*/
|
|
||||||
TVG_DEPRECATED Result appendArc(float cx, float cy, float radius, float startAngle, float sweep, bool pie) noexcept;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Appends a given sub-path to the path.
|
* @brief Appends a given sub-path to the path.
|
||||||
*
|
*
|
||||||
|
@ -1222,11 +1185,6 @@ public:
|
||||||
*/
|
*/
|
||||||
Type type() const noexcept override;
|
Type type() const noexcept override;
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Shape::type()
|
|
||||||
*/
|
|
||||||
TVG_DEPRECATED static uint32_t identifier() noexcept;
|
|
||||||
|
|
||||||
_TVG_DECLARE_PRIVATE(Shape);
|
_TVG_DECLARE_PRIVATE(Shape);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1356,11 +1314,6 @@ public:
|
||||||
*/
|
*/
|
||||||
Type type() const noexcept override;
|
Type type() const noexcept override;
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Picture::type()
|
|
||||||
*/
|
|
||||||
TVG_DEPRECATED static uint32_t identifier() noexcept;
|
|
||||||
|
|
||||||
_TVG_DECLARE_ACCESSOR(Animation);
|
_TVG_DECLARE_ACCESSOR(Animation);
|
||||||
_TVG_DECLARE_PRIVATE(Picture);
|
_TVG_DECLARE_PRIVATE(Picture);
|
||||||
};
|
};
|
||||||
|
@ -1454,11 +1407,6 @@ public:
|
||||||
*/
|
*/
|
||||||
Type type() const noexcept override;
|
Type type() const noexcept override;
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Scene::type()
|
|
||||||
*/
|
|
||||||
TVG_DEPRECATED static uint32_t identifier() noexcept;
|
|
||||||
|
|
||||||
_TVG_DECLARE_PRIVATE(Scene);
|
_TVG_DECLARE_PRIVATE(Scene);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2098,8 +2046,6 @@ class TVG_API Accessor final
|
||||||
public:
|
public:
|
||||||
~Accessor();
|
~Accessor();
|
||||||
|
|
||||||
TVG_DEPRECATED std::unique_ptr<Picture> set(std::unique_ptr<Picture> picture, std::function<bool(const Paint* paint)> func) noexcept;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the access function for traversing the Picture scene tree nodes.
|
* @brief Set the access function for traversing the Picture scene tree nodes.
|
||||||
*
|
*
|
||||||
|
|
|
@ -611,37 +611,6 @@ TVG_API Tvg_Result tvg_canvas_destroy(Tvg_Canvas* canvas);
|
||||||
TVG_API Tvg_Result tvg_canvas_push(Tvg_Canvas* canvas, Tvg_Paint* paint);
|
TVG_API Tvg_Result tvg_canvas_push(Tvg_Canvas* canvas, Tvg_Paint* paint);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Reserves a memory block where the objects pushed into a canvas are stored.
|
|
||||||
*
|
|
||||||
* If the number of Tvg_Paints to be stored in a canvas is known in advance, calling this function reduces the multiple
|
|
||||||
* memory allocations thus improves the performance.
|
|
||||||
*
|
|
||||||
* \code
|
|
||||||
* Tvg_Canvas *canvas = NULL;
|
|
||||||
*
|
|
||||||
* tvg_engine_init(TVG_ENGINE_SW, 4);
|
|
||||||
* canvas = tvg_swcanvas_create();
|
|
||||||
*
|
|
||||||
* uint32_t *buffer = NULL;
|
|
||||||
* buffer = (uint32_t*) malloc(sizeof(uint32_t) * 100 * 100);
|
|
||||||
* if (!buffer) return;
|
|
||||||
*
|
|
||||||
* tvg_swcanvas_set_target(canvas, buffer, 100, 100, 100, TVG_COLORSPACE_ARGB8888);
|
|
||||||
*
|
|
||||||
* tvg_canvas_destroy(canvas);
|
|
||||||
* tvg_engine_term(TVG_ENGINE_SW)
|
|
||||||
* \endcode
|
|
||||||
*
|
|
||||||
* \param[in] canvas The Tvg_Canvas object managing the reserved memory.
|
|
||||||
* \param[in] n The number of objects for which the memory is to be reserved.
|
|
||||||
*
|
|
||||||
* \return Tvg_Result enumeration.
|
|
||||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Canvas pointer.
|
|
||||||
*/
|
|
||||||
TVG_DEPRECATED TVG_API Tvg_Result tvg_canvas_reserve(Tvg_Canvas* canvas, uint32_t n);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Sets the total number of the paints pushed into the canvas to be zero.
|
* \brief Sets the total number of the paints pushed into the canvas to be zero.
|
||||||
* Tvg_Paint objects stored in the canvas are released if @p paints is set to @c true, otherwise the memory is not deallocated and
|
* Tvg_Paint objects stored in the canvas are released if @p paints is set to @c true, otherwise the memory is not deallocated and
|
||||||
|
@ -1029,12 +998,6 @@ TVG_API Tvg_Result tvg_paint_set_clip(Tvg_Paint* paint, Tvg_Paint* clipper);
|
||||||
TVG_API Tvg_Result tvg_paint_get_type(const Tvg_Paint* paint, Tvg_Type* type);
|
TVG_API Tvg_Result tvg_paint_get_type(const Tvg_Paint* paint, Tvg_Type* type);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \see tvg_paint_get_type()
|
|
||||||
*/
|
|
||||||
TVG_DEPRECATED TVG_API Tvg_Result tvg_paint_get_identifier(const Tvg_Paint* paint, Tvg_Identifier* identifier);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets the blending method for the paint object.
|
* @brief Sets the blending method for the paint object.
|
||||||
*
|
*
|
||||||
|
@ -1215,28 +1178,6 @@ TVG_API Tvg_Result tvg_shape_append_rect(Tvg_Paint* paint, float x, float y, flo
|
||||||
TVG_API Tvg_Result tvg_shape_append_circle(Tvg_Paint* paint, float cx, float cy, float rx, float ry);
|
TVG_API Tvg_Result tvg_shape_append_circle(Tvg_Paint* paint, float cx, float cy, float rx, float ry);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Appends a circular arc to the path.
|
|
||||||
*
|
|
||||||
* The arc is treated as a new sub-path - it is not connected with the previous sub-path.
|
|
||||||
* The current point value is set to the end-point of the arc in case @p pie is @c false, and to the center of the arc otherwise.
|
|
||||||
*
|
|
||||||
* \param[in] paint A Tvg_Paint pointer to the shape object.
|
|
||||||
* \param[in] cx The horizontal coordinate of the center of the arc.
|
|
||||||
* \param[in] cy The vertical coordinate of the center of the arc.
|
|
||||||
* \param[in] radius The radius of the arc.
|
|
||||||
* \param[in] startAngle The start angle of the arc given in degrees, measured counter-clockwise from the horizontal line.
|
|
||||||
* \param[in] sweep The central angle of the arc given in degrees, measured counter-clockwise from @p startAngle.
|
|
||||||
* \param[in] pie Specifies whether to draw radii from the arc's center to both of its end-point - drawn if @c true.
|
|
||||||
*
|
|
||||||
* \return Tvg_Result enumeration.
|
|
||||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Paint pointer.
|
|
||||||
*
|
|
||||||
* \note Setting @p sweep value greater than 360 degrees, is equivalent to calling tvg_shape_append_circle(paint, cx, cy, radius, radius).
|
|
||||||
*/
|
|
||||||
TVG_DEPRECATED TVG_API Tvg_Result tvg_shape_append_arc(Tvg_Paint* paint, float cx, float cy, float radius, float startAngle, float sweep, uint8_t pie);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Appends a given sub-path to the path.
|
* \brief Appends a given sub-path to the path.
|
||||||
*
|
*
|
||||||
|
@ -1917,12 +1858,6 @@ TVG_API Tvg_Result tvg_gradient_get_transform(const Tvg_Gradient* grad, Tvg_Matr
|
||||||
TVG_API Tvg_Result tvg_gradient_get_type(const Tvg_Gradient* grad, Tvg_Type* type);
|
TVG_API Tvg_Result tvg_gradient_get_type(const Tvg_Gradient* grad, Tvg_Type* type);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \see tvg_gradient_get_type()
|
|
||||||
*/
|
|
||||||
TVG_DEPRECATED TVG_API Tvg_Result tvg_gradient_get_identifier(const Tvg_Gradient* grad, Tvg_Identifier* identifier);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Duplicates the given Tvg_Gradient object.
|
* \brief Duplicates the given Tvg_Gradient object.
|
||||||
*
|
*
|
||||||
|
@ -2103,22 +2038,6 @@ TVG_API const Tvg_Paint* tvg_picture_get_paint(Tvg_Paint* paint, uint32_t id);
|
||||||
TVG_API Tvg_Paint* tvg_scene_new(void);
|
TVG_API Tvg_Paint* tvg_scene_new(void);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Sets the size of the container, where all the paints pushed into the scene are stored.
|
|
||||||
*
|
|
||||||
* If the number of objects pushed into the scene is known in advance, calling the function
|
|
||||||
* prevents multiple memory reallocation, thus improving the performance.
|
|
||||||
*
|
|
||||||
* \param[in] scene A Tvg_Paint pointer to the scene object.
|
|
||||||
* \param[in] size The number of objects for which the memory is to be reserved.
|
|
||||||
*
|
|
||||||
* \return Tvg_Result enumeration.
|
|
||||||
* \retval TVG_RESULT_FAILED_ALLOCATION An internal error with a memory allocation.
|
|
||||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Paint pointer.
|
|
||||||
*/
|
|
||||||
TVG_DEPRECATED TVG_API Tvg_Result tvg_scene_reserve(Tvg_Paint* scene, uint32_t size);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Passes drawing elements to the scene using Tvg_Paint objects.
|
* \brief Passes drawing elements to the scene using Tvg_Paint objects.
|
||||||
*
|
*
|
||||||
|
|
|
@ -97,12 +97,6 @@ TVG_API Tvg_Result tvg_canvas_push(Tvg_Canvas* canvas, Tvg_Paint* paint)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TVG_API Tvg_Result tvg_canvas_reserve(Tvg_Canvas* canvas, uint32_t n)
|
|
||||||
{
|
|
||||||
return TVG_RESULT_NOT_SUPPORTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
TVG_API Tvg_Result tvg_canvas_clear(Tvg_Canvas* canvas, bool paints, bool buffer)
|
TVG_API Tvg_Result tvg_canvas_clear(Tvg_Canvas* canvas, bool paints, bool buffer)
|
||||||
{
|
{
|
||||||
if (!canvas) return TVG_RESULT_INVALID_ARGUMENT;
|
if (!canvas) return TVG_RESULT_INVALID_ARGUMENT;
|
||||||
|
@ -259,11 +253,6 @@ TVG_API Tvg_Result tvg_paint_set_clip(Tvg_Paint* paint, Tvg_Paint* clipper)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TVG_DEPRECATED TVG_API Tvg_Result tvg_paint_get_identifier(const Tvg_Paint* paint, Tvg_Identifier* identifier)
|
|
||||||
{
|
|
||||||
return tvg_paint_get_type(paint, (Tvg_Type*) identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* Shape API */
|
/* Shape API */
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -316,13 +305,6 @@ TVG_API Tvg_Result tvg_shape_append_rect(Tvg_Paint* paint, float x, float y, flo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TVG_DEPRECATED TVG_API Tvg_Result tvg_shape_append_arc(Tvg_Paint* paint, float cx, float cy, float radius, float startAngle, float sweep, uint8_t pie)
|
|
||||||
{
|
|
||||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
|
||||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->appendArc(cx, cy, radius, startAngle, sweep, pie);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
TVG_API Tvg_Result tvg_shape_append_circle(Tvg_Paint* paint, float cx, float cy, float rx, float ry)
|
TVG_API Tvg_Result tvg_shape_append_circle(Tvg_Paint* paint, float cx, float cy, float rx, float ry)
|
||||||
{
|
{
|
||||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||||
|
@ -692,11 +674,6 @@ TVG_API Tvg_Result tvg_gradient_get_type(const Tvg_Gradient* grad, Tvg_Type* typ
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TVG_DEPRECATED TVG_API Tvg_Result tvg_gradient_get_identifier(const Tvg_Gradient* grad, Tvg_Identifier* identifier)
|
|
||||||
{
|
|
||||||
return tvg_gradient_get_type(grad, (Tvg_Type*) identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* Scene API */
|
/* Scene API */
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -707,12 +684,6 @@ TVG_API Tvg_Paint* tvg_scene_new()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TVG_API Tvg_Result tvg_scene_reserve(Tvg_Paint* scene, uint32_t size)
|
|
||||||
{
|
|
||||||
return TVG_RESULT_NOT_SUPPORTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
TVG_API Tvg_Result tvg_scene_push(Tvg_Paint* scene, Tvg_Paint* paint)
|
TVG_API Tvg_Result tvg_scene_push(Tvg_Paint* scene, Tvg_Paint* paint)
|
||||||
{
|
{
|
||||||
if (!scene || !paint) return TVG_RESULT_INVALID_ARGUMENT;
|
if (!scene || !paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||||
|
|
|
@ -50,20 +50,6 @@ static bool accessChildren(Iterator* it, function<bool(const Paint* paint, void*
|
||||||
/* External Class Implementation */
|
/* External Class Implementation */
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
||||||
TVG_DEPRECATED unique_ptr<Picture> Accessor::set(unique_ptr<Picture> picture, function<bool(const Paint* paint)> func) noexcept
|
|
||||||
{
|
|
||||||
auto backward = [](const tvg::Paint* paint, void* data) -> bool
|
|
||||||
{
|
|
||||||
auto func = reinterpret_cast<function<bool(const Paint* paint)>*>(data);
|
|
||||||
if (!(*func)(paint)) return false;
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
set(picture.get(), backward, reinterpret_cast<void*>(&func));
|
|
||||||
return picture;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Result Accessor::set(const Picture* picture, function<bool(const Paint* paint, void* data)> func, void* data) noexcept
|
Result Accessor::set(const Picture* picture, function<bool(const Paint* paint, void* data)> func, void* data) noexcept
|
||||||
{
|
{
|
||||||
if (!picture || !func) return Result::InvalidArguments;
|
if (!picture || !func) return Result::InvalidArguments;
|
||||||
|
|
|
@ -155,12 +155,6 @@ Fill* Fill::duplicate() const noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TVG_DEPRECATED uint32_t Fill::identifier() const noexcept
|
|
||||||
{
|
|
||||||
return (uint32_t) type();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
RadialGradient::RadialGradient():pImpl(new Impl())
|
RadialGradient::RadialGradient():pImpl(new Impl())
|
||||||
{
|
{
|
||||||
Fill::pImpl->method(new FillDup<RadialGradient::Impl>(pImpl));
|
Fill::pImpl->method(new FillDup<RadialGradient::Impl>(pImpl));
|
||||||
|
@ -195,12 +189,6 @@ unique_ptr<RadialGradient> RadialGradient::gen() noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TVG_DEPRECATED uint32_t RadialGradient::identifier() noexcept
|
|
||||||
{
|
|
||||||
return (uint32_t) Type::RadialGradient;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Type RadialGradient::type() const noexcept
|
Type RadialGradient::type() const noexcept
|
||||||
{
|
{
|
||||||
return Type::RadialGradient;
|
return Type::RadialGradient;
|
||||||
|
@ -247,12 +235,6 @@ unique_ptr<LinearGradient> LinearGradient::gen() noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TVG_DEPRECATED uint32_t LinearGradient::identifier() noexcept
|
|
||||||
{
|
|
||||||
return (uint32_t) Type::LinearGradient;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Type LinearGradient::type() const noexcept
|
Type LinearGradient::type() const noexcept
|
||||||
{
|
{
|
||||||
return Type::LinearGradient;
|
return Type::LinearGradient;
|
||||||
|
|
|
@ -502,12 +502,6 @@ uint8_t Paint::opacity() const noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TVG_DEPRECATED uint32_t Paint::identifier() const noexcept
|
|
||||||
{
|
|
||||||
return (uint32_t) type();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Result Paint::blend(BlendMethod method) noexcept
|
Result Paint::blend(BlendMethod method) noexcept
|
||||||
{
|
{
|
||||||
//TODO: Remove later
|
//TODO: Remove later
|
||||||
|
|
|
@ -150,12 +150,6 @@ unique_ptr<Picture> Picture::gen() noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TVG_DEPRECATED uint32_t Picture::identifier() noexcept
|
|
||||||
{
|
|
||||||
return (uint32_t) Type::Picture;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Type Picture::type() const noexcept
|
Type Picture::type() const noexcept
|
||||||
{
|
{
|
||||||
return Type::Picture;
|
return Type::Picture;
|
||||||
|
|
|
@ -61,12 +61,6 @@ unique_ptr<Scene> Scene::gen() noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TVG_DEPRECATED uint32_t Scene::identifier() noexcept
|
|
||||||
{
|
|
||||||
return (uint32_t) Type::Scene;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Type Scene::type() const noexcept
|
Type Scene::type() const noexcept
|
||||||
{
|
{
|
||||||
return Type::Scene;
|
return Type::Scene;
|
||||||
|
|
|
@ -49,12 +49,6 @@ unique_ptr<Shape> Shape::gen() noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t Shape::identifier() noexcept
|
|
||||||
{
|
|
||||||
return (uint32_t) Type::Shape;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Type Shape::type() const noexcept
|
Type Shape::type() const noexcept
|
||||||
{
|
{
|
||||||
return Type::Shape;
|
return Type::Shape;
|
||||||
|
@ -156,68 +150,6 @@ Result Shape::appendCircle(float cx, float cy, float rx, float ry) noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TVG_DEPRECATED Result Shape::appendArc(float cx, float cy, float radius, float startAngle, float sweep, bool pie) noexcept
|
|
||||||
{
|
|
||||||
//just circle
|
|
||||||
if (sweep >= 360.0f || sweep <= -360.0f) return appendCircle(cx, cy, radius, radius);
|
|
||||||
|
|
||||||
const float arcPrecision = 1e-5f;
|
|
||||||
startAngle = deg2rad(startAngle);
|
|
||||||
sweep = deg2rad(sweep);
|
|
||||||
|
|
||||||
auto nCurves = static_cast<int>(fabsf(sweep / MATH_PI2));
|
|
||||||
if (fabsf(sweep / MATH_PI2) - nCurves > arcPrecision) ++nCurves;
|
|
||||||
auto sweepSign = (sweep < 0 ? -1 : 1);
|
|
||||||
auto fract = fmodf(sweep, MATH_PI2);
|
|
||||||
fract = (fabsf(fract) < arcPrecision) ? MATH_PI2 * sweepSign : fract;
|
|
||||||
|
|
||||||
//Start from here
|
|
||||||
Point start = {radius * cosf(startAngle), radius * sinf(startAngle)};
|
|
||||||
|
|
||||||
if (pie) {
|
|
||||||
pImpl->moveTo(cx, cy);
|
|
||||||
pImpl->lineTo(start.x + cx, start.y + cy);
|
|
||||||
} else {
|
|
||||||
pImpl->moveTo(start.x + cx, start.y + cy);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < nCurves; ++i) {
|
|
||||||
auto endAngle = startAngle + ((i != nCurves - 1) ? MATH_PI2 * sweepSign : fract);
|
|
||||||
Point end = {radius * cosf(endAngle), radius * sinf(endAngle)};
|
|
||||||
|
|
||||||
//variables needed to calculate bezier control points
|
|
||||||
|
|
||||||
//get bezier control points using article:
|
|
||||||
//(http://itc.ktu.lt/index.php/ITC/article/view/11812/6479)
|
|
||||||
auto ax = start.x;
|
|
||||||
auto ay = start.y;
|
|
||||||
auto bx = end.x;
|
|
||||||
auto by = end.y;
|
|
||||||
auto q1 = ax * ax + ay * ay;
|
|
||||||
auto q2 = ax * bx + ay * by + q1;
|
|
||||||
auto k2 = (4.0f/3.0f) * ((sqrtf(2 * q1 * q2) - q2) / (ax * by - ay * bx));
|
|
||||||
|
|
||||||
start = end; //Next start point is the current end point
|
|
||||||
|
|
||||||
end.x += cx;
|
|
||||||
end.y += cy;
|
|
||||||
|
|
||||||
Point ctrl1 = {ax - k2 * ay + cx, ay + k2 * ax + cy};
|
|
||||||
Point ctrl2 = {bx + k2 * by + cx, by - k2 * bx + cy};
|
|
||||||
|
|
||||||
pImpl->cubicTo(ctrl1.x, ctrl1.y, ctrl2.x, ctrl2.y, end.x, end.y);
|
|
||||||
|
|
||||||
startAngle = endAngle;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pie) pImpl->close();
|
|
||||||
|
|
||||||
pImpl->flag |= RenderUpdateFlag::Path;
|
|
||||||
|
|
||||||
return Result::Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Result Shape::appendRect(float x, float y, float w, float h, float rx, float ry) noexcept
|
Result Shape::appendRect(float x, float y, float w, float h, float rx, float ry) noexcept
|
||||||
{
|
{
|
||||||
auto halfW = w * 0.5f;
|
auto halfW = w * 0.5f;
|
||||||
|
|
Loading…
Add table
Reference in a new issue