860e91ba85e0070b3deb854f8a8e9952bceca480
Stefan Schuermans cleanup file headers after...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c  1) /* BlinkenLib
Stefan Schuermans update email address of author

Stefan Schuermans authored 10 years ago

BlinkenLib/BlinkenColorizer.c  2)    Copyright 2004-2014 Stefan Schuermans <stefan@schuermans.info>
Stefan Schuermans cleanup file headers after...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c  3)    Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
BlinkenLib/BlinkenColorizer.c  4)    a blinkenarea.org project */
Christian Heimke BlinkenLib v.0.5.3 (2007-12...

Christian Heimke authored 13 years ago

BlinkenColorizer.c             5) 
BlinkenColorizer.c             6) #include <string.h>
BlinkenColorizer.c             7) 
Christian Heimke BlinkenLib v.0.5.5 (2008-03...

Christian Heimke authored 13 years ago

BlinkenLib/BlinkenColorizer.c  8) #include <BlinkenLib/BlinkenColorizer.h>
Christian Heimke BlinkenLib v.0.5.3 (2007-12...

Christian Heimke authored 13 years ago

BlinkenColorizer.c             9) 
Stefan Schuermans restructure directories

Stefan Schuermans authored 5 years ago

src/BlinkenColorizer.c        10) #include "Tools.h"
src/BlinkenColorizer.c        11) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c 12) unsigned char BlinkenColorizerSolid(int step, int channels, int y, int x,
Stefan Schuermans format

Stefan Schuermans authored 1 year ago

src/BlinkenColorizer.c        13)                                     int c) {
Christian Heimke BlinkenLib v.0.5.3 (2007-12...

Christian Heimke authored 13 years ago

BlinkenColorizer.c            14)   int substep, updown, chan;
BlinkenColorizer.c            15)   step %= channels * 2 * 254;
BlinkenColorizer.c            16)   substep = step % 254;
BlinkenColorizer.c            17)   updown = (step / 254) % 2;
BlinkenColorizer.c            18)   chan = (step / 254) / 2;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c 19)   if (updown == 0) {
BlinkenLib/BlinkenColorizer.c 20)     if (c == chan)
Christian Heimke BlinkenLib v.0.5.3 (2007-12...

Christian Heimke authored 13 years ago

BlinkenColorizer.c            21)       return 255;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c 22)     else if (c == (chan + 1) % channels)
Christian Heimke BlinkenLib v.0.5.3 (2007-12...

Christian Heimke authored 13 years ago

BlinkenColorizer.c            23)       return substep;
BlinkenColorizer.c            24)     else
BlinkenColorizer.c            25)       return 0;
BlinkenColorizer.c            26)   } else {
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c 27)     if (c == chan)
Christian Heimke BlinkenLib v.0.5.3 (2007-12...

Christian Heimke authored 13 years ago

BlinkenColorizer.c            28)       return 255 - substep;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c 29)     else if (c == (chan + 1) % channels)
Christian Heimke BlinkenLib v.0.5.3 (2007-12...

Christian Heimke authored 13 years ago

BlinkenColorizer.c            30)       return 255;
BlinkenColorizer.c            31)     else
BlinkenColorizer.c            32)       return 0;
BlinkenColorizer.c            33)   }
Stefan Schuermans implemented rotationg and m...

Stefan Schuermans authored 11 years ago

BlinkenLib/BlinkenColorizer.c 34)   (void)x; // keep compiler quiet
BlinkenLib/BlinkenColorizer.c 35)   (void)y; // keep compiler quiet
Christian Heimke BlinkenLib v.0.5.3 (2007-12...

Christian Heimke authored 13 years ago

BlinkenColorizer.c            36) }
BlinkenColorizer.c            37) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c 38) unsigned char BlinkenColorizerRainbow(int step, int channels, int y, int x,
Stefan Schuermans format

Stefan Schuermans authored 1 year ago

src/BlinkenColorizer.c        39)                                       int c) {
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c 40)   return BlinkenColorizerSolid(step + ((x + y) * 64), channels, y, x, c);
Christian Heimke BlinkenLib v.0.5.3 (2007-12...

Christian Heimke authored 13 years ago

BlinkenColorizer.c            41) }
BlinkenColorizer.c            42) 
BlinkenColorizer.c            43) // type describing a colorizing modes
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c 44) typedef struct _BlinkenColorizingModeDesc {
BlinkenLib/BlinkenColorizer.c 45)   const char *name;
Stefan Schuermans format

Stefan Schuermans authored 1 year ago

src/BlinkenColorizer.c        46)   unsigned char (*func)(int step, int channels, int y, int x, int c);
Christian Heimke BlinkenLib v.0.5.3 (2007-12...

Christian Heimke authored 13 years ago

BlinkenColorizer.c            47) } BlinkenColorizingModeDesc;
BlinkenColorizer.c            48) 
BlinkenColorizer.c            49) // supported colorizing modes
BlinkenColorizer.c            50) static const BlinkenColorizingModeDesc BlinkenColorizingModeDescs[] = {
Stefan Schuermans format

Stefan Schuermans authored 1 year ago

src/BlinkenColorizer.c        51)     {"solid", BlinkenColorizerSolid},
src/BlinkenColorizer.c        52)     {"rainbow", BlinkenColorizerRainbow},
Christian Heimke BlinkenLib v.0.5.3 (2007-12...

Christian Heimke authored 13 years ago

BlinkenColorizer.c            53) };
BlinkenColorizer.c            54) 
BlinkenColorizer.c            55) // convert string to colorizing mode
BlinkenColorizer.c            56) // returns colorizing mode (>= 0) or -1 on error
Stefan Schuermans format

Stefan Schuermans authored 1 year ago

src/BlinkenColorizer.c        57) int BlinkenColorizerStr2Mode(const char *str) {
Christian Heimke BlinkenLib v.0.5.3 (2007-12...

Christian Heimke authored 13 years ago

BlinkenColorizer.c            58)   unsigned int i;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c 59)   for (i = 0; i < arr_cnt(BlinkenColorizingModeDescs); i++)
BlinkenLib/BlinkenColorizer.c 60)     if (strcmp(str, BlinkenColorizingModeDescs[i].name) == 0)
Christian Heimke BlinkenLib v.0.5.3 (2007-12...

Christian Heimke authored 13 years ago

BlinkenColorizer.c            61)       break;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c 62)   if (i < arr_cnt(BlinkenColorizingModeDescs))
Christian Heimke BlinkenLib v.0.5.3 (2007-12...

Christian Heimke authored 13 years ago

BlinkenColorizer.c            63)     return i;
BlinkenColorizer.c            64)   return -1;
BlinkenColorizer.c            65) }
BlinkenColorizer.c            66) 
BlinkenColorizer.c            67) // convert colorizing mode to string
Stefan Schuermans format

Stefan Schuermans authored 1 year ago

src/BlinkenColorizer.c        68) const char *BlinkenColorizerMode2Str(int mode) {
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c 69)   if (mode < 0 || mode >= (int)arr_cnt(BlinkenColorizingModeDescs))
Christian Heimke BlinkenLib v.0.5.3 (2007-12...

Christian Heimke authored 13 years ago

BlinkenColorizer.c            70)     return "(unknown)";
BlinkenColorizer.c            71)   return BlinkenColorizingModeDescs[mode].name;
BlinkenColorizer.c            72) }
BlinkenColorizer.c            73) 
BlinkenColorizer.c            74) // get color for colorizing
Stefan Schuermans format

Stefan Schuermans authored 1 year ago

src/BlinkenColorizer.c        75) unsigned char BlinkenColorizerGetColor(int channels, int mode, int step, int y,
src/BlinkenColorizer.c        76)                                        int x, int c) {
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c 77)   if (mode < 0 || mode >= (int)arr_cnt(BlinkenColorizingModeDescs))
Christian Heimke BlinkenLib v.0.5.3 (2007-12...

Christian Heimke authored 13 years ago

BlinkenColorizer.c            78)     return 255;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c 79)   return BlinkenColorizingModeDescs[mode].func(step, channels, y, x, c);