Files
rive-cpp/include/rive/command_path.hpp
bodymovin 2653e773ef Editor + Runtime Feathers!
Adds feathering support to the runtime and editor.

A few important changes:
- Runtime now deals in RawPaths via ShapePaintPath. We no longer store a bunch of RenderPaths that we don't always end up using. Instead we use a light wrapper around RawPath (ShapePaintPath) to track intention of space (local, world, etc) and fill rule for the path so the runtime can pass that around and further mutate it or upgrade it to an immutable RenderPath only when it wants to actually draw it.
- Stroke effects like Dash and Trim now build on the update instead of render!

Diffs=
1b51fe394e Editor + Runtime Feathers! (#8891)

Co-authored-by: Alex Gibson <agibson.uk@gmail.com>
Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
Co-authored-by: Luigi Rosso <luigi.rosso@gmail.com>
Co-authored-by: hernan <hernan@rive.app>
2025-01-24 01:20:32 +00:00

54 lines
1.4 KiB
C++

#ifndef _RIVE_COMMAND_PATH_HPP_
#define _RIVE_COMMAND_PATH_HPP_
#include "rive/math/mat2d.hpp"
#include "rive/math/path_types.hpp"
#include "rive/refcnt.hpp"
namespace rive
{
class RenderPath;
/// Abstract path used to build up commands used for rendering.
class CommandPath : public RefCnt<CommandPath>
{
public:
virtual ~CommandPath() {}
virtual void rewind() = 0;
virtual void fillRule(FillRule value) = 0;
virtual void addPath(CommandPath* path, const Mat2D& transform) = 0;
virtual void moveTo(float x, float y) = 0;
virtual void lineTo(float x, float y) = 0;
virtual void cubicTo(float ox,
float oy,
float ix,
float iy,
float x,
float y) = 0;
virtual void close() = 0;
virtual RenderPath* renderPath() = 0;
virtual const RenderPath* renderPath() const = 0;
// non-virtual helpers
void addRect(float x, float y, float width, float height)
{
moveTo(x, y);
lineTo(x + width, y);
lineTo(x + width, y + height);
lineTo(x, y + height);
close();
}
void move(Vec2D v) { this->moveTo(v.x, v.y); }
void line(Vec2D v) { this->lineTo(v.x, v.y); }
void cubic(Vec2D a, Vec2D b, Vec2D c)
{
this->cubicTo(a.x, a.y, b.x, b.y, c.x, c.y);
}
};
} // namespace rive
#endif