blob: 0e3a3b166020d5776d4b6f0ecf7ef51edf807779 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include "palette.h"
#include <string.h>
Palette::Palette() :
iCount( 0 ),
piChannels( NULL )
{
piChannels = new uint8_t[256*3];
memset( piChannels, 0, 256*3 );
}
Palette::~Palette()
{
delete[] piChannels;
}
int32_t Palette::addColor( uint8_t iRed, uint8_t iGreen, uint8_t iBlue )
{
piChannels[iCount*3] = iRed;
piChannels[iCount*3+1] = iGreen;
piChannels[iCount*3+2] = iBlue;
return iCount++;
}
void Palette::getColor( int32_t iIdx, uint8_t &iRed, uint8_t &iGreen,
uint8_t &iBlue )
{
iRed = piChannels[iIdx*3];
iGreen = piChannels[iIdx*3+1];
iBlue = piChannels[iIdx*3+2];
}
|