22 #ifndef MADS_PALETTE_H 23 #define MADS_PALETTE_H 25 #include "common/scummsys.h" 26 #include "common/stream.h" 32 #define PALETTE_USAGE_COUNT 4 34 #define PALETTE_RESERVED_LOW_COUNT 18 35 #define PALETTE_RESERVED_HIGH_COUNT 10 37 #define PALETTE_COUNT 256 39 #define PALETTE_SIZE (256 * 3) 45 PALFLAG_BACKGROUND = 0x8000,
46 PALFLAG_RESERVED = 0x4000,
47 PALFLAG_ANY_TO_CLOSEST = 0x2000,
48 PALFLAG_ALL_TO_CLOSEST = 0x1000,
49 PALFLAG_TOP_COLORS = 0x0800,
50 PALFLAG_DEFINE_RESERVED = 0x0400,
57 byte _firstColorIndex;
60 PaletteCycle() { _colorCount = _firstListColor = _firstColorIndex = _ticks = 0; }
83 UsageEntry(
int palIndex) { _palIndex = palIndex; _sortValue = -1; }
84 UsageEntry() { _palIndex = 0; _sortValue = 0; }
89 UsageRange(byte v1, byte v2) { _v1 = v1; _v2 = v2; }
95 int getGamePalFreeIndex(
int *palIndex);
97 int rgbFactor(byte *palEntry,
RGB6 &pal6);
111 bool empty()
const {
return _data ==
nullptr; }
113 uint16 &operator[](
int index) {
return (*_data)[index]._palIndex; }
138 void resetPalFlags(
int idx);
140 int checkRGB(
const byte *rgb,
int palStart,
bool flag,
int *palIndex);
163 bool &operator[](
int idx) {
return _data[idx]; }
174 void mapToGreyRamp(byte palette[PALETTE_SIZE],
int baseColor,
int numColors,
175 int baseGrey,
int numGreys,
GreyEntry *map);
177 void getGreyValues(
const byte palette[PALETTE_SIZE], byte greyList[PALETTE_COUNT],
178 int baseColor,
int numColors);
184 void greyPopularity(
const byte greyList[PALETTE_COUNT], byte greyTable[64],
int numColors);
189 void insertionSort(
int size, byte *
id, byte *value);
192 byte _rgb64Map[PALETTE_COUNT];
205 void setPalette(
const byte *colors, uint start, uint num);
210 void grabPalette(byte *colors, uint start, uint num);
215 void getFullPalette(byte palette[PALETTE_SIZE]);
220 void setFullPalette(byte palette[PALETTE_SIZE]);
225 int rgbMerge(byte r, byte g, byte b);
230 int rgbMerge(
RGB6 &palEntry);
235 void fadeOut(byte palette[PALETTE_SIZE], byte *paletteMap,
236 int baseColor,
int numColors,
int baseGrey,
int numGreys,
237 int tickDelay,
int steps);
242 void fadeIn(byte palette[PALETTE_SIZE], byte destPalette[PALETTE_SIZE],
243 int baseColor,
int numColors,
int baseGrey,
int numGreys,
244 int tickDelay,
int steps);
253 void initVGAPalette(byte *palette);
255 byte _mainPalette[PALETTE_SIZE];
256 byte _cyclingPalette[PALETTE_SIZE];
257 uint32 _palFlags[PALETTE_COUNT];
277 void setEntry(byte palIndex, byte r, byte g, byte b);
283 uint8 palIndexFromRgb(byte r, byte g, byte b, byte *paletteData =
nullptr);
288 void setSystemPalette();
293 static void setGradient(byte *palette,
int start,
int count,
int rgbValue1,
int rgbValue2);
298 void resetGamePalette(
int lowRange,
int highRange);
310 void setColorFlags(byte r, byte g, byte b);
311 void setColorValues(byte r, byte g, byte b);
316 void refreshSceneColors();
318 static int closestColor(
const byte *matchColor,
const byte *refPalette,
319 int paletteInc,
int count);
void setEmpty()
Definition: palette.h:118
Definition: palette.h:143
Out copy(In first, In last, Out dst)
Definition: algorithm.h:52
virtual ~Palette()
Definition: palette.h:272
Definition: palette.h:166
Definition: palette.h:168
bool empty() const
Definition: palette.h:111
Definition: palette.h:247