PhpOffice\PhpPresentation\Writer\ODPresentation\Content::writeStylePartShadow PHP Method

writeStylePartShadow() protected method

protected writeStylePartShadow ( PhpOffice\Common\XMLWriter $objWriter, PhpOffice\PhpPresentation\Style\Shadow $oShadow )
$objWriter PhpOffice\Common\XMLWriter
$oShadow PhpOffice\PhpPresentation\Style\Shadow
    protected function writeStylePartShadow(XMLWriter $objWriter, Shadow $oShadow)
    {
        $objWriter->writeAttribute('draw:shadow', 'visible');
        $objWriter->writeAttribute('draw:shadow-color', '#' . $oShadow->getColor()->getRGB());
        $distanceCms = CommonDrawing::pixelsToCentimeters($oShadow->getDistance());
        if ($oShadow->getDirection() == 0 || $oShadow->getDirection() == 360) {
            $objWriter->writeAttribute('draw:shadow-offset-x', $distanceCms . 'cm');
            $objWriter->writeAttribute('draw:shadow-offset-y', '0cm');
        } elseif ($oShadow->getDirection() == 45) {
            $objWriter->writeAttribute('draw:shadow-offset-x', $distanceCms . 'cm');
            $objWriter->writeAttribute('draw:shadow-offset-y', $distanceCms . 'cm');
        } elseif ($oShadow->getDirection() == 90) {
            $objWriter->writeAttribute('draw:shadow-offset-x', '0cm');
            $objWriter->writeAttribute('draw:shadow-offset-y', $distanceCms . 'cm');
        } elseif ($oShadow->getDirection() == 135) {
            $objWriter->writeAttribute('draw:shadow-offset-x', '-' . $distanceCms . 'cm');
            $objWriter->writeAttribute('draw:shadow-offset-y', $distanceCms . 'cm');
        } elseif ($oShadow->getDirection() == 180) {
            $objWriter->writeAttribute('draw:shadow-offset-x', '-' . $distanceCms . 'cm');
            $objWriter->writeAttribute('draw:shadow-offset-y', '0cm');
        } elseif ($oShadow->getDirection() == 225) {
            $objWriter->writeAttribute('draw:shadow-offset-x', '-' . $distanceCms . 'cm');
            $objWriter->writeAttribute('draw:shadow-offset-y', '-' . $distanceCms . 'cm');
        } elseif ($oShadow->getDirection() == 270) {
            $objWriter->writeAttribute('draw:shadow-offset-x', '0cm');
            $objWriter->writeAttribute('draw:shadow-offset-y', '-' . $distanceCms . 'cm');
        } elseif ($oShadow->getDirection() == 315) {
            $objWriter->writeAttribute('draw:shadow-offset-x', $distanceCms . 'cm');
            $objWriter->writeAttribute('draw:shadow-offset-y', '-' . $distanceCms . 'cm');
        }
        $objWriter->writeAttribute('draw:shadow-opacity', 100 - $oShadow->getAlpha() . '%');
        $objWriter->writeAttribute('style:mirror', 'none');
    }