1 /* xscreensaver, Copyright (c) 1992, 1997 Jamie Zawinski <jwz@jwz.org>
3 * Permission to use, copy, modify, distribute, and sell this software and its
4 * documentation for any purpose is hereby granted without fee, provided that
5 * the above copyright notice appear in all copies and that both that
6 * copyright notice and this permission notice appear in supporting
7 * documentation. No representations are made about the suitability of this
8 * software for any purpose. It is provided "as is" without express or
15 /* Like XFreeColors, but works on `XColor *' instead of `unsigned long *'
17 extern void free_colors (Display *, Colormap, XColor *, int ncolors);
20 /* Allocates writable, non-contiguous color cells. The number requested is
21 passed in *ncolorsP, and the number actually allocated is returned there.
22 (Unlike XAllocColorCells(), this will allocate as many as it can, instead
23 of failing if they can't all be allocated.)
25 extern void allocate_writable_colors (Display *dpy, Colormap cmap,
26 unsigned long *pixels, int *ncolorsP);
29 /* Generates a sequence of colors evenly spaced between the given pair
32 If closed_p is true, the colors will go from the first point to the
33 second then back to the first.
35 If allocate_p is true, the colors will be allocated from the map;
36 if enough colors can't be allocated, we will try for less, and the
37 result will be returned to ncolorsP.
39 If writable_p is true, writable color cells will be allocated;
40 otherwise, read-only cells will be allocated.
42 extern void make_color_ramp (Display *dpy, Colormap cmap,
43 int h1, double s1, double v1,
44 int h2, double s2, double v2,
45 XColor *colors, int *ncolorsP,
50 /* Generates a sequence of colors evenly spaced around the triangle
51 indicated by the thee HSV coordinates.
53 If allocate_p is true, the colors will be allocated from the map;
54 if enough colors can't be allocated, we will try for less, and the
55 result will be returned to ncolorsP.
57 If writable_p is true, writable color cells will be allocated;
58 otherwise, read-only cells will be allocated.
60 extern void make_color_loop (Display *, Colormap,
61 int h1, double s1, double v1,
62 int h2, double s2, double v2,
63 int h3, double s3, double v3,
64 XColor *colors, int *ncolorsP,
69 /* Allocates a hopefully-interesting colormap, which will be a closed loop
70 without any sudden transitions.
72 If allocate_p is true, the colors will be allocated from the map;
73 if enough colors can't be allocated, we will try for less, and the
74 result will be returned to ncolorsP. An error message will be
75 printed on stderr (if verbose_p).
77 If *writable_pP is true, writable color cells will be allocated;
78 otherwise, read-only cells will be allocated. If no writable cells
79 cannot be allocated, we will try to allocate unwritable cells
80 instead, and print a message on stderr to that effect (if verbose_p).
82 extern void make_smooth_colormap (Display *dpy, Visual *visual,
84 XColor *colors, int *ncolorsP,
89 /* Allocates a uniform colormap which touches each hue of the spectrum,
90 evenly spaced. The saturation and intensity are chosen randomly, but
91 will be high enough to be visible.
93 If allocate_p is true, the colors will be allocated from the map;
94 if enough colors can't be allocated, we will try for less, and the
95 result will be returned to ncolorsP. An error message will be
96 printed on stderr (if verbose_p).
98 If *writable_pP is true, writable color cells will be allocated;
99 otherwise, read-only cells will be allocated. If no writable cells
100 cannot be allocated, we will try to allocate unwritable cells
101 instead, and print a message on stderr to that effect (if verbose_p).
103 extern void make_uniform_colormap (Display *dpy, Visual *visual,
105 XColor *colors, int *ncolorsP,
110 /* Allocates a random colormap (the colors are unrelated to one another.)
111 If `bright_p' is false, the colors will be completely random; if it is
112 true, all of the colors will be bright enough to see on a black background.
114 If allocate_p is true, the colors will be allocated from the map;
115 if enough colors can't be allocated, we will try for less, and the
116 result will be returned to ncolorsP. An error message will be
117 printed on stderr (if verbose_p).
119 If *writable_pP is true, writable color cells will be allocated;
120 otherwise, read-only cells will be allocated. If no writable cells
121 cannot be allocated, we will try to allocate unwritable cells
122 instead, and print a message on stderr to that effect (if verbose_p).
124 extern void make_random_colormap (Display *dpy, Visual *visual,
126 XColor *colors, int *ncolorsP,
133 /* Assuming that the array of colors indicates the current state of a set
134 of writable color cells, this rotates the contents of the array by
135 `distance' steps, moving the colors of cell N to cell (N - distance).
137 extern void rotate_colors (Display *, Colormap,
138 XColor *, int ncolors, int distance);
140 #endif /* __COLORS_H__ */