22 #ifndef SCI_GRAPHICS_PALETTE32_H 23 #define SCI_GRAPHICS_PALETTE32_H 25 #include "common/ptr.h" 29 #pragma mark HunkPalette 43 static uint32 calculateHunkPaletteSize(
const uint16 numIndexes = 256,
const bool sharedUsed =
true) {
44 const int numPalettes = 1;
45 return kHunkPaletteHeaderSize +
48 (kEntryHeaderSize + numIndexes * ( 3 + !sharedUsed)) * numPalettes;
73 kNumPaletteEntriesOffset = 10,
78 kHunkPaletteHeaderSize = 13,
90 kEntryStartColorOffset = 10,
95 kEntryNumColorsOffset = 14,
101 kEntryUsedOffset = 16,
108 kEntrySharedUsedOffset = 17,
114 kEntryVersionOffset = 18
152 mutable uint32 _version;
169 const EntryHeader getEntryHeader()
const;
175 return _data.subspan(kHunkPaletteHeaderSize + (2 * _numPalettes));
180 #pragma mark PalCycler 182 enum PalCyclerDirection {
183 kPalCycleBackward = 0,
232 #pragma mark GfxPalette32 259 bool loadPalette(
const GuiResourceId resourceId);
265 int16 matchColor(
const uint8 r,
const uint8 g,
const uint8 b);
270 uint8 getPlatformBlack()
const;
275 uint8 getPlatformWhite()
const;
281 void submit(
const Palette &palette);
288 bool updateForFrame();
301 void updateHardware();
322 uint8 _hardwarePalette[256 * 3];
346 Palette getPaletteFromResource(
const GuiResourceId paletteId)
const;
372 void setVary(
const Palette &target,
const int16 percent,
const int32 ticks,
const int16 fromColor,
const int16 toColor);
383 void setVaryPercent(
const int16 percent,
const int32 time);
389 void setVaryTime(
const int32 ticks);
394 void setVaryTime(
const int16 percent,
const int32 ticks);
414 void setTarget(
const Palette &palette);
419 void setStart(
const Palette &palette);
424 void mergeStart(
const Palette &palette);
429 void mergeTarget(
const Palette &palette);
436 void kernelPalVarySet(
const GuiResourceId paletteId,
const int16 percent,
const int32 ticks,
const int16 fromColor,
const int16 toColor);
437 void kernelPalVaryMergeTarget(
const GuiResourceId paletteId);
438 void kernelPalVarySetTarget(
const GuiResourceId paletteId);
439 void kernelPalVarySetStart(
const GuiResourceId paletteId);
440 void kernelPalVaryMergeStart(
const GuiResourceId paletteId);
441 void kernelPalVaryPause(
const bool pause);
460 uint8 _varyFromColor;
470 uint32 _varyLastTick;
481 int16 _varyDirection;
493 int16 _varyTargetPercent;
498 uint16 _varyNumTimesPaused;
503 inline const bool *getCycleMap()
const {
return _cycleMap; }
517 void setCycle(
const uint8 fromColor,
const uint8 toColor,
const int16 direction,
const int16 delay);
525 void doCycle(
const uint8 fromColor,
const int16 speed);
530 void cycleOn(
const uint8 fromColor);
535 void cyclePause(
const uint8 fromColor);
545 void cycleAllPause();
550 void cycleOff(
const uint8 fromColor);
563 PalCyclerOwner _cyclers[kNumCyclers];
568 void updateCycler(
PalCycler &cycler,
const int16 speed);
587 void clearCycleMap(
const uint16 fromColor,
const uint16 numColorsToClear);
593 void setCycleMap(
const uint16 fromColor,
const uint16 numColorsToClear);
599 PalCycler *getCycler(
const uint16 fromColor);
605 void applyAllCycles();
620 void setFade(
const uint16 percent,
const uint8 fromColor,
const uint16 toColor);
636 uint16 _fadeTable[256];
639 #pragma mark Gamma correction 653 _gammaLevel = CLIP<int16>(level, 0, numGammaTables) - 1;
654 _gammaChanged =
true;
672 #endif // SCI_GRAPHICS_PALETTE32_H int16 getVaryPercent() const
Definition: palette32.h:377
void setGamma(const int16 level)
Definition: palette32.h:652
const Palette & getNextPalette() const
Definition: palette32.h:243
uint16 numColorsToCycle
Definition: palette32.h:200
Definition: palette32.h:37
Definition: palette32.h:190
PalCyclerDirection direction
Definition: palette32.h:210
Definition: serializer.h:79
uint32 lastUpdateTick
Definition: palette32.h:215
void setVersion(const uint32 version) const
const Palette toPalette() const
Definition: resource.h:327
int16 delay
Definition: palette32.h:223
Definition: palette32.h:234
uint16 numTimesPaused
Definition: palette32.h:228
uint32 getVersion() const
Definition: palette32.h:55
const uint8 * getHardwarePalette() const
Definition: palette32.h:254
uint8 fromColor
Definition: palette32.h:195
Definition: helpers.h:247
T ABS(T x)
Definition: util.h:58
uint8 currentCycle
Definition: palette32.h:205
const Palette & getCurrentPalette() const
Definition: palette32.h:248