OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
LinearGradientPainter2D.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
9#include "OTCore/Color.h"
10#include "OTCore/Point2D.h"
12#include "OTGui/GuiTypes.h"
15
16#define OT_FactoryKey_LinearGradientPainter2D "OT_P2DLGrad"
17
18namespace ot {
19
22 public:
24 LinearGradientPainter2D(const std::vector<GradientPainterStop2D>& _stops);
26
30 virtual void addToJsonObject(JsonValue& _object, JsonAllocator& _allocator) const override;
31
35 virtual void setFromJsonObject(const ConstJsonObject& _object) override;
36
38 virtual std::string getFactoryKey(void) const override { return std::string(OT_FactoryKey_LinearGradientPainter2D); };
39
40 virtual std::string generateQss(void) const override;
41
42 virtual bool isEqualTo(const Painter2D* _other) const override;
43
46 void setStart(const ot::Point2DD& _start) { m_start = _start; };
47 const ot::Point2DD& getStart(void) const { return m_start; }
48
51 void setFinalStop(const ot::Point2DD& _finalStop) { m_finalStop = _finalStop; };
52 const ot::Point2DD& getFinalStop(void) const { return m_finalStop; };
53
54 private:
55 ot::Point2DD m_start;
56 ot::Point2DD m_finalStop;
57 };
58
59}
#define OT_FactoryKey_LinearGradientPainter2D
Definition LinearGradientPainter2D.h:16
This file contains defines that may be used simplyfy class creation.
#define OT_DECL_NOCOPY(___class)
Removes the default copy constructor and assignment operator.
Definition OTClassHelper.h:14
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
Definition GradientPainter2D.h:16
Definition LinearGradientPainter2D.h:20
const ot::Point2DD & getFinalStop(void) const
Definition LinearGradientPainter2D.h:52
virtual std::string getFactoryKey(void) const override
Returns the key that is used to create an instance of this class in the simple factory.
Definition LinearGradientPainter2D.h:38
void setFinalStop(const ot::Point2DD &_finalStop)
Set the final stop point for the gradient. The painted area is between 0.0 and 1.0.
Definition LinearGradientPainter2D.h:51
const ot::Point2DD & getStart(void) const
Definition LinearGradientPainter2D.h:47
void setStart(const ot::Point2DD &_start)
Set the starting point for the gradient. The painted area is between 0.0 and 1.0.
Definition LinearGradientPainter2D.h:46
Definition Painter2D.h:17
2D Point with double values
Definition Point2D.h:144
Definition Connector.h:8
rapidjson::Value JsonValue
Writable JSON value.
Definition JSON.h:27
rapidjson::GenericObject< true, rapidjson::GenericValue< rapidjson::UTF8<>, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > > > ConstJsonObject
Read only JSON Object.
Definition JSON.h:35
rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > JsonAllocator
Allocator used for writing to JSON values.
Definition JSON.h:30