summaryrefslogtreecommitdiff
path: root/src/palette.cpp
diff options
context:
space:
mode:
authorMike Buland <mike@xagasoft.com>2015-04-08 08:40:05 -0600
committerMike Buland <mike@xagasoft.com>2015-04-08 08:40:05 -0600
commitf314041b6b37bb9274d9fc79946858341befa0f2 (patch)
tree3ad385b2bdedeb367ae8b26341d7044c340dc153 /src/palette.cpp
parent518619603ab3c49b7fdfcf19c439c1a30668164f (diff)
downloadlost-f314041b6b37bb9274d9fc79946858341befa0f2.tar.gz
lost-f314041b6b37bb9274d9fc79946858341befa0f2.tar.bz2
lost-f314041b6b37bb9274d9fc79946858341befa0f2.tar.xz
lost-f314041b6b37bb9274d9fc79946858341befa0f2.zip
Added image goo + font support.
Diffstat (limited to 'src/palette.cpp')
-rw-r--r--src/palette.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/palette.cpp b/src/palette.cpp
new file mode 100644
index 0000000..0e3a3b1
--- /dev/null
+++ b/src/palette.cpp
@@ -0,0 +1,32 @@
1#include "palette.h"
2
3#include <string.h>
4
5Palette::Palette() :
6 iCount( 0 ),
7 piChannels( NULL )
8{
9 piChannels = new uint8_t[256*3];
10 memset( piChannels, 0, 256*3 );
11}
12
13Palette::~Palette()
14{
15 delete[] piChannels;
16}
17
18int32_t Palette::addColor( uint8_t iRed, uint8_t iGreen, uint8_t iBlue )
19{
20 piChannels[iCount*3] = iRed;
21 piChannels[iCount*3+1] = iGreen;
22 piChannels[iCount*3+2] = iBlue;
23 return iCount++;
24}
25
26void Palette::getColor( int32_t iIdx, uint8_t &iRed, uint8_t &iGreen,
27 uint8_t &iBlue )
28{
29 iRed = piChannels[iIdx*3];
30 iGreen = piChannels[iIdx*3+1];
31 iBlue = piChannels[iIdx*3+2];
32}