c9469b64fc3933d0565ffba8a45be8a39df6b927
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,
BlinkenLib/BlinkenColorizer.c 13)                                     int c)
Christian Heimke BlinkenLib v.0.5.3 (2007-12...

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 11 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c 39) unsigned char BlinkenColorizerRainbow(int step, int channels, int y, int x,
BlinkenLib/BlinkenColorizer.c 40)                                       int c)
Christian Heimke BlinkenLib v.0.5.3 (2007-12...

Christian Heimke authored 13 years ago

BlinkenColorizer.c            41) {
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c 42)   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            43) }
BlinkenColorizer.c            44) 
BlinkenColorizer.c            45) // type describing a colorizing modes
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c 46) typedef struct _BlinkenColorizingModeDesc {
BlinkenLib/BlinkenColorizer.c 47)   const char *name;
BlinkenLib/BlinkenColorizer.c 48)   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            49) } BlinkenColorizingModeDesc;
BlinkenColorizer.c            50) 
BlinkenColorizer.c            51) // supported colorizing modes
BlinkenColorizer.c            52) static const BlinkenColorizingModeDesc BlinkenColorizingModeDescs[] = {
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

BlinkenColorizer.c            55) };
BlinkenColorizer.c            56) 
BlinkenColorizer.c            57) // convert string to colorizing mode
BlinkenColorizer.c            58) // returns colorizing mode (>= 0) or -1 on error
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

BlinkenColorizer.c            60) {
BlinkenColorizer.c            61)   unsigned int i;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

BlinkenColorizer.c            66)     return i;
BlinkenColorizer.c            67)   return -1;
BlinkenColorizer.c            68) }
BlinkenColorizer.c            69) 
BlinkenColorizer.c            70) // convert colorizing mode to string
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c 71) const char *BlinkenColorizerMode2Str(int mode)
Christian Heimke BlinkenLib v.0.5.3 (2007-12...

Christian Heimke authored 13 years ago

BlinkenColorizer.c            72) {
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c 73)   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            74)     return "(unknown)";
BlinkenColorizer.c            75)   return BlinkenColorizingModeDescs[mode].name;
BlinkenColorizer.c            76) }
BlinkenColorizer.c            77) 
BlinkenColorizer.c            78) // get color for colorizing
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c 79) unsigned char BlinkenColorizerGetColor(int channels, int mode, int step,
BlinkenLib/BlinkenColorizer.c 80)                                        int y, int x, int c)
Christian Heimke BlinkenLib v.0.5.3 (2007-12...

Christian Heimke authored 13 years ago

BlinkenColorizer.c            81) {
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenColorizer.c 82)   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            83)     return 255;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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