Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
GraphicsState.php
Go to the documentation of this file.
1 <?php
24 #require_once 'Zend/Pdf/Element/Object.php';
25 #require_once 'Zend/Pdf/Element/Dictionary.php';
26 #require_once 'Zend/Pdf/Element/Name.php';
27 #require_once 'Zend/Pdf/Element/Numeric.php';
28 
29 
31 #require_once 'Zend/Pdf/Resource.php';
32 
33 
46 {
53  public function __construct(Zend_Pdf_Element_Object $extGStateObject = null)
54  {
55  if ($extGStateObject == null) {
56  // Create new Graphics State object
57  #require_once 'Zend/Pdf/ElementFactory.php';
59 
60  $gsDictionary = new Zend_Pdf_Element_Dictionary();
61  $gsDictionary->Type = new Zend_Pdf_Element_Name('ExtGState');
62 
63  $extGStateObject = $factory->newObject($gsDictionary);
64  }
65 
66  if ($extGStateObject->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
67  #require_once 'Zend/Pdf/Exception.php';
68  throw new Zend_Pdf_Exception('Graphics state PDF object must be a dictionary');
69  }
70 
71  parent::__construct($gsDictionary);
72  }
73 
89  public function setAlpha($alpha, $mode = 'Normal')
90  {
91  if (!in_array($mode, array('Normal', 'Multiply', 'Screen', 'Overlay', 'Darken', 'Lighten', 'ColorDodge',
92  'ColorBurn', 'HardLight', 'SoftLight', 'Difference', 'Exclusion'))) {
93  #require_once 'Zend/Pdf/Exception.php';
94  throw new Zend_Pdf_Exception('Unsupported transparency mode.');
95  }
96  if (!is_numeric($alpha) || $alpha < 0 || $alpha > 1) {
97  #require_once 'Zend/Pdf/Exception.php';
98  throw new Zend_Pdf_Exception('Alpha value must be numeric between 0 (transparent) and 1 (opaque).');
99  }
100 
101  $this->_resource->BM = new Zend_Pdf_Element_Name($mode);
102  $this->_resource->CA = new Zend_Pdf_Element_Numeric($alpha);
103  $this->_resource->ca = new Zend_Pdf_Element_Numeric($alpha);
104  }
105 
106 
108 }
109 
const TYPE_DICTIONARY
Definition: Element.php:37
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
Definition: grid.phtml:15
__construct(Zend_Pdf_Element_Object $extGStateObject=null)
static createFactory($objCount)
setAlpha($alpha, $mode='Normal')