/*-
* HSBmap.c - Create an HSB ramp.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Author: Patrick J. Naughton
* naughton@sun.com
*/
#include <math.h>
#include "xcolor.h"
static void
double H,
double S,
double B,
u_char *r,
u_char *g,
u_char *b)
{
register int i;
register double f,
bb;
register u_char p,
q,
t;
H -= floor(H); /* remove anything over 1 */
H *= 6.0;
i = floor(H); /* 0..5 */
f = H - (float) i; /* f = fractional part of H */
bb = 255.0 * B;
switch (i) {
case 0:
*g = t;
*b = p;
break;
case 1:
*r = q;
*b = p;
break;
case 2:
*r = p;
*b = t;
break;
case 3:
*r = p;
*g = q;
break;
case 4:
*r = t;
*g = p;
break;
case 5:
*g = p;
*b = q;
break;
}
}
void
double h1,
double s1,
double b1,
double h2,
double s2,
double b2,
int start,
int end,
{
double dh,
ds,
db;
register u_char *r,
*g,
*b;
register int i;
r = red;
g = green;
b = blue;
}
}