PhpOffice\PhpPresentation\Style\Color::getAlpha PHP Method

getAlpha() public method

Get the alpha % of the ARGB Will return 100 if no ARGB
public getAlpha ( ) : integer
return integer
    public function getAlpha()
    {
        $alpha = 100;
        if (strlen($this->argb) >= 6) {
            $dec = hexdec(substr($this->argb, 0, 2));
            $alpha = number_format($dec / 255 * 100, 2);
        }
        return $alpha;
    }

Usage Example

Beispiel #1
0
 /**
  * Test Alpha
  */
 public function testAlpha()
 {
     $object = new Color();
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setARGB());
     $this->assertEquals(100, $object->getAlpha());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setARGB(Color::COLOR_BLUE));
     $this->assertEquals(100, $object->getAlpha());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setARGB('AA0000FF'));
     $this->assertEquals(66.67, $object->getAlpha());
 }
All Usage Examples Of PhpOffice\PhpPresentation\Style\Color::getAlpha