getAlpha() public method

Get the alpha % of the ARGB Will return 100 if no ARGB
public getAlpha ( ) : integer
return integer
コード例 #1
0
ファイル: ColorTest.php プロジェクト: phpoffice/phppowerpoint
 /**
  * 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());
 }
コード例 #2
0
 /**
  * @param XMLWriter $objWriter
  * @param Color $color
  * @param int|null $alpha
  */
 protected function writeColor(XMLWriter $objWriter, Color $color, $alpha = null)
 {
     if (is_null($alpha)) {
         $alpha = $color->getAlpha();
     }
     // a:srgbClr
     $objWriter->startElement('a:srgbClr');
     $objWriter->writeAttribute('val', $color->getRGB());
     // a:alpha
     $objWriter->startElement('a:alpha');
     $objWriter->writeAttribute('val', $alpha * 1000);
     $objWriter->endElement();
     $objWriter->endElement();
 }