10 #include <gvarprop.hpp>
17 GRgba() : red{}, green{}, blue{}, alpha{1.f} {}
18 GRgba(
float red,
float green,
float blue,
float alpha = 1.f);
19 GRgba(GString
const& colorname);
21 void set(
float red,
float green,
float blue,
float alpha = 1.f);
22 bool set(GString
const& colorname);
27 GString stringValue()
const;
29 bool operator==(
const GRgba&)
const;
30 bool operator!=(
const GRgba&)
const;
32 friend std::ostream& operator<<(std::ostream& out,
const GRgba&);
33 friend std::istream& operator>>(std::istream& in,
GRgba&);
35 float red, green, blue, alpha;
38 inline bool gconvert(
const GRgba& from,
GRgba& to) {to = from;
return true;}
39 bool gconvert(GString
const& from, GRgba& to);
40 bool gconvert(GRgba
const& from, GString& to);
51 static GColor none, white, black, gray, lightgray, dimgray,
52 red, green, blue, lightblue, guitblue, cyan, magenta, yellow, orange;
58 GColor(
float red,
float green,
float blue,
float alpha = 1.f);
85 void set(
float red,
float green,
float blue,
float alpha = 1.0f);
88 void blend(
const GProp& a,
const GProp& b,
float mix)
override;
95 float redValue()
const {
return value_.red;}
96 float blueValue()
const {
return value_.blue;}
97 float greenValue()
const {
return value_.green;}
98 float alphavalue()
const {
return value_.alpha;}
108 using Field = GNumPropField<GColor,float>;
115 Field greenField() {
return Field(*
this, value_.green);}
116 Field blueField() {
return Field(*
this, value_.blue);}
117 Field alphaField() {
return Field(*
this, value_.alpha);}
120 using GType = GPropType_<GColor,GProp>;
121 static GType& Type();
122 GType& type()
const override {
return Type();}
126 bool isValid(GRgba
const&)
const override;
127 bool doChange(GRgba
const&)
override;
128 void apply(Gadget*, GRender&,
Specif)
override;
129 void updateGadget(Gadget&)
override;
135 inline GColor& Color() {
return *
new GColor();}
136 inline GColor& Color(
float r,
float g,
float b,
float a = 1.f) {
return *
new GColor(r,g,b,a);}
137 inline GColor& Color(GString
const& value) {
return *
new GColor(value);}
141 using BackgroundAttr = GRgba;
150 red, green, blue, lightblue, guitblue, cyan, magenta, yellow, orange;
153 GBackground(
float red,
float green,
float blue,
float alpha = 1.f);
166 static GType& Type();
167 GType& type()
const override {
return Type();}
174 inline GBackground& Background() {
return *
new GBackground();}
175 inline GBackground& Background(
float r,
float g,
float b,
float a = 1.f) {
return *
new GBackground(r,g,b,a);}
176 inline GBackground& Background(GString
const& value) {
return *
new GBackground(value);}