Christian Heimke commited on 2011-07-15 09:05:20
Showing 17 changed files, with 272 additions and 45 deletions.
| ... | ... |
@@ -0,0 +1,84 @@ |
| 1 |
+/* BlinkenLib |
|
| 2 |
+ * version 0.5.3 date 2007-12-28 |
|
| 3 |
+ * Copyright 2004-2007 Stefan Schuermans <stefan@schuermans.info> |
|
| 4 |
+ * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
|
| 5 |
+ * a blinkenarea.org project |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+#include <string.h> |
|
| 9 |
+ |
|
| 10 |
+#include "Tools.h" |
|
| 11 |
+#include "BlinkenColorizer.h" |
|
| 12 |
+ |
|
| 13 |
+unsigned char BlinkenColorizerSolid( int step, int channels, int y, int x, int c ) |
|
| 14 |
+{
|
|
| 15 |
+ int substep, updown, chan; |
|
| 16 |
+ step %= channels * 2 * 254; |
|
| 17 |
+ substep = step % 254; |
|
| 18 |
+ updown = (step / 254) % 2; |
|
| 19 |
+ chan = (step / 254) / 2; |
|
| 20 |
+ if( updown == 0 ) {
|
|
| 21 |
+ if( c == chan ) |
|
| 22 |
+ return 255; |
|
| 23 |
+ else if( c == (chan + 1) % channels ) |
|
| 24 |
+ return substep; |
|
| 25 |
+ else |
|
| 26 |
+ return 0; |
|
| 27 |
+ } else {
|
|
| 28 |
+ if( c == chan ) |
|
| 29 |
+ return 255 - substep; |
|
| 30 |
+ else if( c == (chan + 1) % channels ) |
|
| 31 |
+ return 255; |
|
| 32 |
+ else |
|
| 33 |
+ return 0; |
|
| 34 |
+ } |
|
| 35 |
+ y = x = 0; // keep compiler quiet |
|
| 36 |
+} |
|
| 37 |
+ |
|
| 38 |
+unsigned char BlinkenColorizerRainbow( int step, int channels, int y, int x, int c ) |
|
| 39 |
+{
|
|
| 40 |
+ return BlinkenColorizerSolid( step + ((x + y) * 64), channels, y, x, c ); |
|
| 41 |
+} |
|
| 42 |
+ |
|
| 43 |
+// type describing a colorizing modes |
|
| 44 |
+typedef struct _BlinkenColorizingModeDesc |
|
| 45 |
+{
|
|
| 46 |
+ const char * name; |
|
| 47 |
+ unsigned char (* func)( int step, int channels, int y, int x, int c ); |
|
| 48 |
+} BlinkenColorizingModeDesc; |
|
| 49 |
+ |
|
| 50 |
+// supported colorizing modes |
|
| 51 |
+static const BlinkenColorizingModeDesc BlinkenColorizingModeDescs[] = {
|
|
| 52 |
+ { "solid", BlinkenColorizerSolid },
|
|
| 53 |
+ { "rainbow", BlinkenColorizerRainbow },
|
|
| 54 |
+}; |
|
| 55 |
+ |
|
| 56 |
+// convert string to colorizing mode |
|
| 57 |
+// returns colorizing mode (>= 0) or -1 on error |
|
| 58 |
+int BlinkenColorizerStr2Mode( const char * str ) |
|
| 59 |
+{
|
|
| 60 |
+ unsigned int i; |
|
| 61 |
+ for( i = 0; i < arr_cnt( BlinkenColorizingModeDescs ); i++ ) |
|
| 62 |
+ if( strcmp( str, BlinkenColorizingModeDescs[i].name ) == 0 ) |
|
| 63 |
+ break; |
|
| 64 |
+ if( i < arr_cnt( BlinkenColorizingModeDescs ) ) |
|
| 65 |
+ return i; |
|
| 66 |
+ return -1; |
|
| 67 |
+} |
|
| 68 |
+ |
|
| 69 |
+// convert colorizing mode to string |
|
| 70 |
+const char * BlinkenColorizerMode2Str( int mode ) |
|
| 71 |
+{
|
|
| 72 |
+ if( mode < 0 || mode >= (int)arr_cnt( BlinkenColorizingModeDescs ) ) |
|
| 73 |
+ return "(unknown)"; |
|
| 74 |
+ return BlinkenColorizingModeDescs[mode].name; |
|
| 75 |
+} |
|
| 76 |
+ |
|
| 77 |
+// get color for colorizing |
|
| 78 |
+unsigned char BlinkenColorizerGetColor( int channels, int mode, int step, int y, int x, int c ) |
|
| 79 |
+{
|
|
| 80 |
+ if( mode < 0 || mode >= (int)arr_cnt( BlinkenColorizingModeDescs ) ) |
|
| 81 |
+ return 255; |
|
| 82 |
+ return BlinkenColorizingModeDescs[mode].func( step, channels, y, x, c ); |
|
| 83 |
+} |
|
| 84 |
+ |
| ... | ... |
@@ -0,0 +1,22 @@ |
| 1 |
+/* BlinkenLib |
|
| 2 |
+ * version 0.5.3 date 2007-12-28 |
|
| 3 |
+ * Copyright 2004-2007 Stefan Schuermans <stefan@schuermans.info> |
|
| 4 |
+ * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
|
| 5 |
+ * a blinkenarea.org project |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+#ifndef INC_BlinkenColorizer |
|
| 9 |
+#define INC_BlinkenColorizer |
|
| 10 |
+ |
|
| 11 |
+// convert string to colorizing mode |
|
| 12 |
+// returns colorizing mode (>= 0) or -1 on error |
|
| 13 |
+int BlinkenColorizerStr2Mode( const char * str ); |
|
| 14 |
+ |
|
| 15 |
+// convert colorizing mode to string |
|
| 16 |
+const char * BlinkenColorizerMode2Str( int mode ); |
|
| 17 |
+ |
|
| 18 |
+// get color for colorizing |
|
| 19 |
+unsigned char BlinkenColorizerGetColor( int channels, int mode, int step, int y, int x, int c ); |
|
| 20 |
+ |
|
| 21 |
+#endif //#ifndef INC_BlinkenColorizer |
|
| 22 |
+ |
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
/* BlinkenLib |
| 2 |
- * version 0.5.2 date 2006-05-10 |
|
| 3 |
- * Copyright 2004-2006 Stefan Schuermans <1stein@schuermans.info> |
|
| 2 |
+ * version 0.5.3 date 2007-12-28 |
|
| 3 |
+ * Copyright 2004-2007 Stefan Schuermans <stefan@schuermans.info> |
|
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| 6 | 6 |
*/ |
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
/* BlinkenLib |
| 2 |
- * version 0.5.2 date 2006-05-10 |
|
| 3 |
- * Copyright 2004-2006 Stefan Schuermans <1stein@schuermans.info> |
|
| 2 |
+ * version 0.5.3 date 2007-12-28 |
|
| 3 |
+ * Copyright 2004-2007 Stefan Schuermans <stefan@schuermans.info> |
|
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| 6 | 6 |
*/ |
| ... | ... |
@@ -9,6 +9,7 @@ |
| 9 | 9 |
#include <stdlib.h> |
| 10 | 10 |
#include <string.h> |
| 11 | 11 |
|
| 12 |
+#include "BlinkenColorizer.h" |
|
| 12 | 13 |
#include "BlinkenLib.h" |
| 13 | 14 |
|
| 14 | 15 |
int main( int argCnt, char * * args ) |
| ... | ... |
@@ -17,11 +18,12 @@ int main( int argCnt, char * * args ) |
| 17 | 18 |
int i; |
| 18 | 19 |
char * str; |
| 19 | 20 |
unsigned int height, width, channels, colors; |
| 21 |
+ int mode; |
|
| 20 | 22 |
|
| 21 | 23 |
//print info |
| 22 | 24 |
printf( "BlinkenLib - BlinkenConv\n" |
| 23 |
- "version 0.5.2 date 2006-05-10\n" |
|
| 24 |
- "Copyright 2004-2006 Stefan Schuermans <1stein@schuermans.info>\n" |
|
| 25 |
+ "version 0.5.3 date 2007-12-28\n" |
|
| 26 |
+ "Copyright 2004-2007 Stefan Schuermans <stefan@schuermans.info>\n" |
|
| 25 | 27 |
"Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" |
| 26 | 28 |
"a blinkenarea.org project\n\n" ); |
| 27 | 29 |
|
| ... | ... |
@@ -38,6 +40,8 @@ int main( int argCnt, char * * args ) |
| 38 | 40 |
" resize movie\n" |
| 39 | 41 |
" -s <width>x<height>\n" |
| 40 | 42 |
" scale movie\n" |
| 43 |
+ " -c <channels> [solid|rainbow]\n" |
|
| 44 |
+ " colorize movie\n" |
|
| 41 | 45 |
" -o <file>\n" |
| 42 | 46 |
" write movie to file (*.blm, *.bmm, *.bml, *.bbm)\n\n" |
| 43 | 47 |
"old syntax: %s <input-file> [<output-file>]\n\n", |
| ... | ... |
@@ -128,6 +132,38 @@ int main( int argCnt, char * * args ) |
| 128 | 132 |
printf( "missing movie dimensions for \"-s\"\n" ); |
| 129 | 133 |
} |
| 130 | 134 |
|
| 135 |
+ //colorize movie |
|
| 136 |
+ else if( strcmp( args[i], "-c" ) == 0 ) |
|
| 137 |
+ {
|
|
| 138 |
+ if( i + 2 < argCnt ) |
|
| 139 |
+ {
|
|
| 140 |
+ const char * str_channels, * str_mode; |
|
| 141 |
+ i++; |
|
| 142 |
+ str_channels = args[i]; |
|
| 143 |
+ i++; |
|
| 144 |
+ str_mode = args[i]; |
|
| 145 |
+ if( sscanf( str_channels, "%u", &channels ) != 1 ) |
|
| 146 |
+ printf( "invalid number of channels \"%s\"\n", args[i] ); |
|
| 147 |
+ else |
|
| 148 |
+ {
|
|
| 149 |
+ mode = BlinkenColorizerStr2Mode( str_mode ); |
|
| 150 |
+ if( mode < 0 ) |
|
| 151 |
+ printf( "invalid colorizing mode \"%s\"\n", args[i] ); |
|
| 152 |
+ else if( pMovie == NULL ) |
|
| 153 |
+ printf( "no movie loaded to colorize\n" ); |
|
| 154 |
+ else |
|
| 155 |
+ {
|
|
| 156 |
+ BlinkenMovieColorize( pMovie, channels, mode ); |
|
| 157 |
+ printf( "movie colorized to %u channels using mode %s\n", channels, BlinkenColorizerMode2Str( mode ) ); |
|
| 158 |
+ } |
|
| 159 |
+ } |
|
| 160 |
+ } |
|
| 161 |
+ else if( i + 1 < argCnt ) |
|
| 162 |
+ printf( "missing colorizing mode for \"-c\"\n" ); |
|
| 163 |
+ else |
|
| 164 |
+ printf( "missing number of channels for \"-c\"\n" ); |
|
| 165 |
+ } |
|
| 166 |
+ |
|
| 131 | 167 |
//write movie |
| 132 | 168 |
else if( strcmp( args[i], "-o" ) == 0 ) |
| 133 | 169 |
{
|
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
/* BlinkenLib |
| 2 |
- * version 0.5.2 date 2006-05-10 |
|
| 3 |
- * Copyright 2004-2006 Stefan Schuermans <1stein@schuermans.info> |
|
| 2 |
+ * version 0.5.3 date 2007-12-28 |
|
| 3 |
+ * Copyright 2004-2007 Stefan Schuermans <stefan@schuermans.info> |
|
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| 6 | 6 |
*/ |
| ... | ... |
@@ -19,6 +19,7 @@ typedef DWORD uint32_t; |
| 19 | 19 |
#endif |
| 20 | 20 |
|
| 21 | 21 |
#include "BlinkenConstants.h" |
| 22 |
+#include "BlinkenColorizer.h" |
|
| 22 | 23 |
#include "BlinkenFrame.h" |
| 23 | 24 |
#include "Tools.h" |
| 24 | 25 |
|
| ... | ... |
@@ -466,6 +467,54 @@ void BlinkenFrameScale( stBlinkenFrame * pFrame, int height, int width ) |
| 466 | 467 |
pFrame->ppData = ppData; |
| 467 | 468 |
} |
| 468 | 469 |
|
| 470 |
+void BlinkenFrameColorize( stBlinkenFrame * pFrame, int channels, int mode, int step ) |
|
| 471 |
+{
|
|
| 472 |
+ unsigned char * * ppData; |
|
| 473 |
+ int y, x, c, i, j; |
|
| 474 |
+ unsigned int val; |
|
| 475 |
+ |
|
| 476 |
+ if( pFrame == NULL ) |
|
| 477 |
+ return; |
|
| 478 |
+ |
|
| 479 |
+ if( channels < BlinkenChannelsMin ) channels = BlinkenChannelsMin; |
|
| 480 |
+ if( channels > BlinkenChannelsMax ) channels = BlinkenMaxvalMax; |
|
| 481 |
+ |
|
| 482 |
+ //allocate new data array |
|
| 483 |
+ ppData = (unsigned char * *)malloc2D( pFrame->height, pFrame->width * channels, sizeof( unsigned char ) ); |
|
| 484 |
+ if( ppData == NULL ) |
|
| 485 |
+ return; |
|
| 486 |
+ for( y = 0; y < pFrame->height; y++ ) |
|
| 487 |
+ for( x = 0, i = 0; x < pFrame->width; x++ ) |
|
| 488 |
+ for( c = 0; c < channels; c++, i++ ) |
|
| 489 |
+ ppData[y][i] = 0; |
|
| 490 |
+ |
|
| 491 |
+ //colorize frame |
|
| 492 |
+ for( y = 0; y < pFrame->height; y++ ) |
|
| 493 |
+ {
|
|
| 494 |
+ for( x = 0; x < pFrame->width; x++ ) |
|
| 495 |
+ {
|
|
| 496 |
+ i = x * pFrame->channels; |
|
| 497 |
+ //merge channels |
|
| 498 |
+ val = 0; |
|
| 499 |
+ for( c = 0; c < pFrame->channels; c++, i++ ) |
|
| 500 |
+ val += pFrame->ppData[y][i]; |
|
| 501 |
+ val = (val + pFrame->channels / 2) / pFrame->channels; |
|
| 502 |
+ val = (val * BlinkenMaxvalMax + pFrame->maxval / 2) / pFrame->maxval; |
|
| 503 |
+ //colorize |
|
| 504 |
+ j = x * channels; |
|
| 505 |
+ for( c = 0; c < channels; c++, j++ ) {
|
|
| 506 |
+ int color = BlinkenColorizerGetColor( channels, mode, step, y, x, c ); |
|
| 507 |
+ ppData[y][j] = (unsigned char)((val * color + 127) / 255); |
|
| 508 |
+ } |
|
| 509 |
+ } |
|
| 510 |
+ } |
|
| 511 |
+ |
|
| 512 |
+ pFrame->channels = channels; |
|
| 513 |
+ pFrame->maxval = BlinkenMaxvalMax; |
|
| 514 |
+ free( pFrame->ppData ); |
|
| 515 |
+ pFrame->ppData = ppData; |
|
| 516 |
+} |
|
| 517 |
+ |
|
| 469 | 518 |
char * BlinkenFrameToString( stBlinkenFrame * pFrame ) |
| 470 | 519 |
{
|
| 471 | 520 |
int size, y, x, c, i; |
| ... | ... |
@@ -604,7 +653,7 @@ stBlinkenFrame * BlinkenFrameFromNetwork( char * pData, int length, etBlinkenPro |
| 604 | 653 |
i = sizeof( stBlinkenProtoBlpHdr ); //put data into frame |
| 605 | 654 |
for( y = 0; y < pFrame->height; y++ ) |
| 606 | 655 |
for( x = 0; x < pFrame->width; x++, i++ ) |
| 607 |
- pFrame->ppData[y][x * 1 + 0] = pData[i]; |
|
| 656 |
+ pFrame->ppData[y][x] = pData[i] ? 0x01 : 0x00; |
|
| 608 | 657 |
return pFrame; |
| 609 | 658 |
} |
| 610 | 659 |
|
| ... | ... |
@@ -626,7 +675,7 @@ stBlinkenFrame * BlinkenFrameFromNetwork( char * pData, int length, etBlinkenPro |
| 626 | 675 |
i = sizeof( stBlinkenProtoEblpHdr ); //put data into frame |
| 627 | 676 |
for( y = 0; y < pFrame->height; y++ ) |
| 628 | 677 |
for( x = 0; x < pFrame->width; x++, i++ ) |
| 629 |
- pFrame->ppData[y][x * 1 + 0] = pData[i]; |
|
| 678 |
+ pFrame->ppData[y][x] = pData[i]; |
|
| 630 | 679 |
return pFrame; |
| 631 | 680 |
} |
| 632 | 681 |
|
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
/* BlinkenLib |
| 2 |
- * version 0.5.2 date 2006-05-10 |
|
| 3 |
- * Copyright 2004-2006 Stefan Schuermans <1stein@schuermans.info> |
|
| 2 |
+ * version 0.5.3 date 2007-12-28 |
|
| 3 |
+ * Copyright 2004-2007 Stefan Schuermans <stefan@schuermans.info> |
|
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| 6 | 6 |
*/ |
| ... | ... |
@@ -36,6 +36,7 @@ void BlinkenFrameSetColor( stBlinkenFrame * pFrame, int y, int x, unsigned long |
| 36 | 36 |
|
| 37 | 37 |
void BlinkenFrameResize( stBlinkenFrame * pFrame, int height, int width, int channels, int maxval ); |
| 38 | 38 |
void BlinkenFrameScale( stBlinkenFrame * pFrame, int height, int width ); |
| 39 |
+void BlinkenFrameColorize( stBlinkenFrame * pFrame, int channels, int mode, int step ); |
|
| 39 | 40 |
|
| 40 | 41 |
char * BlinkenFrameToString( stBlinkenFrame * pFrame ); |
| 41 | 42 |
|
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
/* BlinkenLib |
| 2 |
- * version 0.5.2 date 2006-05-10 |
|
| 3 |
- * Copyright 2004-2006 Stefan Schuermans <1stein@schuermans.info> |
|
| 2 |
+ * version 0.5.3 date 2007-12-28 |
|
| 3 |
+ * Copyright 2004-2007 Stefan Schuermans <stefan@schuermans.info> |
|
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| 6 | 6 |
*/ |
| ... | ... |
@@ -8,6 +8,7 @@ |
| 8 | 8 |
#ifndef INC_BlinkenLib |
| 9 | 9 |
#define INC_BlinkenLib |
| 10 | 10 |
|
| 11 |
+#include "BlinkenColorizer.h" |
|
| 11 | 12 |
#include "BlinkenMovie.h" |
| 12 | 13 |
#include "BlinkenFrame.h" |
| 13 | 14 |
|
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
/* BlinkenLib |
| 2 |
- * version 0.5.2 date 2006-05-10 |
|
| 3 |
- * Copyright 2004-2006 Stefan Schuermans <1stein@schuermans.info> |
|
| 2 |
+ * version 0.5.3 date 2007-12-28 |
|
| 3 |
+ * Copyright 2004-2007 Stefan Schuermans <stefan@schuermans.info> |
|
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| 6 | 6 |
*/ |
| ... | ... |
@@ -504,6 +504,27 @@ void BlinkenMovieScale( stBlinkenMovie * pMovie, int height, int width ) |
| 504 | 504 |
BlinkenFrameScale( pMovie->ppFrames[i], height, width ); |
| 505 | 505 |
} |
| 506 | 506 |
|
| 507 |
+void BlinkenMovieColorize( stBlinkenMovie * pMovie, int channels, int mode ) |
|
| 508 |
+{
|
|
| 509 |
+ int i, step; |
|
| 510 |
+ |
|
| 511 |
+ if( pMovie == NULL ) |
|
| 512 |
+ return; |
|
| 513 |
+ |
|
| 514 |
+ if( channels < BlinkenChannelsMin ) channels = BlinkenChannelsMin; |
|
| 515 |
+ if( channels > BlinkenChannelsMax ) channels = BlinkenMaxvalMax; |
|
| 516 |
+ |
|
| 517 |
+ pMovie->channels = channels; |
|
| 518 |
+ pMovie->maxval = BlinkenMaxvalMax; |
|
| 519 |
+ |
|
| 520 |
+ step = 0; |
|
| 521 |
+ for( i = 0; i < pMovie->frameCnt; i++ ) |
|
| 522 |
+ {
|
|
| 523 |
+ BlinkenFrameColorize( pMovie->ppFrames[i], channels, mode, step ); |
|
| 524 |
+ step += BlinkenFrameGetDuration( pMovie->ppFrames[i] ); |
|
| 525 |
+ } |
|
| 526 |
+} |
|
| 527 |
+ |
|
| 507 | 528 |
char * BlinkenMovieToString( stBlinkenMovie * pMovie ) |
| 508 | 529 |
{
|
| 509 | 530 |
char * * strs, * str, * ptr; |
| ... | ... |
@@ -940,7 +961,8 @@ stBlinkenMovie * BlinkenMovieLoadBbm( char * pFilename ) |
| 940 | 961 |
unsigned short headerHeight, headerWidth, headerChannels, headerMaxval; |
| 941 | 962 |
unsigned long subHeaderMagic, frameStartMarkerMagic; |
| 942 | 963 |
unsigned short subHeaderSize; |
| 943 |
- unsigned char * pInfoHeader, * pInfoHeaderX, * pFrameData; |
|
| 964 |
+ char * pInfoHeader, * pInfoHeaderX; |
|
| 965 |
+ unsigned char * pFrameData; |
|
| 944 | 966 |
int len, duration, y, x, c, i; |
| 945 | 967 |
|
| 946 | 968 |
if( pFilename == NULL ) |
| ... | ... |
@@ -999,7 +1021,7 @@ stBlinkenMovie * BlinkenMovieLoadBbm( char * pFilename ) |
| 999 | 1021 |
if( subHeaderMagic == 0x696E666F ) //'i' 'n' 'f' 'o' |
| 1000 | 1022 |
{
|
| 1001 | 1023 |
//read rest of info header |
| 1002 |
- pInfoHeader = (unsigned char *)malloc( subHeaderSize - 6 ); |
|
| 1024 |
+ pInfoHeader = (char *)malloc( subHeaderSize - 6 ); |
|
| 1003 | 1025 |
if( pInfoHeader == NULL ) |
| 1004 | 1026 |
{
|
| 1005 | 1027 |
BlinkenMovieFree( pMovie ); |
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
/* BlinkenLib |
| 2 |
- * version 0.5.2 date 2006-05-10 |
|
| 3 |
- * Copyright 2004-2006 Stefan Schuermans <1stein@schuermans.info> |
|
| 2 |
+ * version 0.5.3 date 2007-12-28 |
|
| 3 |
+ * Copyright 2004-2007 Stefan Schuermans <stefan@schuermans.info> |
|
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| 6 | 6 |
*/ |
| ... | ... |
@@ -50,6 +50,7 @@ void BlinkenMovieDeleteFrames( stBlinkenMovie * pMovie ); |
| 50 | 50 |
|
| 51 | 51 |
void BlinkenMovieResize( stBlinkenMovie * pMovie, int height, int width, int channels, int maxval ); |
| 52 | 52 |
void BlinkenMovieScale( stBlinkenMovie * pMovie, int height, int width ); |
| 53 |
+void BlinkenMovieColorize( stBlinkenMovie * pMovie, int channels, int mode ); |
|
| 53 | 54 |
|
| 54 | 55 |
char * BlinkenMovieToString( stBlinkenMovie * pMovie ); |
| 55 | 56 |
|
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
/* BlinkenLib |
| 2 |
- * version 0.5.2 date 2006-05-10 |
|
| 3 |
- * Copyright 2004-2006 Stefan Schuermans <1stein@schuermans.info> |
|
| 2 |
+ * version 0.5.3 date 2007-12-28 |
|
| 3 |
+ * Copyright 2004-2007 Stefan Schuermans <stefan@schuermans.info> |
|
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| 6 | 6 |
*/ |
| ... | ... |
@@ -409,8 +409,8 @@ int main( int argCnt, char * * args ) |
| 409 | 409 |
|
| 410 | 410 |
//print info |
| 411 | 411 |
printf( "BlinkenLib - BlinkenOutput\n" |
| 412 |
- "version 0.5.2 date 2006-05-10\n" |
|
| 413 |
- "Copyright 2004-2006 Stefan Schuermans <1stein@schuermans.info>\n" |
|
| 412 |
+ "version 0.5.3 date 2007-12-28\n" |
|
| 413 |
+ "Copyright 2004-2007 Stefan Schuermans <stefan@schuermans.info>\n" |
|
| 414 | 414 |
"Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" |
| 415 | 415 |
"a blinkenarea.org project\n\n" ); |
| 416 | 416 |
|
| ... | ... |
@@ -456,6 +456,7 @@ int main( int argCnt, char * * args ) |
| 456 | 456 |
format_channels = 0; |
| 457 | 457 |
format_colors = 0; |
| 458 | 458 |
device = "/dev/null"; |
| 459 |
+ serial_settings = 0; |
|
| 459 | 460 |
serial_settings_change = 0; |
| 460 | 461 |
reopen_device = 0; |
| 461 | 462 |
for( i = 1; i < argCnt; i++ ) |
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
/* BlinkenLib |
| 2 |
- * version 0.5.2 date 2006-05-10 |
|
| 3 |
- * Copyright 2004-2006 Stefan Schuermans <1stein@schuermans.info> |
|
| 2 |
+ * version 0.5.3 date 2007-12-28 |
|
| 3 |
+ * Copyright 2004-2007 Stefan Schuermans <stefan@schuermans.info> |
|
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| 6 | 6 |
*/ |
| ... | ... |
@@ -350,8 +350,8 @@ int main( int argCnt, char * * args ) |
| 350 | 350 |
|
| 351 | 351 |
//print info |
| 352 | 352 |
printf( "BlinkenLib - BlinkenOutput\n" |
| 353 |
- "version 0.5.2 date 2006-05-10\n" |
|
| 354 |
- "Copyright 2004-2006 Stefan Schuermans <1stein@schuermans.info>\n" |
|
| 353 |
+ "version 0.5.3 date 2007-12-28\n" |
|
| 354 |
+ "Copyright 2004-2007 Stefan Schuermans <stefan@schuermans.info>\n" |
|
| 355 | 355 |
"Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" |
| 356 | 356 |
"a blinkenarea.org project\n\n" ); |
| 357 | 357 |
|
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
/* BlinkenLib |
| 2 |
- * version 0.5.2 date 2006-05-10 |
|
| 3 |
- * Copyright 2004-2006 Stefan Schuermans <1stein@schuermans.info> |
|
| 2 |
+ * version 0.5.3 date 2007-12-28 |
|
| 3 |
+ * Copyright 2004-2007 Stefan Schuermans <stefan@schuermans.info> |
|
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| 6 | 6 |
*/ |
| ... | ... |
@@ -32,8 +32,8 @@ int main( int argCnt, char * * args ) |
| 32 | 32 |
|
| 33 | 33 |
//print info |
| 34 | 34 |
printf( "BlinkenLib - BlinkenRecv\n" |
| 35 |
- "version 0.5.2 date 2006-05-10\n" |
|
| 36 |
- "Copyright 2004-2006 Stefan Schuermans <1stein@schuermans.info>\n" |
|
| 35 |
+ "version 0.5.3 date 2007-12-28\n" |
|
| 36 |
+ "Copyright 2004-2007 Stefan Schuermans <stefan@schuermans.info>\n" |
|
| 37 | 37 |
"Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" |
| 38 | 38 |
"a blinkenarea.org project\n\n" ); |
| 39 | 39 |
|
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
/* BlinkenLib |
| 2 |
- * version 0.5.2 date 2006-05-10 |
|
| 3 |
- * Copyright 2004-2006 Stefan Schuermans <1stein@schuermans.info> |
|
| 2 |
+ * version 0.5.3 date 2007-12-28 |
|
| 3 |
+ * Copyright 2004-2007 Stefan Schuermans <stefan@schuermans.info> |
|
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| 6 | 6 |
*/ |
| ... | ... |
@@ -35,8 +35,8 @@ int main( int argCnt, char * * args ) |
| 35 | 35 |
|
| 36 | 36 |
//print info |
| 37 | 37 |
printf( "BlinkenLib - BlinkenSend\n" |
| 38 |
- "version 0.5.2 date 2006-05-10\n" |
|
| 39 |
- "Copyright 2004-2006 Stefan Schuermans <1stein@schuermans.info>\n" |
|
| 38 |
+ "version 0.5.3 date 2007-12-28\n" |
|
| 39 |
+ "Copyright 2004-2007 Stefan Schuermans <stefan@schuermans.info>\n" |
|
| 40 | 40 |
"Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" |
| 41 | 41 |
"a blinkenarea.org project\n\n" ); |
| 42 | 42 |
|
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
# BlinkenLib |
| 2 |
-# version 0.5.2 date 2006-05-10 |
|
| 3 |
-# Copyright 2004-2006 Stefan Schuermans <1stein@schuermans.info> |
|
| 2 |
+# version 0.5.3 date 2007-12-28 |
|
| 3 |
+# Copyright 2004-2007 Stefan Schuermans <stefan@schuermans.info> |
|
| 4 | 4 |
# Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
# a blinkenarea.org project |
| 6 | 6 |
|
| ... | ... |
@@ -15,7 +15,10 @@ RANLIB=ranlib |
| 15 | 15 |
|
| 16 | 16 |
all: BlinkenLib.a BlinkenConv BlinkenSend BlinkenRecv BlinkenOutput |
| 17 | 17 |
|
| 18 |
-BlinkenFrame.o: BlinkenFrame.c BlinkenFrame.h Tools.h |
|
| 18 |
+BlinkenColorizer.o: BlinkenColorizer.c BlinkenColorizer.h Tools.h |
|
| 19 |
+ $(CC) $(CFLAGS) -c -o BlinkenColorizer.o BlinkenColorizer.c |
|
| 20 |
+ |
|
| 21 |
+BlinkenFrame.o: BlinkenFrame.c BlinkenFrame.h BlinkenColorizer.h Tools.h |
|
| 19 | 22 |
$(CC) $(CFLAGS) -c -o BlinkenFrame.o BlinkenFrame.c |
| 20 | 23 |
|
| 21 | 24 |
BlinkenMovie.o: BlinkenMovie.c BlinkenFrame.h BlinkenMovie.h Tools.h |
| ... | ... |
@@ -24,8 +27,8 @@ BlinkenMovie.o: BlinkenMovie.c BlinkenFrame.h BlinkenMovie.h Tools.h |
| 24 | 27 |
Tools.o: Tools.c Tools.h |
| 25 | 28 |
$(CC) $(CFLAGS) -c -o Tools.o Tools.c |
| 26 | 29 |
|
| 27 |
-BlinkenLib.a: BlinkenFrame.o BlinkenMovie.o Tools.o |
|
| 28 |
- $(AR) $(ARFLAGS) BlinkenLib.a BlinkenFrame.o BlinkenMovie.o Tools.o |
|
| 30 |
+BlinkenLib.a: BlinkenColorizer.o BlinkenFrame.o BlinkenMovie.o Tools.o |
|
| 31 |
+ $(AR) $(ARFLAGS) BlinkenLib.a BlinkenColorizer.o BlinkenFrame.o BlinkenMovie.o Tools.o |
|
| 29 | 32 |
$(RANLIB) BlinkenLib.a |
| 30 | 33 |
|
| 31 | 34 |
BlinkenConv.o: BlinkenConv.c BlinkenLib.h |
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
/* BlinkenLib |
| 2 |
- * version 0.5.2 date 2006-05-10 |
|
| 3 |
- * Copyright 2004-2006 Stefan Schuermans <1stein@schuermans.info> |
|
| 2 |
+ * version 0.5.3 date 2007-12-28 |
|
| 3 |
+ * Copyright 2004-2007 Stefan Schuermans <stefan@schuermans.info> |
|
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| 6 | 6 |
*/ |
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
/* BlinkenLib |
| 2 |
- * version 0.5.2 date 2006-05-10 |
|
| 3 |
- * Copyright 2004-2006 Stefan Schuermans <1stein@schuermans.info> |
|
| 2 |
+ * version 0.5.3 date 2007-12-28 |
|
| 3 |
+ * Copyright 2004-2007 Stefan Schuermans <stefan@schuermans.info> |
|
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| 6 | 6 |
*/ |
| ... | ... |
@@ -8,6 +8,8 @@ |
| 8 | 8 |
#ifndef INC_Tools |
| 9 | 9 |
#define INC_Tools |
| 10 | 10 |
|
| 11 |
+#define arr_cnt( arr ) (sizeof( (arr) ) / sizeof( (arr)[0] )) |
|
| 12 |
+ |
|
| 11 | 13 |
void * malloc1D( int count1, int size ); |
| 12 | 14 |
|
| 13 | 15 |
void * * malloc2D( int count1, int count2, int size ); |
| 14 | 16 |