changeset 1131 | 7dc974a70bc8 |
parent 943 | 294f64612d23 |
1130:e9cbce844ef6 | 1131:7dc974a70bc8 |
---|---|
1 /*- |
1 /*- |
2 * HSBmap.c - Create an HSB ramp. |
2 * HSBmap.c - Create an HSB ramp. |
3 * |
3 * |
4 * Copyright (c) 1991, 1995, Oracle and/or its affiliates. All rights reserved. |
4 * Copyright (c) 1991, 2011, Oracle and/or its affiliates. All rights reserved. |
5 * |
5 * |
6 * Permission is hereby granted, free of charge, to any person obtaining a |
6 * Permission is hereby granted, free of charge, to any person obtaining a |
7 * copy of this software and associated documentation files (the "Software"), |
7 * copy of this software and associated documentation files (the "Software"), |
8 * to deal in the Software without restriction, including without limitation |
8 * to deal in the Software without restriction, including without limitation |
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
27 */ |
27 */ |
28 |
28 |
29 |
29 |
30 #include <sys/types.h> |
30 #include <sys/types.h> |
31 #include <math.h> |
31 #include <math.h> |
32 #include "xcolor.h" |
|
32 |
33 |
33 void |
34 static void |
34 hsb2rgb(H, S, B, r, g, b) |
35 hsb2rgb( |
35 double H, |
36 double H, |
36 S, |
37 double S, |
37 B; |
38 double B, |
38 u_char *r, |
39 u_char *r, |
39 *g, |
40 u_char *g, |
40 *b; |
41 u_char *b) |
42 |
|
41 { |
43 { |
42 register int i; |
44 register int i; |
43 register double f, |
45 register double f, |
44 bb; |
46 bb; |
45 register u_char p, |
47 register u_char p, |
88 } |
90 } |
89 } |
91 } |
90 |
92 |
91 |
93 |
92 void |
94 void |
93 HSBramp(h1, s1, b1, h2, s2, b2, start, end, red, green, blue) |
95 HSBramp( |
94 double h1, |
96 double h1, |
95 s1, |
97 double s1, |
96 b1, |
98 double b1, |
97 h2, |
99 double h2, |
98 s2, |
100 double s2, |
99 b2; |
101 double b2, |
100 int start, |
102 int start, |
101 end; |
103 int end, |
102 u_char *red, |
104 u_char *red, |
103 *green, |
105 u_char *green, |
104 *blue; |
106 u_char *blue) |
105 { |
107 { |
106 double dh, |
108 double dh, |
107 ds, |
109 ds, |
108 db; |
110 db; |
109 register u_char *r, |
111 register u_char *r, |