ColorThief\VBox::longestAxis PHP Метод

longestAxis() публичный Метод

Determines the longest axis
public longestAxis ( ) : string
Результат string
    public function longestAxis()
    {
        $colorWidth['r'] = $this->r2 - $this->r1;
        $colorWidth['g'] = $this->g2 - $this->g1;
        $colorWidth['b'] = $this->b2 - $this->b1;
        return array_search(max($colorWidth), $colorWidth);
    }

Usage Example

Пример #1
0
 /**
  * @covers ColorThief\VBox::longestAxis
  */
 public function testLongestAxis()
 {
     $this->vbox->r1 = 225 >> ColorThief::RSHIFT;
     $this->vbox->r2 = 247 >> ColorThief::RSHIFT;
     $this->vbox->g1 = 180 >> ColorThief::RSHIFT;
     $this->vbox->g2 = 189 >> ColorThief::RSHIFT;
     $this->vbox->b1 = 180 >> ColorThief::RSHIFT;
     $this->vbox->b2 = 228 >> ColorThief::RSHIFT;
     $this->assertEquals('b', $this->vbox->longestAxis());
     $this->vbox->g1 = 110 >> ColorThief::RSHIFT;
     $this->assertEquals('g', $this->vbox->longestAxis());
     $this->vbox->r1 = 10 >> ColorThief::RSHIFT;
     $this->assertEquals('r', $this->vbox->longestAxis());
 }
All Usage Examples Of ColorThief\VBox::longestAxis