MCPcopy Create free account
hub / github.com/melonjs/melonJS / writeLayerChunk

Function writeLayerChunk

packages/melonjs/tests/aseprite-parser.spec.js:93–108  ·  view source on GitHub ↗
(w, name)

Source from the content-addressed store, hash-verified

91
92// write a layer chunk (visible) — produces a 6-byte chunk header + body
93function writeLayerChunk(w, name) {
94 const sizeOffset = w.length;
95 w.u32(0); // chunk size — patched
96 w.u16(0x2004); // chunk type: layer
97 w.u16(1); // flags: visible
98 w.u16(0); // type: normal
99 w.u16(0); // child level
100 w.u16(0); // default width
101 w.u16(0); // default height
102 w.u16(0); // blend mode (normal)
103 w.u8(255); // opacity
104 w.zeros(3);
105 w.str(name);
106 const end = w.length;
107 patchU32WriterPart(w, sizeOffset, end - sizeOffset);
108}
109
110// write a raw-image cel chunk at (x,y) on `layer`. The `rgbaPixels` name is
111// historical — for non-RGBA color depths the caller passes the raw per-pixel

Callers 1

writeFrameFunction · 0.85

Calls 6

patchU32WriterPartFunction · 0.85
zerosMethod · 0.80
u32Method · 0.45
u16Method · 0.45
u8Method · 0.45
strMethod · 0.45

Tested by

no test coverage detected