2 * XCrHsbCmap.c - X11 library routine to create an HSB ramp colormaps.
4 * Copyright (c) 1991, 2011, Oracle and/or its affiliates. All rights reserved.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
25 * Author: Patrick J. Naughton
38 Colormap
*cmap
, /* colormap return value */
39 int count
, /* number of entries to use */
40 double h1
, /* starting hue */
41 double s1
, /* starting saturation */
42 double b1
, /* starting brightness */
43 double h2
, /* ending hue */
44 double s2
, /* ending saturation */
45 double b2
, /* ending brightness */
46 int bw
, /* Boolean: True = save black and white */
59 HSBramp(h1
, s1
, b1
, h2
, s2
, b2
, 0, count
- 1, red
, green
, blue
);
62 pixel
= WhitePixel(dsp
, screen
);
64 red
[pixel
] = green
[pixel
] = blue
[pixel
] = 0xff;
66 pixel
= BlackPixel(dsp
, screen
);
68 red
[pixel
] = green
[pixel
] = blue
[pixel
] = 0;
70 status
= XCreateDynamicColormap(dsp
, screen
, cmap
, visual
, xcolors
,
71 count
, red
, green
, blue
);