1 #ifndef _RIVE_PARAMETRIC_PATH_BASE_HPP_
2 #define _RIVE_PARAMETRIC_PATH_BASE_HPP_
3 #include "core/field_types/core_double_type.hpp"
4 #include "shapes/path.hpp"
7 class ParametricPathBase : public Path
13 static const int typeKey = 15;
15 /// Helper to quickly determine if a core object extends another without
17 bool isTypeOf(int typeKey) const override
21 case ParametricPathBase::typeKey:
22 case PathBase::typeKey:
23 case NodeBase::typeKey:
24 case TransformComponentBase::typeKey:
25 case ContainerComponentBase::typeKey:
26 case ComponentBase::typeKey:
33 int coreType() const override { return typeKey; }
35 static const int widthPropertyKey = 20;
36 static const int heightPropertyKey = 21;
37 static const int originXPropertyKey = 123;
38 static const int originYPropertyKey = 124;
43 float m_OriginX = 0.5;
44 float m_OriginY = 0.5;
46 inline float width() const { return m_Width; }
47 void width(float value)
57 inline float height() const { return m_Height; }
58 void height(float value)
60 if (m_Height == value)
68 inline float originX() const { return m_OriginX; }
69 void originX(float value)
71 if (m_OriginX == value)
79 inline float originY() const { return m_OriginY; }
80 void originY(float value)
82 if (m_OriginY == value)
90 bool deserialize(int propertyKey, BinaryReader& reader) override
94 case widthPropertyKey:
95 m_Width = CoreDoubleType::deserialize(reader);
97 case heightPropertyKey:
98 m_Height = CoreDoubleType::deserialize(reader);
100 case originXPropertyKey:
101 m_OriginX = CoreDoubleType::deserialize(reader);
103 case originYPropertyKey:
104 m_OriginY = CoreDoubleType::deserialize(reader);
107 return Path::deserialize(propertyKey, reader);
111 virtual void widthChanged() {}
112 virtual void heightChanged() {}
113 virtual void originXChanged() {}
114 virtual void originYChanged() {}