PHP 클래스 ColorThief\ColorThief

파일 보기 프로젝트 열기: ksubileau/color-thief-php 1 사용 예제들

공개 메소드들

메소드 설명
getColor ( mixed $sourceImage, integer $quality = 10, array $area = null ) : array | boolean Use the median cut algorithm to cluster similar colors.
getColorIndex ( integer $red, integer $green, integer $blue, integer $sigBits = self::SIGBITS ) : integer Get reduced-space color index for a pixel
getColorsFromIndex ( integer $index, integer $rightShift = self::RSHIFT, integer $sigBits = 8 ) : array Get red, green and blue components from reduced-space color index for a pixel
getPalette ( mixed $sourceImage, integer $colorCount = 10, integer $quality = 10, array $area = null ) : array Use the median cut algorithm to cluster similar colors.
naturalOrder ( integer $a, integer $b ) : integer Natural sorting

보호된 메소드들

메소드 설명
isClearlyVisible ( object $color ) : boolean
isNonWhite ( object $color ) : boolean

비공개 메소드들

메소드 설명
doCut ( string $color, VBox $vBox, array $partialSum, integer $total ) : array
getHisto ( array $pixels ) : array Histo: 1-d array, giving the number of pixels in each quantized region of color space
getVBoxColorRanges ( VBox $vBox, array $order ) : array
loadImage ( mixed $sourceImage, integer $quality, array $area = null ) : SplFixedArray
medianCutApply ( array $histo, VBox $vBox ) : array | void
quantize ( SplFixedArra\SplFixedArray | array $pixels, $maxColors ) : boolean | CMap
quantizeIter ( colorthief\PQueue &$priorityQueue, float $target, array $histo ) Inner function to do the iteration
rearrangeColors ( array $order, integer $color1, integer $color2, integer $color3 ) : array
sumColors ( string $axis, array $histo, VBox $vBox ) : array Find the partial sum arrays along the selected axis.
vboxFromHistogram ( array $histo ) : VBox

메소드 상세

getColor() 공개 정적인 메소드

Use the median cut algorithm to cluster similar colors.
public static getColor ( mixed $sourceImage, integer $quality = 10, array $area = null ) : array | boolean
$sourceImage mixed Path/URL to the image, GD resource, Imagick instance, or image as binary string
$quality integer 1 is the highest quality. There is a trade-off between quality and speed. The bigger the number, the faster the palette generation but the greater the likelihood that colors will be missed.
$area array
리턴 array | boolean

getColorIndex() 공개 정적인 메소드

Get reduced-space color index for a pixel
public static getColorIndex ( integer $red, integer $green, integer $blue, integer $sigBits = self::SIGBITS ) : integer
$red integer
$green integer
$blue integer
$sigBits integer
리턴 integer

getColorsFromIndex() 공개 정적인 메소드

Get red, green and blue components from reduced-space color index for a pixel
public static getColorsFromIndex ( integer $index, integer $rightShift = self::RSHIFT, integer $sigBits = 8 ) : array
$index integer
$rightShift integer
$sigBits integer
리턴 array

getPalette() 공개 정적인 메소드

Use the median cut algorithm to cluster similar colors.
public static getPalette ( mixed $sourceImage, integer $colorCount = 10, integer $quality = 10, array $area = null ) : array
$sourceImage mixed Path/URL to the image, GD resource, Imagick instance, or image as binary string
$colorCount integer It determines the size of the palette; the number of colors returned.
$quality integer 1 is the highest quality.
$area array
리턴 array

isClearlyVisible() 보호된 정적인 메소드

protected static isClearlyVisible ( object $color ) : boolean
$color object
리턴 boolean

isNonWhite() 보호된 정적인 메소드

protected static isNonWhite ( object $color ) : boolean
$color object
리턴 boolean

naturalOrder() 공개 정적인 메소드

Natural sorting
public static naturalOrder ( integer $a, integer $b ) : integer
$a integer
$b integer
리턴 integer