Skip to content

Commit

Permalink
Cleanup tab characters
Browse files Browse the repository at this point in the history
  • Loading branch information
bportaluri committed Jan 5, 2018
1 parent 543e6b3 commit 6bed360
Show file tree
Hide file tree
Showing 6 changed files with 800 additions and 807 deletions.
13 changes: 3 additions & 10 deletions src/Ala.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,11 @@ AlaColor alaPalHeat_[] =
};
AlaPalette alaPalHeat = { 4, alaPalHeat_ };

/*
AlaColor alaPalFire_[] =
{
0x000000, 0x440000,
0x990000, 0xFF0000,
0xFF6600, 0xFFCC00
};
*/

AlaColor alaPalFire_[] =
{
0x000000, 0x220000,
0x880000, 0xFF0000,
0x000000, 0x220000,
0x880000, 0xFF0000,
0xFF6600, 0xFFCC00
};
AlaPalette alaPalFire = { 6, alaPalFire_ };
Expand Down
26 changes: 13 additions & 13 deletions src/Ala.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ struct AlaColor
};
uint8_t raw[3];
};

inline AlaColor() __attribute__((always_inline))
{
}

// allow construction from R, G, B
inline AlaColor( uint8_t ir, uint8_t ig, uint8_t ib) __attribute__((always_inline))
: r(ir), g(ig), b(ib)
Expand All @@ -111,8 +111,8 @@ struct AlaColor
: r((colorcode >> 16) & 0xFF), g((colorcode >> 8) & 0xFF), b((colorcode >> 0) & 0xFF)
{
}
bool operator == (const AlaColor &c) const

bool operator == (const AlaColor &c) const
{
return(this->r == c.r and this->g == c.g and this->b == c.b);
}
Expand All @@ -137,16 +137,16 @@ struct AlaColor
int b0 = x*(color.b - b) + b;
return AlaColor(r0, g0, b0);
}

AlaColor scale(float k)
{
int r0 = min(r*k, 255);
int g0 = min(g*k, 255);
int b0 = min(b*k, 255);
return AlaColor(r0, g0, b0);
}


typedef enum {
Aqua = 0x00FFFF,
Black = 0x000000,
Expand Down Expand Up @@ -177,7 +177,7 @@ struct AlaPalette
{
int numColors;
AlaColor *colors;

/**
* Get the interpolated color from the palette.
* The argument is a floating number between 0 and numColors.
Expand All @@ -186,27 +186,27 @@ struct AlaPalette
{
int i0 = (int)i%(numColors);
int i1 = (int)(i+1)%(numColors);

// decimal part is used to interpolate between the two colors
float t0 = i - trunc(i);
//float t0 = i - (int)i;

return colors[i0].interpolate(colors[i1], t0);
}
bool operator == (const AlaPalette &c) const

bool operator == (const AlaPalette &c) const
{
if (!(this->numColors == c.numColors))
return false;

for(int i=0; i<numColors; i++)
{
if (!(this->colors[i] == c.colors[i]))
return false;
}
return true;
}

};


Expand Down
Loading

0 comments on commit 6bed360

Please sign in to comment.