1 /* xscreensaver, Copyright (c) 1992-2013 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 (Screen *, 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 (Screen *, Colormap,
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 If allocate_p is false, screen and cmap are unused (OpenGL usage).
44 extern void make_color_ramp (Screen *, Visual *, Colormap,
45 int h1, double s1, double v1,
46 int h2, double s2, double v2,
47 XColor *colors, int *ncolorsP,
52 /* Generates a sequence of colors evenly spaced around the triangle
53 indicated by the thee HSV coordinates.
55 If allocate_p is true, the colors will be allocated from the map;
56 if enough colors can't be allocated, we will try for less, and the
57 result will be returned to ncolorsP.
59 If writable_p is true, writable color cells will be allocated;
60 otherwise, read-only cells will be allocated.
62 If allocate_p is false, screen, visual and cmap are unused (OpenGL usage).
64 extern void make_color_loop (Screen *, Visual *, Colormap,
65 int h1, double s1, double v1,
66 int h2, double s2, double v2,
67 int h3, double s3, double v3,
68 XColor *colors, int *ncolorsP,
73 /* Allocates a hopefully-interesting colormap, which will be a closed loop
74 without any sudden transitions.
76 If allocate_p is true, the colors will be allocated from the map;
77 if enough colors can't be allocated, we will try for less, and the
78 result will be returned to ncolorsP. An error message will be
79 printed on stderr (if verbose_p).
81 If *writable_pP is true, writable color cells will be allocated;
82 otherwise, read-only cells will be allocated. If no writable cells
83 cannot be allocated, we will try to allocate unwritable cells
84 instead, and print a message on stderr to that effect (if verbose_p).
86 If allocate_p is false, screen, visual and cmap are unused (OpenGL usage).
88 extern void make_smooth_colormap (Screen *, Visual *, Colormap,
89 XColor *colors, int *ncolorsP,
94 /* Allocates a uniform colormap which touches each hue of the spectrum,
95 evenly spaced. The saturation and intensity are chosen randomly, but
96 will be high enough to be visible.
98 If allocate_p is true, the colors will be allocated from the map;
99 if enough colors can't be allocated, we will try for less, and the
100 result will be returned to ncolorsP. An error message will be
101 printed on stderr (if verbose_p).
103 If *writable_pP is true, writable color cells will be allocated;
104 otherwise, read-only cells will be allocated. If no writable cells
105 cannot be allocated, we will try to allocate unwritable cells
106 instead, and print a message on stderr to that effect (if verbose_p).
108 If allocate_p is false, screen, visual and cmap are unused (OpenGL usage).
110 extern void make_uniform_colormap (Screen *, Visual *, Colormap,
111 XColor *colors, int *ncolorsP,
116 /* Allocates a random colormap (the colors are unrelated to one another.)
117 If `bright_p' is false, the colors will be completely random; if it is
118 true, all of the colors will be bright enough to see on a black background.
120 If allocate_p is true, the colors will be allocated from the map;
121 if enough colors can't be allocated, we will try for less, and the
122 result will be returned to ncolorsP. An error message will be
123 printed on stderr (if verbose_p).
125 If *writable_pP is true, writable color cells will be allocated;
126 otherwise, read-only cells will be allocated. If no writable cells
127 cannot be allocated, we will try to allocate unwritable cells
128 instead, and print a message on stderr to that effect (if verbose_p).
130 If allocate_p is false, screen, visual and cmap are unused (OpenGL usage).
132 extern void make_random_colormap (Screen *, Visual *, Colormap,
133 XColor *colors, int *ncolorsP,
140 /* Assuming that the array of colors indicates the current state of a set
141 of writable color cells, this rotates the contents of the array by
142 `distance' steps, moving the colors of cell N to cell (N - distance).
144 extern void rotate_colors (Screen *, Colormap,
145 XColor *, int ncolors, int distance);
147 #endif /* __COLORS_H__ */