()
| 482 | return sum.map(v => Math.round(v / this.pixels.length)); |
| 483 | } |
| 484 | split() { |
| 485 | if (this.pixels.length < 2) return null; |
| 486 | this.pixels.sort((a, b) => a[this.splitChannel] - b[this.splitChannel]); |
| 487 | const mid = Math.floor(this.pixels.length / 2); |
| 488 | return [new ColorBox(this.pixels.slice(0, mid)), new ColorBox(this.pixels.slice(mid))]; |
| 489 | } |
| 490 | } |
| 491 | |
| 492 | function medianCutQuantization(imageData, colorCount) { |
no outgoing calls
no test coverage detected