MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / rotate90

Method rotate90

tools/image2cs.js:311–328  ·  view source on GitHub ↗
(pixels, width, height)

Source from the content-addressed store, hash-verified

309 frames.height = height;
310 }
311 rotate90(pixels, width, height) {
312 let buffer = new Uint16Array(pixels);
313 let result = new Uint16Array(height * width);
314 let v = 0;
315 while (v < height) {
316 let u = 0;
317 while (u < width) {
318 let x = height - 1 - v;
319 let y = u;
320 let src = ((v * width) + u);
321 let dst = ((y * height) + x);
322 result[dst] = buffer[src];
323 u++;
324 }
325 v++;
326 }
327 return result.buffer;
328 }
329 rotate180(pixels, width, height) {
330 let buffer = new Uint16Array(pixels);
331 let result = new Uint16Array(height * width);

Callers 2

readPNGMethod · 0.45
runMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected