()
| 1263 | } |
| 1264 | |
| 1265 | getAverageColor() { |
| 1266 | let r = 0, g = 0, b = 0, a = 0; |
| 1267 | for (const pixel of this.pixels) { |
| 1268 | r += pixel[0]; |
| 1269 | g += pixel[1]; |
| 1270 | b += pixel[2]; |
| 1271 | a += pixel[3]; |
| 1272 | } |
| 1273 | const count = this.pixels.length; |
| 1274 | return [ |
| 1275 | Math.round(r / count), |
| 1276 | Math.round(g / count), |
| 1277 | Math.round(b / count), |
| 1278 | Math.round(a / count) |
| 1279 | ]; |
| 1280 | } |
| 1281 | |
| 1282 | split() { |
| 1283 | if (this.pixels.length < 2) return null; |
no outgoing calls
no test coverage detected