updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / xtrascreenhacks / psychedelic-new-options.diff
blobf68596bd50c59e62f3b04913b591d8a44cbbe7fc
1 --- hacks/glx/psychedelic.c.orig 2011-03-26 21:21:59.000000000 -0400
2 +++ hacks/glx/psychedelic.c 2011-05-04 16:08:17.670000454 -0400
3 @@ -24,6 +24,7 @@
5 #include "xlockmore.h"
6 #include "clovermap.h"
7 +#include "plasmamap.h"
8 #include <math.h>
10 #define DEFAULTS "*delay: 30000 \n" \
11 @@ -37,10 +38,10 @@
12 /* #define DEF_STEP "200" */
13 #define DEF_SMOOTH "False"
14 #define DEF_CLOVER "False"
15 -#define DEF_SIMPLE "False"
16 -#define DEF_SIMPLE2 "False"
17 +#define DEF_PLASMA "False"
18 +#define DEF_SINES "False"
20 -enum displaymap {CLOVER, SIMPLE, SIMPLE2};
21 +enum displaymap {CLOVER, PLASMA, SINES};
22 /* #define NUMMAPS 3 */
24 typedef struct {
25 @@ -61,8 +62,8 @@
26 /* static int step; */
27 static Bool smooth;
28 static Bool clover;
29 -static Bool simple;
30 -static Bool simple2;
31 +static Bool plasma;
32 +static Bool sines;
34 static XrmOptionDescRec opts[] = {
35 { "-map", ".map", XrmoptionSepArg, 0 },
36 @@ -73,10 +74,10 @@
37 {"+smooth", ".smooth", XrmoptionNoArg, "False" },
38 {"-clover", ".clover", XrmoptionNoArg, "True" },
39 {"+clover", ".clover", XrmoptionNoArg, "False" },
40 - {"-simple", ".simple", XrmoptionNoArg, "True" },
41 - {"+simple", ".simple", XrmoptionNoArg, "False" },
42 - {"-simple2", ".simple2", XrmoptionNoArg, "True" },
43 - {"+simple2", ".simple2", XrmoptionNoArg, "False" },
44 + {"-plasma", ".plasma", XrmoptionNoArg, "True" },
45 + {"+plasma", ".plasma", XrmoptionNoArg, "False" },
46 + {"-sines", ".sines", XrmoptionNoArg, "True" },
47 + {"+sines", ".sines", XrmoptionNoArg, "False" },
50 static argtype vars[] = {
51 @@ -86,8 +87,8 @@
52 /* {&step, "step", "Step", DEF_STEP, t_Int}, */
53 {&smooth, "smooth", "Smooth", DEF_SMOOTH, t_Bool},
54 {&clover, "clover", "Clover", DEF_CLOVER, t_Bool},
55 - {&simple, "simple", "Simple", DEF_SIMPLE, t_Bool},
56 - {&simple2, "simple2", "Simple2", DEF_SIMPLE2, t_Bool},
57 + {&plasma, "plasma", "Plasma", DEF_PLASMA, t_Bool},
58 + {&sines, "sines", "Sines", DEF_SINES, t_Bool},
61 static OptionStruct desc[] = {
62 @@ -97,8 +98,8 @@
63 /* {"-step", "how far the flyers should move forward in one frame"}, */
64 {"-smooth", "whether to use smooth color transitions"},
65 {"-clover", "whether to use the clover (default) colormap--overrides other maps"},
66 - {"-simple", "whether to use the simple colormap"},
67 - {"-simple2", "whether to use the other simple colormap"},
68 + {"-plasma", "whether to use the plasma colormap"},
69 + {"-sines", "whether to use the other simple colormap"},
72 ENTRYPOINT ModeSpecOpt psychedelic_opts = {countof(opts), opts, countof(vars), vars, desc};
73 @@ -124,33 +125,51 @@
77 -/* === some simple maps for testing */
78 -static void
79 -simpleImage(int * bits, int width, int height, int numcolors)
80 +/* === some simple maps that are too small to merit their own file */
81 +static void sineImage(int * bits, int width, int height, int numcolors)
83 - int i, j;
85 - for (i = 0; i < height; i++) {
86 - for (j = 0; j< width / 2; j++) {
87 - bits[ i * width + j ] = bits[i * width + width - j] = j % numcolors;
88 - }
89 - }
90 + float sinemap;
91 + float xexpand, yexpand;
92 + int itor, jtor;
93 + xexpand = yexpand = 0.0;
94 + while (xexpand == 0.0) xexpand = (float)(random() % 100) / 1000.;
95 + while (yexpand == 0.0) yexpand = (float)(random() % 100) / 1000.;
96 + for (itor = 0; itor < height; itor++)
97 + {
98 + for (jtor = 0; jtor < width; jtor++)
99 + {
100 + /* factors between 0.1 and 0.01, assign both separately */
101 + sinemap = 0.25 * (sin(yexpand * itor) + sin(xexpand * jtor)) + 0.5;
102 + bits[itor * width + jtor] = sinemap * (numcolors - 1);
107 -static void
108 -simple2Image(int * bits, int width, int height, int numcolors)
110 - int i, j;
112 - for (i = 0; i < height/2; i++) {
113 - for (j = 0; j< width; j++) {
114 -/* bits[ i * width + j ] =(i > height/2 ? numcolors -(i % numcolors) - 1 : i % numcolors);; */
115 - bits[ i * width + j ] = bits[(height - i) * width + j] = i % numcolors;
121 +/* static void */
122 +/* simpleImage(int * bits, int width, int height, int numcolors) */
123 +/* { */
124 +/* int i, j; */
126 +/* for (i = 0; i < height; i++) { */
127 +/* for (j = 0; j< width / 2; j++) { */
128 +/* bits[ i * width + j ] = bits[i * width + width - j] = j % numcolors; */
129 +/* } */
130 +/* } */
131 +/* } */
133 +/* static void */
134 +/* sinesImage(int * bits, int width, int height, int numcolors) */
135 +/* { */
136 +/* int i, j; */
138 +/* for (i = 0; i < height/2; i++) { */
139 +/* for (j = 0; j< width; j++) { */
140 +/* bits[ i * width + j ] = bits[(height - i) * width + j] = i % numcolors; */
143 +/* } */
144 +/* } */
145 +/* } */
146 /* ===== end maps ============== */
148 ENTRYPOINT void reshape_psychedelic (ModeInfo *mi, int width, int height)
149 @@ -209,12 +228,14 @@
150 make_smooth_colormap (MI_DISPLAY(mi),MI_VISUAL(mi), MI_COLORMAP(mi),
151 lp->colors, &lp->numcolors, True, False, 0);
152 else
154 make_random_colormap (MI_DISPLAY(mi),MI_VISUAL(mi), MI_COLORMAP(mi),
155 lp->colors, &lp->numcolors, True, False, 0, True);
157 /* add bg color to last slot, overwriting the assigned color */
158 lp->colors[lp->numcolors-1].pixel = MI_BLACK_PIXEL(mi);
159 XQueryColor(MI_DISPLAY(mi), MI_COLORMAP(mi), &lp->colors[lp->numcolors - 1]);
162 lp->pixcolors = calloc(lp->numcolors, sizeof(GLuint));
163 if (lp->pixcolors == NULL)
164 @@ -247,19 +268,19 @@
166 memset(lp->pixgrid, 0, lp->gridheight * lp->gridwidth * sizeof(int));
167 dmap = CLOVER;
168 - if (simple) dmap = SIMPLE;
169 - if (simple2) dmap = SIMPLE2;
170 + if (plasma) dmap = PLASMA;
171 + if (sines) dmap = SINES;
172 if (clover) dmap = CLOVER;
173 switch(dmap)
175 case CLOVER:
176 cloverImage(lp->pixgrid, lp->numcolors, lp->gridwidth, lp->gridheight, R);
177 break;
178 - case SIMPLE:
179 - simpleImage(lp->pixgrid, lp->gridwidth, lp->gridheight, lp->numcolors );
180 + case PLASMA:
181 + plasmaImage(lp->pixgrid, lp->gridwidth, lp->gridheight, lp->numcolors );
182 break;
183 - case SIMPLE2:
184 - simple2Image(lp->pixgrid, lp->gridwidth, lp->gridheight, lp->numcolors );
185 + case SINES:
186 + sineImage(lp->pixgrid, lp->gridwidth, lp->gridheight, lp->numcolors );
187 break;
188 default:
189 cloverImage(lp->pixgrid, lp->numcolors, lp->gridwidth, lp->gridheight, R);
190 @@ -342,9 +363,12 @@
191 /* deal with likely non-portability of packed pixels -- maybe MI_VISUAL(mi) will be useful */
193 /* make more maps, handle option for them better */
194 +/* come up with a better name for "sines", I know I've seen this pattern before */
195 /* make mono a ramp of greys, not just black and white */
196 +/* save moduloing each pixel by making color array twice the length of ncolors,
197 + * and repeating the colors in the second half
198 + */
200 -/* take black stripe out of smooth? */
201 /* apparently there is a bug in clovermap that leaves
202 * some indices == numcolors, not numcolors -1
203 * this can cause an out of range error if not modulo'd again
204 --- hacks/glx/Makefile.in.orig 2011-03-27 00:24:34.000000000 -0400
205 +++ hacks/glx/Makefile.in 2011-05-04 15:32:45.000000000 -0400
206 @@ -81,14 +81,14 @@
207 $(UTILS_SRC)/yarandom.o $(UTILS_SRC)/xshm.o $(UTILS_SRC)/erase.o
209 SRCS = xlock-gl-utils.c fps.c xpm-ximage.c xbmread.c flyer.c \ berlinuhr.c bclockhousing.c bclocklamps.c soma.c \ bevelcube.c skylark.c crater4.c ejecta.c craters.c \
210 - clovermap.c psychedelic.c
211 + clovermap.c plasmamap.c psychedelic.c
215 OBJS = xlock-gl-utils.o fps.o xpm-ximage.o xbmread.o flyer.o \
216 berlinuhr.o bclockhousing.o bclocklamps.o soma.o \
217 bevelcube.o skylark.o crater4.o ejecta.o craters.o \
218 - clovermap.o psychedelic.o
219 + clovermap.o plasmamap.o psychedelic.o
222 GL_EXES = flyer berlinuhr soma skylark craters psychedelic
223 @@ -109,7 +109,7 @@
226 HDRS = xpm-ximage.h xbmread.h bclockconnector.h bclockhousing.h \ bclocklamps.h bclocklightbank.h bevelcube.h flipguide.h \ somafigures.h boomerangs.h crater4.h ejecta.h \
227 - clovermap.h
228 + clovermap.h plasmamap.h
230 GL_MEN = flyer.man berlinuhr.man soma.man skylark.man craters.man \
231 psychedelic.man
232 @@ -367,8 +367,8 @@
233 craters: craters.o crater4.o ejecta.o $(HACK_OBJS)
234 $(CC_HACK) -o $@ $@.o crater4.o ejecta.o $(HACK_OBJS) $(XPM_LIBS)
236 -psychedelic: psychedelic.o clovermap.o $(HACK_OBJS)
237 - $(CC_HACK) -o $@ $@.o clovermap.o $(HACK_OBJS) $(XPM_LIBS)
238 +psychedelic: psychedelic.o clovermap.o plasmamap.o $(HACK_OBJS)
239 + $(CC_HACK) -o $@ $@.o clovermap.o plasmamap.o $(HACK_OBJS) $(XPM_LIBS)
243 @@ -443,6 +443,7 @@
244 fps.o: $(HACK_SRC)/xlockmoreI.h
245 psychedelic.o: $(srcdir)/clovermap.h
246 psychedelic.o: ../../config.h
247 +psychedelic.o: $(srcdir)/plasmamap.h
248 psychedelic.o: $(HACK_SRC)/screenhackI.h
249 psychedelic.o: $(UTILS_SRC)/colors.h
250 psychedelic.o: $(UTILS_SRC)/grabscreen.h