blob: 1699e71b5e74796279cef3a66266f366630d4975 [file] [log] [blame]
#ifndef _RIVE_DRAWABLE_HPP_
#define _RIVE_DRAWABLE_HPP_
#include "rive/generated/drawable_base.hpp"
#include "rive/hit_info.hpp"
#include "rive/renderer.hpp"
#include <vector>
namespace rive {
class ClippingShape;
class Artboard;
class DrawRules;
class Drawable : public DrawableBase {
friend class Artboard;
private:
std::vector<ClippingShape*> m_ClippingShapes;
/// Used exclusively by the artboard;
DrawRules* flattenedDrawRules = nullptr;
Drawable* prev = nullptr;
Drawable* next = nullptr;
public:
BlendMode blendMode() const { return (BlendMode)blendModeValue(); }
bool clip(Renderer* renderer) const;
virtual void draw(Renderer* renderer) = 0;
virtual Core* hitTest(HitInfo*, const Mat2D&) = 0;
void addClippingShape(ClippingShape* shape);
inline const std::vector<ClippingShape*>& clippingShapes() const { return m_ClippingShapes; }
inline bool isHidden() const {
// For now we have a single drawable flag, when we have more we can
// make an actual enum for this.
return (drawableFlags() & 0x1) == 0x1;
}
};
} // namespace rive
#endif