OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
GradientPainter2D.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8#include "OTCore/Point2D.h"
10#include "OTGui/GuiTypes.h"
11#include "OTGui/Painter2D.h"
13
14namespace ot {
15
18 public:
20 GradientPainter2D(const std::vector<GradientPainterStop2D>& _stops);
21 virtual ~GradientPainter2D();
22
26 virtual void addToJsonObject(JsonValue& _object, JsonAllocator& _allocator) const override;
27
31 virtual void setFromJsonObject(const ConstJsonObject& _object) override;
32
33 virtual ot::Color getDefaultColor(void) const override;
34
35 virtual bool isEqualTo(const Painter2D* _other) const override;
36
37 inline void addStop(double _pos, const ot::Color& _color) { this->addStop(GradientPainterStop2D(_pos, _color)); };
38 void addStop(const GradientPainterStop2D& _stop);
39 void addStops(const std::vector<GradientPainterStop2D>& _stops);
40 void setStops(const std::vector<GradientPainterStop2D>& _stops) { m_stops = _stops; };
41 const std::vector<GradientPainterStop2D>& getStops(void) const { return m_stops; };
42
43 void setSpread(GradientSpread _spread) { m_spread = _spread; };
44 GradientSpread getSpread(void) const { return m_spread; };
45
46 protected:
47 void addStopsAndSpreadToQss(std::string& _targetString) const;
48
49 private:
50 std::vector<GradientPainterStop2D> m_stops;
51 GradientSpread m_spread;
52 };
53
54}
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
The Color class is used to represent RGBA colors with integer values.
Definition Color.h:72
Definition GradientPainter2D.h:16
GradientSpread getSpread(void) const
Definition GradientPainter2D.h:44
void addStop(double _pos, const ot::Color &_color)
Definition GradientPainter2D.h:37
void setStops(const std::vector< GradientPainterStop2D > &_stops)
Definition GradientPainter2D.h:40
const std::vector< GradientPainterStop2D > & getStops(void) const
Definition GradientPainter2D.h:41
void setSpread(GradientSpread _spread)
Definition GradientPainter2D.h:43
Definition GradientPainterStop2D.h:15
Definition Painter2D.h:17
Definition Connector.h:8
GradientSpread
Describes how the painter will behave when painting outsite the gradient area.
Definition GuiTypes.h:76
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