Mercurial > hg > orthanc-stone
comparison Framework/Scene2D/ColorSceneLayer.h @ 860:238693c3bc51 am-dev
merge default -> am-dev
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Mon, 24 Jun 2019 14:35:00 +0200 |
parents | 61ba4b504e9a |
children | 2d8ab34c8c91 |
comparison
equal
deleted
inserted
replaced
856:a6e17a5a39e7 | 860:238693c3bc51 |
---|---|
20 | 20 |
21 | 21 |
22 #pragma once | 22 #pragma once |
23 | 23 |
24 #include "ISceneLayer.h" | 24 #include "ISceneLayer.h" |
25 #include <Core/Enumerations.h> | 25 #include "Color.h" |
26 | 26 |
27 #include <stdint.h> | 27 #include <Core/Enumerations.h> // For ORTHANC_OVERRIDE |
28 | 28 |
29 namespace OrthancStone | 29 namespace OrthancStone |
30 { | 30 { |
31 // TODO - Is this needed? | |
31 class ColorSceneLayer : public ISceneLayer | 32 class ColorSceneLayer : public ISceneLayer |
32 { | 33 { |
33 private: | 34 private: |
34 uint8_t red_; | 35 Color color_; |
35 uint8_t green_; | |
36 uint8_t blue_; | |
37 uint64_t revision_; | 36 uint64_t revision_; |
38 | 37 |
39 protected: | 38 protected: |
40 void BumpRevision() | 39 void BumpRevision() |
41 { | 40 { |
43 revision_++; | 42 revision_++; |
44 } | 43 } |
45 | 44 |
46 public: | 45 public: |
47 ColorSceneLayer() : | 46 ColorSceneLayer() : |
48 red_(255), | |
49 green_(255), | |
50 blue_(255), | |
51 revision_(0) | 47 revision_(0) |
52 { | 48 { |
53 } | 49 } |
54 | 50 |
55 virtual uint64_t GetRevision() const ORTHANC_OVERRIDE | 51 virtual uint64_t GetRevision() const ORTHANC_OVERRIDE |
59 | 55 |
60 void SetColor(uint8_t red, | 56 void SetColor(uint8_t red, |
61 uint8_t green, | 57 uint8_t green, |
62 uint8_t blue) | 58 uint8_t blue) |
63 { | 59 { |
64 red_ = red; | 60 color_ = Color(red, green, blue); |
65 green_ = green; | |
66 blue_ = blue; | |
67 BumpRevision(); | 61 BumpRevision(); |
68 } | 62 } |
69 | 63 |
70 uint8_t GetRed() const | 64 void SetColor(const Color& color) |
71 { | 65 { |
72 return red_; | 66 color_ = color; |
67 BumpRevision(); | |
73 } | 68 } |
74 | 69 |
75 uint8_t GetGreen() const | 70 const Color& GetColor() const |
76 { | 71 { |
77 return green_; | 72 return color_; |
78 } | |
79 | |
80 uint8_t GetBlue() const | |
81 { | |
82 return blue_; | |
83 } | |
84 | |
85 float GetRedAsFloat() const | |
86 { | |
87 return static_cast<float>(red_) / 255.0f; | |
88 } | |
89 | |
90 float GetGreenAsFloat() const | |
91 { | |
92 return static_cast<float>(green_) / 255.0f; | |
93 } | |
94 | |
95 float GetBlueAsFloat() const | |
96 { | |
97 return static_cast<float>(blue_) / 255.0f; | |
98 } | 73 } |
99 }; | 74 }; |
100 } | 75 } |