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 255 inline const uint8 *getHardwarePalette()
const {
return _hardwarePalette; };
261 bool loadPalette(
const GuiResourceId resourceId);
267 int16 matchColor(
const uint8 r,
const uint8 g,
const uint8 b);
272 uint8 getPlatformBlack()
const;
277 uint8 getPlatformWhite()
const;
283 void submit(
const Palette &palette);
290 bool updateForFrame();
303 void updateHardware();
325 uint8 _hardwarePalette[256 * 3];
350 Palette getPaletteFromResource(
const GuiResourceId paletteId)
const;
376 void setVary(
const Palette &target,
const int16 percent,
const int32 ticks,
const int16 fromColor,
const int16 toColor);
387 void setVaryPercent(
const int16 percent,
const int32 time);
393 void setVaryTime(
const int32 ticks);
398 void setVaryTime(
const int16 percent,
const int32 ticks);
418 void setTarget(
const Palette &palette);
423 void setStart(
const Palette &palette);
428 void mergeStart(
const Palette &palette);
433 void mergeTarget(
const Palette &palette);
440 void kernelPalVarySet(
const GuiResourceId paletteId,
const int16 percent,
const int32 ticks,
const int16 fromColor,
const int16 toColor);
441 void kernelPalVaryMergeTarget(
const GuiResourceId paletteId);
442 void kernelPalVarySetTarget(
const GuiResourceId paletteId);
443 void kernelPalVarySetStart(
const GuiResourceId paletteId);
444 void kernelPalVaryMergeStart(
const GuiResourceId paletteId);
445 void kernelPalVaryPause(
const bool pause);
464 uint8 _varyFromColor;
474 uint32 _varyLastTick;
485 int16 _varyDirection;
497 int16 _varyTargetPercent;
502 uint16 _varyNumTimesPaused;
507 inline const bool *getCycleMap()
const {
return _cycleMap; }
521 void setCycle(
const uint8 fromColor,
const uint8 toColor,
const int16 direction,
const int16 delay);
529 void doCycle(
const uint8 fromColor,
const int16 speed);
534 void cycleOn(
const uint8 fromColor);
539 void cyclePause(
const uint8 fromColor);
549 void cycleAllPause();
554 void cycleOff(
const uint8 fromColor);
567 PalCyclerOwner _cyclers[kNumCyclers];
572 void updateCycler(
PalCycler &cycler,
const int16 speed);
591 void clearCycleMap(
const uint16 fromColor,
const uint16 numColorsToClear);
597 void setCycleMap(
const uint16 fromColor,
const uint16 numColorsToClear);
603 PalCycler *getCycler(
const uint16 fromColor);
609 void applyAllCycles();
624 void setFade(
const uint16 percent,
const uint8 fromColor,
const uint16 toColor);
640 uint16 _fadeTable[256];
643 #pragma mark Gamma correction 657 _gammaLevel = CLIP<int16>(level, 0, numGammaTables) - 1;
658 _gammaChanged =
true;
676 #endif // SCI_GRAPHICS_PALETTE32_H int16 getVaryPercent() const
Definition: palette32.h:381
void setGamma(const int16 level)
Definition: palette32.h:656
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
uint8 fromColor
Definition: palette32.h:195
Definition: helpers.h:247
T ABS(T x)
Definition: util.h:56
uint8 currentCycle
Definition: palette32.h:205
const Palette & getCurrentPalette() const
Definition: palette32.h:248