Logo
Color.h
1#pragma once
2#include "gfx/Color.h"
3
4namespace SharpKmyGfx{
5 public value class Color
6 {
7 public:
8 float r, g, b, a;
9
10 Color(float _r, float _g, float _b, float _a)
11 {
12 r = _r;
13 g = _g;
14 b = _b;
15 a = _a;
16 }
17
18 Color(Color c, float _a)
19 {
20 r = c.r;
21 g = c.g;
22 b = c.b;
23 a = a;
24 }
25
26 Color(byte _r, byte _g, byte _b)
27 {
28 r = _r / 255.f;
29 g = _g / 255.f;
30 b = _b / 255.f;
31 a = 1.f;
32 }
33
34 kmyGfx::Color toNativeColor()
35 {
36 return kmyGfx::Color(r, g, b, a);
37 }
38
39 static property Color White{
40 Color get()
41 {
42 return Color(1, 1, 1, 1);
43 }
44 }
45
46 static Color fromByte(byte _r, byte _g, byte _b, byte _a)
47 {
48 return Color(_r / 255.0f, _g / 255.0f, _b / 255.0f, _a / 255.0f);
49 }
50
51 static property Color Gray{
52 Color get()
53 {
54 return Color(0.5f,0.5f,0.5f, 1);
55 }
56 }
57
58 static property Color Red{
59 Color get()
60 {
61 return Color(1, 0, 0, 1);
62 }
63 }
64 };
65}
Definition: Color.h:6
float r
Definition: Color.h:8
float b
Definition: Color.h:8
kmyGfx::Color toNativeColor()
Definition: Color.h:34
Color(byte _r, byte _g, byte _b)
Definition: Color.h:26
Color(Color c, float _a)
Definition: Color.h:18
float a
Definition: Color.h:8
Color(float _r, float _g, float _b, float _a)
Definition: Color.h:10
float g
Definition: Color.h:8
Definition: Asset.h:4