source: trunk/third/xscreensaver/utils/colors.h @ 12203

Revision 12203, 5.5 KB checked in by ghudson, 26 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r12202, which included commits to RCS files with non-trunk default branches.
Line 
1/* xscreensaver, Copyright (c) 1992, 1997 Jamie Zawinski <jwz@jwz.org>
2 *
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
9 * implied warranty.
10 */
11
12#ifndef __COLORS_H__
13#define __COLORS_H__
14
15/* Like XFreeColors, but works on `XColor *' instead of `unsigned long *'
16 */
17extern void free_colors (Display *, Colormap, XColor *, int ncolors);
18
19
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.)
24 */
25extern void allocate_writable_colors (Display *dpy, Colormap cmap,
26                                      unsigned long *pixels, int *ncolorsP);
27
28
29/* Generates a sequence of colors evenly spaced between the given pair
30   of HSV coordinates.
31
32   If closed_p is true, the colors will go from the first point to the
33   second then back to the first.
34
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.
38
39   If writable_p is true, writable color cells will be allocated;
40   otherwise, read-only cells will be allocated.
41 */
42extern 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,
46                             Bool closed_p,
47                             Bool allocate_p,
48                             Bool writable_p);
49
50/* Generates a sequence of colors evenly spaced around the triangle
51   indicated by the thee HSV coordinates.
52
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.
56
57   If writable_p is true, writable color cells will be allocated;
58   otherwise, read-only cells will be allocated.
59 */
60extern 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,
65                             Bool allocate_p,
66                             Bool writable_p);
67
68
69/* Allocates a hopefully-interesting colormap, which will be a closed loop
70   without any sudden transitions.
71
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).
76
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).
81 */
82extern void make_smooth_colormap (Display *dpy, Visual *visual,
83                                  Colormap cmap,
84                                  XColor *colors, int *ncolorsP,
85                                  Bool allocate_p,
86                                  Bool *writable_pP,
87                                  Bool verbose_p);
88
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.
92
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).
97
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).
102 */
103extern void make_uniform_colormap (Display *dpy, Visual *visual,
104                                   Colormap cmap,
105                                   XColor *colors, int *ncolorsP,
106                                   Bool allocate_p,
107                                   Bool *writable_pP,
108                                   Bool verbose_p);
109
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.
113
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).
118
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).
123 */
124extern void make_random_colormap (Display *dpy, Visual *visual,
125                                  Colormap cmap,
126                                  XColor *colors, int *ncolorsP,
127                                  Bool bright_p,
128                                  Bool allocate_p,
129                                  Bool *writable_pP,
130                                  Bool verbose_p);
131
132
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).
136 */
137extern void rotate_colors (Display *, Colormap,
138                           XColor *, int ncolors, int distance);
139
140#endif /* __COLORS_H__ */
Note: See TracBrowser for help on using the repository browser.