MCPcopy Index your code
hub / github.com/Moddable-OpenSource/moddable / rotate180

Method rotate180

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

Source from the content-addressed store, hash-verified

327 return result.buffer;
328 }
329 rotate180(pixels, width, height) {
330 let buffer = new Uint16Array(pixels);
331 let result = new Uint16Array(height * width);
332 let v = 0;
333 while (v < height) {
334 let u = 0;
335 while (u < width) {
336 let x = width - 1 - u;
337 let y = height - 1 - v;
338 let src = ((v * width) + u);
339 let dst = ((y * width) + x);
340 result[dst] = buffer[src];
341 u++;
342 }
343 v++;
344 }
345 return result.buffer;
346 }
347 rotate270(pixels, width, height) {
348 let buffer = new Uint16Array(pixels);
349 let result = new Uint16Array(height * width);

Callers 2

readPNGMethod · 0.45
runMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected