1 #ifndef _RIVE_TRIM_PATH_BASE_HPP_
2 #define _RIVE_TRIM_PATH_BASE_HPP_
3 #include "component.hpp"
4 #include "core/field_types/core_double_type.hpp"
5 #include "core/field_types/core_uint_type.hpp"
8 class TrimPathBase : public Component
11 typedef Component Super;
14 static const uint16_t typeKey = 47;
16 /// Helper to quickly determine if a core object extends another without
18 bool isTypeOf(uint16_t typeKey) const override
22 case TrimPathBase::typeKey:
23 case ComponentBase::typeKey:
30 uint16_t coreType() const override { return typeKey; }
32 static const uint16_t startPropertyKey = 114;
33 static const uint16_t endPropertyKey = 115;
34 static const uint16_t offsetPropertyKey = 116;
35 static const uint16_t modeValuePropertyKey = 117;
40 float m_Offset = 0.0f;
43 inline float start() const { return m_Start; }
44 void start(float value)
54 inline float end() const { return m_End; }
65 inline float offset() const { return m_Offset; }
66 void offset(float value)
68 if (m_Offset == value)
76 inline int modeValue() const { return m_ModeValue; }
77 void modeValue(int value)
79 if (m_ModeValue == value)
87 Core* clone() const override;
88 void copy(const TrimPathBase& object)
90 m_Start = object.m_Start;
92 m_Offset = object.m_Offset;
93 m_ModeValue = object.m_ModeValue;
94 Component::copy(object);
97 bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
101 case startPropertyKey:
102 m_Start = CoreDoubleType::deserialize(reader);
105 m_End = CoreDoubleType::deserialize(reader);
107 case offsetPropertyKey:
108 m_Offset = CoreDoubleType::deserialize(reader);
110 case modeValuePropertyKey:
111 m_ModeValue = CoreUintType::deserialize(reader);
114 return Component::deserialize(propertyKey, reader);
118 virtual void startChanged() {}
119 virtual void endChanged() {}
120 virtual void offsetChanged() {}
121 virtual void modeValueChanged() {}