25 uint8_t r, g, b, _padding;
26 bool operator==(
const Color& rhs)
const {
return r == rhs.r && g == rhs.g && b == rhs.b; }
34 return r == rhs.r && g == rhs.g && b == rhs.b;
37 static const size_t colorCount = 256;
38 std::array<Color, colorCount> colors;
40 bool decode(
const char* filename);
42 uint8_t GetClosestColorIndex(
Color color);
43 bool operator==(
const Palette& rhs)
const {
return colors == rhs.colors; }
48 std::array<uint8_t, Palette::colorCount> indices;
52 return palette.colors[indices[colorIndex]];
55 void GetTranformedPalette(
Palette& outputPalette,
const Palette& basePalette)
const
57 for (
size_t i = 0; i < Palette::colorCount; i++)
59 outputPalette.colors[i] = basePalette.colors[indices[i]];
92 static std::unique_ptr<PL2> CreateFromPalette(
const Palette& palette);
93 static std::unique_ptr<PL2> ReadFromStream(
IStream* stream);
An interface for a stream of data.
PalShiftTransform additiveBlend[256]
glBlendFunc(GL_ONE, GL_ONE)
PalShiftTransform alphaBlend[3][256]
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
PalShiftTransform multiplicativeBlend[256]
glBlendFunc(GL_ZERO, GL_SRC_COLOR)
Precomputed palette variations in the form of palette shifts.
PalShiftTransform selectedUnitShift
Needs confirmation for usage.
Helper to load a Diablo 2 palette (.pal/.dat format)