mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
common Accessor: removed deprecated api.
the old version of Accessor::access() is redundant, we replaced it with set(). It's still under the beta, we can remove it immediately. Note that we've planned to promote them official APIs in v0.9. Newly changed, tagging beta again...w
This commit is contained in:
parent
4ceb91ccea
commit
dc477e197b
2 changed files with 4 additions and 32 deletions
16
inc/thorvg.h
16
inc/thorvg.h
|
@ -1597,24 +1597,14 @@ public:
|
||||||
* The Accessor helps you search specific nodes to read the property information, figure out the structure of the scene tree and its size.
|
* The Accessor helps you search specific nodes to read the property information, figure out the structure of the scene tree and its size.
|
||||||
*
|
*
|
||||||
* @warning We strongly warn you not to change the paints of a scene unless you really know the design-structure.
|
* @warning We strongly warn you not to change the paints of a scene unless you really know the design-structure.
|
||||||
|
*
|
||||||
|
* @BETA_API
|
||||||
*/
|
*/
|
||||||
class TVG_EXPORT Accessor final
|
class TVG_EXPORT Accessor final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~Accessor();
|
~Accessor();
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Access the Picture scene tree nodes.
|
|
||||||
*
|
|
||||||
* @param[in] picture The picture node to traverse the internal scene-tree.
|
|
||||||
* @param[in] func The callback function calling for every paint nodes of the Picture.
|
|
||||||
*
|
|
||||||
* @return Return the given @p picture instance.
|
|
||||||
*
|
|
||||||
* @note The bitmap based picture might not have the scene-tree.
|
|
||||||
*/
|
|
||||||
std::unique_ptr<Picture> access(std::unique_ptr<Picture> picture, bool(*func)(const Paint* paint)) 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.
|
||||||
*
|
*
|
||||||
|
@ -1633,6 +1623,8 @@ public:
|
||||||
* @brief Creates a new Accessor object.
|
* @brief Creates a new Accessor object.
|
||||||
*
|
*
|
||||||
* @return A new Accessor object.
|
* @return A new Accessor object.
|
||||||
|
*
|
||||||
|
* @BETA_API
|
||||||
*/
|
*/
|
||||||
static std::unique_ptr<Accessor> gen() noexcept;
|
static std::unique_ptr<Accessor> gen() noexcept;
|
||||||
|
|
||||||
|
|
|
@ -45,26 +45,6 @@ static bool accessChildren(Iterator* it, IteratorAccessor& itrAccessor, function
|
||||||
/* External Class Implementation */
|
/* External Class Implementation */
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
||||||
unique_ptr<Picture> Accessor::access(unique_ptr<Picture> picture, bool(*func)(const Paint* paint)) noexcept
|
|
||||||
{
|
|
||||||
auto p = picture.get();
|
|
||||||
if (!p || !func) return picture;
|
|
||||||
|
|
||||||
//Use the Preorder Tree-Search
|
|
||||||
|
|
||||||
//Root
|
|
||||||
if (!func(p)) return picture;
|
|
||||||
|
|
||||||
//Children
|
|
||||||
IteratorAccessor itrAccessor;
|
|
||||||
if (auto it = itrAccessor.iterator(p)) {
|
|
||||||
accessChildren(it, itrAccessor, func);
|
|
||||||
delete(it);
|
|
||||||
}
|
|
||||||
return picture;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
unique_ptr<Picture> Accessor::set(unique_ptr<Picture> picture, function<bool(const Paint* paint)> func) noexcept
|
unique_ptr<Picture> Accessor::set(unique_ptr<Picture> picture, function<bool(const Paint* paint)> func) noexcept
|
||||||
{
|
{
|
||||||
auto p = picture.get();
|
auto p = picture.get();
|
||||||
|
|
Loading…
Add table
Reference in a new issue