public function colorAt($index) 
    {
        $sampleCount = $this->samples[$index * 5 + self::IDX_COUNT];
        $alphaSum = $this->samples[$index * 5 + self::IDX_A];
        return $sampleCount == 0 || $alphaSum == 0 ? 0 :
            ColorUtils::from(
                (int)($alphaSum / $sampleCount),
                (int)($this->samples[$index * 5 + self::IDX_R] / $alphaSum),
                (int)($this->samples[$index * 5 + self::IDX_G] / $alphaSum),
                (int)($this->samples[$index * 5 + self::IDX_B] / $alphaSum)
            );
    }
public function colorAt($index) 
    {
        $sampleCount = $this->samples[$index * 5 + self::IDX_COUNT];
        $alphaSum = $this->samples[$index * 5 + self::IDX_A];
        return $sampleCount == 0 || $alphaSum == 0 ? 0 :
            ColorUtils::from(
                (int)($alphaSum / $sampleCount),
                (int)($this->samples[$index * 5 + self::IDX_R] / $alphaSum),
                (int)($this->samples[$index * 5 + self::IDX_G] / $alphaSum),
                (int)($this->samples[$index * 5 + self::IDX_B] / $alphaSum)
            );
    }
public function colorAt ( $ index ) { $ sampleCount = $ this -> samples [ $ index * 5 + self :: IDX_COUNT ] ; $ alphaSum = $ this -> samples [ $ index * 5 + self :: IDX_A ] ; return $ sampleCount == 0 || $ alphaSum == 0 ? 0 : ColorUtils :: from ( ( int ) ( $ alphaSum / $ sampleCount ) , ( int ) ( $ this -> samples [ $ index * 5 + self :: IDX_R ] / $ alphaSum ) , ( int ) ( $ this -> samples [ $ index * 5 + self :: IDX_G ] / $ alphaSum ) , ( int ) ( $ this -> samples [ $ index * 5 + self :: IDX_B ] / $ alphaSum ) ) ; }
Gets the average color of the pixel at a specified index.

@param integer $index The index of the pixel.
@return integer
Gets the average color of the pixel at a specified index .