| 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; |