read image RGNDATA structure

This commit is contained in:
Lily Tsuru 2024-07-09 18:59:11 -04:00
parent 5c3433461d
commit 64226599f8
2 changed files with 10 additions and 5 deletions

View file

@ -19,7 +19,7 @@ export class RECT {
} }
export class RGNDATAHEADER { export class RGNDATAHEADER {
size = 0x20; // I think? size = 0x20;
type = 1; type = 1;
count = 0; count = 0;
rgnSize = 0; rgnSize = 0;
@ -29,11 +29,11 @@ export class RGNDATAHEADER {
let hdr = new RGNDATAHEADER(); let hdr = new RGNDATAHEADER();
hdr.size = buffer.readU32LE(); hdr.size = buffer.readU32LE();
//if(hdr.size != 0x20) if(hdr.size != 0x20)
// throw new Error("Invalid RGNDATAHEADER!"); throw new Error("Invalid RGNDATAHEADER!");
hdr.type = buffer.readU32LE(); hdr.type = buffer.readU32LE();
if (hdr.type != 1) throw new Error('Invalid RGNDATAHEADER type!'); if (hdr.type != 1) throw new Error('Invalid RGNDATAHEADER type (only rectangles are supported)!');
hdr.count = buffer.readU32LE(); hdr.count = buffer.readU32LE();
hdr.rgnSize = buffer.readU32LE(); hdr.rgnSize = buffer.readU32LE();

View file

@ -55,8 +55,13 @@ export class AcsImage {
image.data = data; image.data = data;
} }
// this will be a rgndata (TODO) read this // this will be a rgndata (TODO) read this
//let temp = COMPRESSED_DATABLOCK.read(buffer); let temp = COMPRESSED_DATABLOCK.read(buffer);
let tempBuffer = new BufferStream(temp.data);
image.regionData = RGNDATA.read(tempBuffer);
return image; return image;
} }