ColorThief\ColorThief::medianCutApply PHP Method

medianCutApply() private static method

private static medianCutApply ( array $histo, VBox $vBox ) : array | void
$histo array
$vBox VBox
return array | void
    private static function medianCutApply($histo, $vBox)
    {
        if (!$vBox->count()) {
            return;
        }
        // If the vbox occupies just one element in color space, it can't be split
        if ($vBox->count() == 1) {
            return array($vBox->copy());
        }
        // Select the longest axis for splitting
        $cutColor = $vBox->longestAxis();
        // Find the partial sum arrays along the selected axis.
        list($total, $partialSum) = static::sumColors($cutColor, $histo, $vBox);
        return static::doCut($cutColor, $vBox, $partialSum, $total);
    }