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

Method pad

tools/png2bmp.js:185–195  ·  view source on GitHub ↗
(width)

Source from the content-addressed store, hash-verified

183 return (png.channels == 2) || (png.channels == 3) || (png.channels == 4);
184 }
185 pad(width) {
186 const colorDepth = (this.color) ? Bitmap.depth(this.colorFormat) : 32;
187 const alphaDepth = (this.alpha) ? Bitmap.depth(this.alphaFormat) : 32;
188 const depth = Math.min(colorDepth, alphaDepth);
189 const alignment = this.bm4 ? ((this.colorFormat === formatValues.monochromealigned) ? 32 : 8) : 32;
190 const multiple = (depth < alignment) ? (alignment / depth) : 1;
191 const overflow = width & (multiple - 1);
192 if (overflow)
193 width += multiple - overflow;
194 return width;
195 }
196 rotate90(buffer, width, height) {
197 let result = new Uint8Array(height * width * 4);
198 let v = 0;

Callers 1

runMethod · 0.45

Calls 1

depthMethod · 0.45

Tested by

no test coverage detected