1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-10 10:35:46 +01:00

changed indentation to use spaces only

This commit is contained in:
dan
2004-10-12 21:28:27 +00:00
parent 5912898b06
commit 6830b05716
240 changed files with 35951 additions and 35773 deletions

View File

@@ -1,19 +1,19 @@
/* color.c - color stuff (rgb -> hsv convertion etc.)
*
*
* Raster graphics library
*
*
* Copyright (c) 1998-2003 Alfredo K. Kojima
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
*
* This library 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
* Library General Public License for more details.
*
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -50,8 +50,8 @@ RHSVtoRGB(RHSVColor *hsv, RColor *rgb)
int p, q, t;
if (s == 0) {
rgb->red = rgb->green = rgb->blue = v;
return;
rgb->red = rgb->green = rgb->blue = v;
return;
}
i = h / 60;
f = h % 60;
@@ -60,36 +60,36 @@ RHSVtoRGB(RHSVColor *hsv, RColor *rgb)
t = v * (255 - s * (60 - f) / 60) / 255;
switch (i) {
case 0:
rgb->red = v;
rgb->green = t;
rgb->blue = p;
break;
case 1:
rgb->red = q;
rgb->green = v;
rgb->blue = p;
break;
case 2:
rgb->red = p;
rgb->green = v;
rgb->blue = t;
break;
case 3:
rgb->red = p;
rgb->green = q;
rgb->blue = v;
break;
case 4:
rgb->red = t;
rgb->green = p;
rgb->blue = v;
break;
case 5:
rgb->red = v;
rgb->green = p;
rgb->blue = q;
break;
case 0:
rgb->red = v;
rgb->green = t;
rgb->blue = p;
break;
case 1:
rgb->red = q;
rgb->green = v;
rgb->blue = p;
break;
case 2:
rgb->red = p;
rgb->green = v;
rgb->blue = t;
break;
case 3:
rgb->red = p;
rgb->green = q;
rgb->blue = v;
break;
case 4:
rgb->red = t;
rgb->green = p;
rgb->blue = v;
break;
case 5:
rgb->red = v;
rgb->green = p;
rgb->blue = q;
break;
}
}
@@ -104,31 +104,32 @@ RRGBtoHSV(RColor *rgb, RHSVColor *hsv)
v = max;
if (max == 0)
s = 0;
s = 0;
else
s = (max - min) * 255 / max;
s = (max - min) * 255 / max;
if (s == 0)
h = 0;
h = 0;
else {
int rc, gc, bc;
int rc, gc, bc;
rc = (max - rgb->red) * 255 / (max - min);
gc = (max - rgb->green) * 255 / (max - min);
bc = (max - rgb->blue) * 255 / (max - min);
rc = (max - rgb->red) * 255 / (max - min);
gc = (max - rgb->green) * 255 / (max - min);
bc = (max - rgb->blue) * 255 / (max - min);
if (rgb->red == max) {
h = ((bc - gc) * 60 / 255);
} else if (rgb->green == max) {
h = 2*60 + ((rc - bc) * 60 / 255);
} else {
h = 4*60 + ((gc - rc) * 60 / 255);
}
if (h < 0)
h += 360;
if (rgb->red == max) {
h = ((bc - gc) * 60 / 255);
} else if (rgb->green == max) {
h = 2*60 + ((rc - bc) * 60 / 255);
} else {
h = 4*60 + ((gc - rc) * 60 / 255);
}
if (h < 0)
h += 360;
}
hsv->hue = h;
hsv->saturation = s;
hsv->value = v;
}