diff options
Diffstat (limited to 'src/utilities/color.vala')
-rw-r--r-- | src/utilities/color.vala | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/src/utilities/color.vala b/src/utilities/color.vala index bf60e3f..6bb9d06 100644 --- a/src/utilities/color.vala +++ b/src/utilities/color.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see <http://www.gnu.org/licenses/>. -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +///////////////////////////////////////////////////////////////////////// using GLib.Math; @@ -258,10 +258,10 @@ public class Color: GLib.Object { private void setHSV(float hue, float saturation, float val) { if(saturation == 0) { - r = val; - g = val; - b = val; - return; + r = val; + g = val; + b = val; + return; } hue = fmodf(hue, 360); hue /= 60; @@ -269,36 +269,36 @@ public class Color: GLib.Object { float f = hue - i; switch(i) { - case 0: - r = val; - g = val * (1.0f - saturation * (1.0f - f)); - b = val * (1.0f - saturation); - break; - case 1: - r = val * (1.0f - saturation * f); - g = val; - b = val * (1.0f - saturation); - break; - case 2: - r = val * (1.0f - saturation); - g = val; - b = val * (1.0f - saturation * (1.0f - f)); - break; - case 3: - r = val * (1.0f - saturation); - g = val * (1.0f - saturation * f); - b = val; - break; - case 4: - r = val * (1.0f - saturation * (1.0f - f)); - g = val * (1.0f - saturation); - b = val; - break; - default: - r = val; - g = val * (1.0f - saturation); - b = val * (1.0f - saturation * f); - break; + case 0: + r = val; + g = val * (1.0f - saturation * (1.0f - f)); + b = val * (1.0f - saturation); + break; + case 1: + r = val * (1.0f - saturation * f); + g = val; + b = val * (1.0f - saturation); + break; + case 2: + r = val * (1.0f - saturation); + g = val; + b = val * (1.0f - saturation * (1.0f - f)); + break; + case 3: + r = val * (1.0f - saturation); + g = val * (1.0f - saturation * f); + b = val; + break; + case 4: + r = val * (1.0f - saturation * (1.0f - f)); + g = val * (1.0f - saturation); + b = val; + break; + default: + r = val; + g = val * (1.0f - saturation); + b = val * (1.0f - saturation * f); + break; } } } |