Christian Heimke commited on 2011-07-15 09:08:51
Showing 22 changed files, with 151 additions and 29 deletions.
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
/* BlinkenLib |
2 |
- * version 0.6.0 date 2008-05-15 |
|
2 |
+ * version 0.6.1 date 2008-07-22 |
|
3 | 3 |
* Copyright 2004-2008 Stefan Schuermans <stefan@blinkenarea.org> |
4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
5 | 5 |
* a blinkenarea.org project |
... | ... |
@@ -11,6 +11,91 @@ |
11 | 11 |
|
12 | 12 |
#include <BlinkenLib/BlinkenLib.h> |
13 | 13 |
|
14 |
+static void gen_test_movie( stBlinkenMovie * * ppMovie, const char * str_format, const char * str_mode, const char * str_duration ) |
|
15 |
+{ |
|
16 |
+ unsigned int height, width, channels, colors; |
|
17 |
+ enum { ModeNone, ModeDots, ModeLines } mode = ModeNone; |
|
18 |
+ int duration; |
|
19 |
+ |
|
20 |
+ if( strcmp( str_mode, "dots" ) == 0 ) |
|
21 |
+ mode = ModeDots; |
|
22 |
+ if( strcmp( str_mode, "lines" ) == 0 ) |
|
23 |
+ mode = ModeLines; |
|
24 |
+ if( sscanf( str_format, "%ux%u-%u/%u", &width, &height, &channels, &colors ) != 4 ) |
|
25 |
+ printf( "invalid movie format \"%s\"\n", str_format ); |
|
26 |
+ else if( mode == ModeNone ) |
|
27 |
+ printf( "invalid test mode \"%s\"\n", str_mode ); |
|
28 |
+ else if( sscanf( str_duration, "%u", &duration ) != 1 ) |
|
29 |
+ printf( "invalid duration \"%s\"\n", str_duration ); |
|
30 |
+ else |
|
31 |
+ { |
|
32 |
+ |
|
33 |
+ if( *ppMovie != NULL ) |
|
34 |
+ BlinkenMovieFree( *ppMovie ); |
|
35 |
+ *ppMovie = BlinkenMovieNew( height, width, channels, colors - 1 ); |
|
36 |
+ if( *ppMovie == NULL ) |
|
37 |
+ printf( "could not create movie with format \"%ux%u-%x/%u\"\n", width, height, channels, colors ); |
|
38 |
+ else |
|
39 |
+ { |
|
40 |
+ |
|
41 |
+ unsigned int y, x, c, yy, xx, cc; |
|
42 |
+ stBlinkenFrame * pFrame; |
|
43 |
+ height = BlinkenMovieGetHeight( *ppMovie ); |
|
44 |
+ width = BlinkenMovieGetWidth( *ppMovie ); |
|
45 |
+ channels = BlinkenMovieGetChannels( *ppMovie ); |
|
46 |
+ colors = BlinkenMovieGetMaxval( *ppMovie ) + 1; |
|
47 |
+ switch( mode ) { |
|
48 |
+ |
|
49 |
+ case ModeNone: |
|
50 |
+ break; |
|
51 |
+ |
|
52 |
+ case ModeDots: |
|
53 |
+ for( c = 0; c < channels; c++ ) |
|
54 |
+ for( y = 0; y < height; y++ ) |
|
55 |
+ for( x = 0; x < width; x++ ) { |
|
56 |
+ pFrame = BlinkenFrameNew( height, width, channels, colors - 1, duration ); |
|
57 |
+ for( yy = 0; yy < height; yy++ ) |
|
58 |
+ for( xx = 0; xx < width; xx++ ) |
|
59 |
+ for( cc = 0; cc < channels; cc++ ) |
|
60 |
+ BlinkenFrameSetPixel( pFrame, yy, xx, cc, |
|
61 |
+ yy == y && xx == x && cc == c ? colors - 1 : 0 ); |
|
62 |
+ BlinkenMovieAppendFrame( *ppMovie, pFrame ); |
|
63 |
+ } |
|
64 |
+ break; |
|
65 |
+ |
|
66 |
+ case ModeLines: |
|
67 |
+ for( c = 0; c < channels; c++ ) { |
|
68 |
+ for( x = 0; x < width; x++ ) { |
|
69 |
+ pFrame = BlinkenFrameNew( height, width, channels, colors - 1, duration ); |
|
70 |
+ for( yy = 0; yy < height; yy++ ) |
|
71 |
+ for( xx = 0; xx < width; xx++ ) |
|
72 |
+ for( cc = 0; cc < channels; cc++ ) |
|
73 |
+ BlinkenFrameSetPixel( pFrame, yy, xx, cc, |
|
74 |
+ xx == x && cc == c ? colors - 1 : 0 ); |
|
75 |
+ BlinkenMovieAppendFrame( *ppMovie, pFrame ); |
|
76 |
+ } |
|
77 |
+ for( y = 0; y < height; y++ ) { |
|
78 |
+ pFrame = BlinkenFrameNew( height, width, channels, colors - 1, duration ); |
|
79 |
+ for( yy = 0; yy < height; yy++ ) |
|
80 |
+ for( xx = 0; xx < width; xx++ ) |
|
81 |
+ for( cc = 0; cc < channels; cc++ ) |
|
82 |
+ BlinkenFrameSetPixel( pFrame, yy, xx, cc, |
|
83 |
+ yy == y && cc == c ? colors - 1 : 0 ); |
|
84 |
+ BlinkenMovieAppendFrame( *ppMovie, pFrame ); |
|
85 |
+ } |
|
86 |
+ } |
|
87 |
+ break; |
|
88 |
+ |
|
89 |
+ } //switch( mode ) |
|
90 |
+ |
|
91 |
+ printf( "test movie generated, using format %ux%u-%u/%u and mode %s\n", |
|
92 |
+ width, height, channels, colors, str_mode ); |
|
93 |
+ |
|
94 |
+ } //if( *ppMovie == NULL ) ... else |
|
95 |
+ |
|
96 |
+ } //else |
|
97 |
+} |
|
98 |
+ |
|
14 | 99 |
int main( int argCnt, char * * args ) |
15 | 100 |
{ |
16 | 101 |
stBlinkenMovie * pMovie; |
... | ... |
@@ -21,7 +106,7 @@ int main( int argCnt, char * * args ) |
21 | 106 |
|
22 | 107 |
//print info |
23 | 108 |
printf( "BlinkenLib - BlinkenConv\n" |
24 |
- "version 0.6.0 date 2008-05-15\n" |
|
109 |
+ "version 0.6.1 date 2008-07-22\n" |
|
25 | 110 |
"config "BLINKENLIB_CONFIG"\n" |
26 | 111 |
"Copyright 2004-2008 Stefan Schuermans <stefan@blinkenarea.org>\n" |
27 | 112 |
"Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" |
... | ... |
@@ -42,6 +127,8 @@ int main( int argCnt, char * * args ) |
42 | 127 |
" scale movie\n" |
43 | 128 |
" -c <channels> [solid|rainbow]\n" |
44 | 129 |
" colorize movie\n" |
130 |
+ " -t <width>x<height>-<channels>/<colors> [dots|lines] <duration>\n" |
|
131 |
+ " generate a test movie\n" |
|
45 | 132 |
" -o <file>\n" |
46 | 133 |
" write movie to file (*.blm, *.bmm, *.bml, *.bbm)\n\n" |
47 | 134 |
"old syntax: %s <input-file> [<output-file>]\n\n", |
... | ... |
@@ -159,11 +246,42 @@ int main( int argCnt, char * * args ) |
159 | 246 |
} |
160 | 247 |
} |
161 | 248 |
else if( i + 1 < argCnt ) |
249 |
+ { |
|
162 | 250 |
printf( "missing colorizing mode for \"-c\"\n" ); |
251 |
+ i++; |
|
252 |
+ } |
|
163 | 253 |
else |
164 | 254 |
printf( "missing number of channels for \"-c\"\n" ); |
165 | 255 |
} |
166 | 256 |
|
257 |
+ //generate test movie |
|
258 |
+ else if( strcmp( args[i], "-t" ) == 0 ) |
|
259 |
+ { |
|
260 |
+ if( i + 3 < argCnt ) |
|
261 |
+ { |
|
262 |
+ const char * str_format, * str_mode, * str_duration; |
|
263 |
+ i++; |
|
264 |
+ str_format = args[i]; |
|
265 |
+ i++; |
|
266 |
+ str_mode = args[i]; |
|
267 |
+ i++; |
|
268 |
+ str_duration = args[i]; |
|
269 |
+ gen_test_movie( &pMovie, str_format, str_mode, str_duration ); |
|
270 |
+ } |
|
271 |
+ else if( i + 2 < argCnt ) |
|
272 |
+ { |
|
273 |
+ printf( "missing duration for \"-t\"\n" ); |
|
274 |
+ i += 2; |
|
275 |
+ } |
|
276 |
+ else if( i + 1 < argCnt ) |
|
277 |
+ { |
|
278 |
+ printf( "missing test mode for \"-t\"\n" ); |
|
279 |
+ i++; |
|
280 |
+ } |
|
281 |
+ else |
|
282 |
+ printf( "missing format for \"-t\"\n" ); |
|
283 |
+ } |
|
284 |
+ |
|
167 | 285 |
//write movie |
168 | 286 |
else if( strcmp( args[i], "-o" ) == 0 ) |
169 | 287 |
{ |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
/* BlinkenLib |
2 |
- * version 0.6.0 date 2008-05-15 |
|
2 |
+ * version 0.6.1 date 2008-07-22 |
|
3 | 3 |
* Copyright 2004-2008 Stefan Schuermans <stefan@blinkenarea.org> |
4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
5 | 5 |
* a blinkenarea.org project |
... | ... |
@@ -409,7 +409,7 @@ int main( int argCnt, char * * args ) |
409 | 409 |
|
410 | 410 |
//print info |
411 | 411 |
printf( "BlinkenLib - BlinkenOutput\n" |
412 |
- "version 0.6.0 date 2008-05-15\n" |
|
412 |
+ "version 0.6.1 date 2008-07-22\n" |
|
413 | 413 |
"config "BLINKENLIB_CONFIG"\n" |
414 | 414 |
"Copyright 2004-2008 Stefan Schuermans <stefan@blinkenarea.org>\n" |
415 | 415 |
"Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
/* BlinkenLib |
2 |
- * version 0.6.0 date 2008-05-15 |
|
2 |
+ * version 0.6.1 date 2008-07-22 |
|
3 | 3 |
* Copyright 2004-2008 Stefan Schuermans <stefan@blinkenarea.org> |
4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
5 | 5 |
* a blinkenarea.org project |
... | ... |
@@ -32,7 +32,7 @@ int main( int argCnt, char * * args ) |
32 | 32 |
|
33 | 33 |
//print info |
34 | 34 |
printf( "BlinkenLib - BlinkenRecv\n" |
35 |
- "version 0.6.0 date 2008-05-15\n" |
|
35 |
+ "version 0.6.1 date 2008-07-22\n" |
|
36 | 36 |
"config "BLINKENLIB_CONFIG"\n" |
37 | 37 |
"Copyright 2004-2008 Stefan Schuermans <stefan@blinkenarea.org>\n" |
38 | 38 |
"Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
/* BlinkenLib |
2 |
- * version 0.6.0 date 2008-05-15 |
|
2 |
+ * version 0.6.1 date 2008-07-22 |
|
3 | 3 |
* Copyright 2004-2008 Stefan Schuermans <stefan@blinkenarea.org> |
4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
5 | 5 |
* a blinkenarea.org project |
... | ... |
@@ -35,7 +35,7 @@ int main( int argCnt, char * * args ) |
35 | 35 |
|
36 | 36 |
//print info |
37 | 37 |
printf( "BlinkenLib - BlinkenSend\n" |
38 |
- "version 0.6.0 date 2008-05-15\n" |
|
38 |
+ "version 0.6.1 date 2008-07-22\n" |
|
39 | 39 |
"config "BLINKENLIB_CONFIG"\n" |
40 | 40 |
"Copyright 2004-2008 Stefan Schuermans <stefan@blinkenarea.org>\n" |
41 | 41 |
"Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
# BlinkenLib |
2 |
-# version 0.6.0 date 2008-05-15 |
|
2 |
+# version 0.6.1 date 2008-07-22 |
|
3 | 3 |
# Copyright 2004-2008 Stefan Schuermans <stefan@blinkenarea.org> |
4 | 4 |
# Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
5 | 5 |
# a blinkenarea.org project |
... | ... |
@@ -12,7 +12,7 @@ RANLIB=ranlib |
12 | 12 |
|
13 | 13 |
VERSION_MAJOR=0 |
14 | 14 |
VERSION_MINOR=6 |
15 |
-VERSION_REVISION=0 |
|
15 |
+VERSION_REVISION=1 |
|
16 | 16 |
VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_REVISION) |
17 | 17 |
|
18 | 18 |
include ../config/config.mk |
... | ... |
@@ -87,5 +87,5 @@ BlinkenOutput: BlinkenOutput.o libBlinkenLib.so |
87 | 87 |
$(CC) $(LFLAGS) -o $@ $< -lBlinkenLib |
88 | 88 |
|
89 | 89 |
clean: |
90 |
- rm -f BlinkenConv BlinkenSend BlinkenRecv BlinkenOutput libBlinkenLib.so libBlinkenLib.so.$(VERSION) libBlinkenLib.so.$(VERSION_MAJOR) libBlinkenLib.a *.o config.h |
|
90 |
+ rm -f BlinkenConv BlinkenSend BlinkenRecv BlinkenOutput libBlinkenLib.so* libBlinkenLib.a *.o config.h |
|
91 | 91 |
|
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
# BlinkenLib |
2 |
-# version 0.6.0 date 2008-05-15 |
|
2 |
+# version 0.6.1 date 2008-07-22 |
|
3 | 3 |
# Copyright 2004-2008 Stefan Schuermans <stefan@blinkenarea.org> |
4 | 4 |
# Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
5 | 5 |
# a blinkenarea.org project |
... | ... |
@@ -8,7 +8,7 @@ INSTALL=install |
8 | 8 |
|
9 | 9 |
VERSION_MAJOR=0 |
10 | 10 |
VERSION_MINOR=6 |
11 |
-VERSION_REVISION=0 |
|
11 |
+VERSION_REVISION=1 |
|
12 | 12 |
VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_REVISION) |
13 | 13 |
|
14 | 14 |
ENV_PREFIX=$(shell echo $$PREFIX) |