MCPcopy Create free account
hub / github.com/32comic/image2pixel-web / split

Method split

web/js/algorithms.js:76–82  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

74 return [Math.round(r / n), Math.round(g / n), Math.round(b / n)];
75 }
76 split() {
77 if (this.pixels.length < 2) return null;
78 const ch = this.splitChannel;
79 this.pixels.sort((a, b) => a[ch] - b[ch]);
80 const mid = Math.floor(this.pixels.length / 2);
81 return [new ColorBox(this.pixels.slice(0, mid)), new ColorBox(this.pixels.slice(mid))];
82 }
83 }
84
85 let boxes = [new ColorBox(pixels)];

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected