diff options
| author | Kelly Thomas | 2018-05-17 21:41:19 +0800 |
|---|---|---|
| committer | Hein-Pieter van Braam | 2018-06-01 17:45:49 +0200 |
| commit | 0febfa9eea37909f5a16c246a6f0b4d508c14176 (patch) | |
| tree | cb796f030aa070397fd08c04b6ecc72d5d864b35 /modules | |
| parent | 232a3a524b3ec77cbe3e373b5565789d61df41b8 (diff) | |
| download | godot-0febfa9eea37909f5a16c246a6f0b4d508c14176.tar.gz godot-0febfa9eea37909f5a16c246a6f0b4d508c14176.tar.zst godot-0febfa9eea37909f5a16c246a6f0b4d508c14176.zip | |
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/mono/glue/cs_files/Color.cs | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/modules/mono/glue/cs_files/Color.cs b/modules/mono/glue/cs_files/Color.cs index af94bb616..e0d6d2784 100644 --- a/modules/mono/glue/cs_files/Color.cs +++ b/modules/mono/glue/cs_files/Color.cs @@ -249,6 +249,15 @@ namespace Godot ); } + public Color Darkened(float amount) + { + Color res = this; + res.r = res.r * (1.0f - amount); + res.g = res.g * (1.0f - amount); + res.b = res.b * (1.0f - amount); + return res; + } + public float Gray() { return (r + g + b) / 3.0f; @@ -263,6 +272,15 @@ namespace Godot ); } + public Color Lightened(float amount) + { + Color res = this; + res.r = res.r + (1.0f - res.r) * amount; + res.g = res.g + (1.0f - res.g) * amount; + res.b = res.b + (1.0f - res.b) * amount; + return res; + } + public Color LinearInterpolate(Color c, float t) { var res = this; @@ -275,15 +293,15 @@ namespace Godot return res; } - public int To32() + public int ToRgba32() { - int c = (byte)(a * 255); - c <<= 8; - c |= (byte)(r * 255); + int c = (byte)(r * 255); c <<= 8; c |= (byte)(g * 255); c <<= 8; c |= (byte)(b * 255); + c <<= 8; + c |= (byte)(a * 255); return c; } |
