/** * Test get/set alignment */ public function testSetGetAlignment() { $object = new Shadow(); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Shadow', $object->setAlignment()); $this->assertEquals(Shadow::SHADOW_BOTTOM_RIGHT, $object->getAlignment()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Shadow', $object->setAlignment(Shadow::SHADOW_CENTER)); $this->assertEquals(Shadow::SHADOW_CENTER, $object->getAlignment()); }
/** * Write Shadow * @param XMLWriter $objWriter * @param Shadow $oShadow */ protected function writeShadow(XMLWriter $objWriter, Shadow $oShadow) { // a:effectLst $objWriter->startElement('a:effectLst'); // a:outerShdw $objWriter->startElement('a:outerShdw'); $objWriter->writeAttribute('blurRad', CommonDrawing::pixelsToEmu($oShadow->getBlurRadius())); $objWriter->writeAttribute('dist', CommonDrawing::pixelsToEmu($oShadow->getDistance())); $objWriter->writeAttribute('dir', CommonDrawing::degreesToAngle($oShadow->getDirection())); $objWriter->writeAttribute('algn', $oShadow->getAlignment()); $objWriter->writeAttribute('rotWithShape', '0'); // a:srgbClr $objWriter->startElement('a:srgbClr'); $objWriter->writeAttribute('val', $oShadow->getColor()->getRGB()); // a:alpha $objWriter->startElement('a:alpha'); $objWriter->writeAttribute('val', $oShadow->getAlpha() * 1000); $objWriter->endElement(); $objWriter->endElement(); $objWriter->endElement(); $objWriter->endElement(); }
/** * Write Shadow * @param XMLWriter $objWriter * @param Shadow $oShadow */ protected function writeShadow(XMLWriter $objWriter, $oShadow) { if (!$oShadow instanceof Shadow) { return; } if (!$oShadow->isVisible()) { return; } // a:effectLst $objWriter->startElement('a:effectLst'); // a:outerShdw $objWriter->startElement('a:outerShdw'); $objWriter->writeAttribute('blurRad', CommonDrawing::pixelsToEmu($oShadow->getBlurRadius())); $objWriter->writeAttribute('dist', CommonDrawing::pixelsToEmu($oShadow->getDistance())); $objWriter->writeAttribute('dir', CommonDrawing::degreesToAngle($oShadow->getDirection())); $objWriter->writeAttribute('algn', $oShadow->getAlignment()); $objWriter->writeAttribute('rotWithShape', '0'); $this->writeColor($objWriter, $oShadow->getColor(), $oShadow->getAlpha()); $objWriter->endElement(); $objWriter->endElement(); }