MCPcopy Create free account
hub / github.com/Timic3/rw-parser / bgra8888

Method bgra8888

src/renderware/utils/ImageDecoder.ts:447–457  ·  view source on GitHub ↗
(data: Uint8Array, width: number, height: number)

Source from the content-addressed store, hash-verified

445 }
446
447 static bgra8888(data: Uint8Array, width: number, height: number): Uint8Array {
448 const rgba = new Uint8Array(4 * width * height);
449 for (let i = 0; i < data.length; i += 4) {
450 rgba[i + 0] = data[i + 2];
451 rgba[i + 1] = data[i + 1];
452 rgba[i + 2] = data[i + 0];
453 rgba[i + 3] = data[i + 3];
454 }
455
456 return rgba;
457 }
458
459 static lum8(data: Uint8Array, width: number, height: number): Uint8Array {
460 const rgba = new Uint8Array(4 * width * height);

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected