-
Notifications
You must be signed in to change notification settings - Fork 0
/
corona_palette.h
73 lines (59 loc) · 1.6 KB
/
corona_palette.h
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
* This file is released under the GNU General Public Licence
*
* authors:
* Richard Ashbury <richard.asbury@btinternet.com>
* Jean-Christophe Hoelt <jeko@ios-software.com>
*/
#ifndef _PALETTE_H
#define _PALETTE_H
#define NB_PALETTES 30
#include "corona_types.h"
// PALETTE
//
typedef ColorRGB Palette[256];
class CompressedPalette;
// COLLECTION OF PALETTES
//
// Definition of some palettes stored in compressed format.
//
class PaletteCollection
{
public:
PaletteCollection(const int palettes[][NB_PALETTES], int nbPalettes);
~PaletteCollection();
int size() const { return m_nbPalettes; }
void expandPalette(int i, Palette dest) const;
private:
CompressedPalette *m_cpal;
int m_nbPalettes;
};
// PALETTE CYCLER
//
// A class to create cycling palettes.
//
class PaletteCycler
{
private:
Palette m_srcpal;
Palette m_destpal;
Palette m_curpal;
PaletteCollection m_palettes;
int m_srcnum, m_destnum;
bool m_transferring;
double m_progress;
void startPaletteTransition();
void affectPaletteTransition(double p);
public:
PaletteCycler(const int palettes[][NB_PALETTES], int nbPalettes);
void update(TimedLevel *pLevels);
const Palette &getPalette() const { return m_curpal; }
};
// PALETTE CONVERSIOn
//
// Display/Architecture specific routines to convert Palette to int[] (hardware color)
//
void paletteToRGBA(int dest[256], const Palette src);
// BLIT A PALETTIZED SURFACE using converted palette.
void blitSurface8To32(unsigned char *byteSurf, int *colorSurf, int palette[256], int size);
#endif