blob: 661adb769254cb6f7482aadb127c0a404d0e9547 [file] [log] [blame]
#include "rive/generated/shapes/paint/shape_paint_base.hpp"
#include "rive/renderer.hpp"
#include "rive/shapes/paint/blend_mode.hpp"
#include "rive/shapes/paint/shape_paint_mutator.hpp"
#include "rive/shapes/path_space.hpp"
namespace rive {
class RenderPaint;
class ShapePaintMutator;
class ShapePaint : public ShapePaintBase {
std::unique_ptr<RenderPaint> m_RenderPaint;
ShapePaintMutator* m_PaintMutator = nullptr;
StatusCode onAddedClean(CoreContext* context) override;
float renderOpacity() const { return m_PaintMutator->renderOpacity(); }
void renderOpacity(float value) { m_PaintMutator->renderOpacity(value); }
void blendMode(BlendMode value);
/// Creates a RenderPaint object for the provided ShapePaintMutator*.
/// This should be called only once as the ShapePaint manages the
/// lifecycle of the RenderPaint.
virtual RenderPaint* initRenderPaint(ShapePaintMutator* mutator);
virtual PathSpace pathSpace() const = 0;
virtual void draw(Renderer* renderer, CommandPath* path) = 0;
RenderPaint* renderPaint() { return m_RenderPaint.get(); }
/// Get the component that represents the ShapePaintMutator for this
/// ShapePaint. It'll be one of SolidColor, LinearGradient, or
/// RadialGradient.
Component* paint() const { return m_PaintMutator->component(); }
bool isTranslucent() const { return !this->isVisible() || m_PaintMutator->isTranslucent(); }
} // namespace rive