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

Method lum8

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

Source from the content-addressed store, hash-verified

457 }
458
459 static lum8(data: Uint8Array, width: number, height: number): Uint8Array {
460 const rgba = new Uint8Array(4 * width * height);
461
462 for (let i = 0; i < data.length; i++) {
463 const offset = i * 4;
464 const luminance = data[i];
465 rgba[offset + 0] = luminance; // R
466 rgba[offset + 1] = luminance; // G
467 rgba[offset + 2] = luminance; // B
468 rgba[offset + 3] = 0xff;
469 }
470
471 return rgba;
472 }
473
474 static lum8a8(data: Uint8Array, width: number, height: number): Uint8Array {
475 const rgba = new Uint8Array(4 * width * height);

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected