71 _name(name), _surface(0) {
92 assert((layer >= 0) && (layer <
kLayerMAX));
104 AuroraFile::readHeader(plt);
120 if ((plt.
size() - plt.
pos()) < (2 * width * height))
125 size_t size = width * height;
161 for (
size_t i = 0; i < pixels; i++, image++, layer++, dst += 4)
162 memcpy(dst, rows + (*layer * 4 * 256) + (*image * 4), 4);
189 if (palette->getMipMapCount() < 1)
194 if (mipMap.
width != 256)
204 for (
size_t i = 0; i <
kLayerMAX; i++, rows += 4 * 256) {
209 const uint8 row = palette->getMipMap(0).height - 1 - colors[i];
212 memcpy(rows, palette->getMipMap(0).data.
get() + (row * 4 * 256), 4 * 256);
216 for (
size_t p = 0; p < 256; p++) {
218 rows[p * 4 + 1] = 0x00;
220 rows[p * 4 + 3] = 0xFF;
#define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like 'DATA', to ensure portability.
Generic image decoder interface.
uint32 readUint32LE()
Read an unsigned 32-bit word stored in little endian (LSB first) order from the stream and return it...
static const uint32 kVersion1
A class holding an UTF-8 string.
Common::ScopedArray< uint8 > _dataLayers
void reset(PointerType o=0)
Resets the pointer with the new value.
PointerType release()
Returns the plain pointer value and releases ScopedPtr.
Common::ScopedArray< uint8 > _dataImage
void fill(byte r, byte g, byte b, byte a)
static void getColorRows(byte rows[4 *256 *kLayerMAX], const uint8 colors[kLayerMAX])
Utility templates and functions for working with strings and streams.
int height
The mip map's height.
Exception that provides a stack of explanations.
static const uint32 kPLTID
void exceptionDispatcherWarning(const char *s,...)
Exception dispatcher that prints the exception as a warning, and adds another reason on top...
Basic exceptions to throw.
static ImageDecoder * loadImage(const Common::UString &name, bool deswizzle=false)
Load an image in any of the common texture formats.
virtual size_t skip(ptrdiff_t offset)
Skip the specified number of bytes, adding that offset to the current position in the stream...
static ImageDecoder * getLayerPalette(uint32 layer, uint8 row)
Load a specific layer palette image and perform some sanity checks.
void setLayerColor(Layer layer, uint8 color)
Set the color of one layer within this layer texture.
uint32 _id
The file's ID.
A scoped plain pointer, allowing pointer-y access and normal deletion.
uint32 _version
The file's version.
virtual size_t size() const =0
Obtains the total size of the stream, measured in bytes.
Basic reading stream interfaces.
virtual size_t pos() const =0
Obtains the current value of the stream position indicator of the stream.
PointerType get() const
Returns the plain pointer value.
int width
The mip map's width.
An image surface, in BGRA format.
bool reload()
Try to reload the texture.
static const char *const kPalettes[PLTFile::kLayerMAX]
The palette image resource names for all layers.
UString debugTag(uint32 tag, bool trim)
Create an elaborate string from an integer tag, for debugging purposes.
A generic interface for image decoders.
bool isDynamic() const
Is this a dynamic texture, or a shared static one?
void load(Common::SeekableReadStream &plt)
Interface for a seekable & readable data stream.
byte readByte()
Read an unsigned byte from the stream and return it.
void rebuild()
Rebuild the combined texture image.
BioWare's Packed Layered Texture.
PLTFile(const Common::UString &name, Common::SeekableReadStream &plt)