* 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.
+ *
+ * @BETA_API
*/
class TVG_EXPORT Accessor final
{
public:
~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 Creates a new Accessor object.
*
* @return A new Accessor object.
+ *
+ * @BETA_API
*/
static std::unique_ptr<Accessor> gen() noexcept;
/* 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
{
auto p = picture.get();