(
w,
{ layer, x, y, width, height, rgbaPixels },
)
| 145 | |
| 146 | // write a compressed cel chunk — RGBA pixels are zlib-compressed at test time |
| 147 | async function writeCompressedCelChunk( |
| 148 | w, |
| 149 | { layer, x, y, width, height, rgbaPixels }, |
| 150 | ) { |
| 151 | const compressed = await deflateZlib(rgbaPixels); |
| 152 | const sizeOffset = w.length; |
| 153 | w.u32(0); |
| 154 | w.u16(0x2005); |
| 155 | w.u16(layer); |
| 156 | w.i16(x); |
| 157 | w.i16(y); |
| 158 | w.u8(255); |
| 159 | w.u16(2); // cel type 2 = compressed image |
| 160 | w.zeros(7); |
| 161 | w.u16(width); |
| 162 | w.u16(height); |
| 163 | w.bytes(compressed); |
| 164 | const end = w.length; |
| 165 | patchU32WriterPart(w, sizeOffset, end - sizeOffset); |
| 166 | } |
| 167 | |
| 168 | // write a tags chunk |
| 169 | function writeTagsChunk(w, tags) { |
no test coverage detected