Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
Zend_Pdf_Resource_GraphicsState Class Reference
Inheritance diagram for Zend_Pdf_Resource_GraphicsState:
Zend_Pdf_Resource

Public Member Functions

 __construct (Zend_Pdf_Element_Object $extGStateObject=null)
 
 setAlpha ($alpha, $mode='Normal')
 
- Public Member Functions inherited from Zend_Pdf_Resource
 __construct ($resource)
 
 __clone ()
 
 cloneResource ($factory, &$processed)
 
 getResource ()
 
 getFactory ()
 

Additional Inherited Members

- Protected Attributes inherited from Zend_Pdf_Resource
 $_objectFactory
 
 $_resource
 

Detailed Description

Definition at line 45 of file GraphicsState.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( Zend_Pdf_Element_Object  $extGStateObject = null)

Object constructor.

Parameters
Zend_Pdf_Element_Object$extGStateObject
Exceptions
Zend_Pdf_Exception

Definition at line 53 of file GraphicsState.php.

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  }
const TYPE_DICTIONARY
Definition: Element.php:37
static createFactory($objCount)

Member Function Documentation

◆ setAlpha()

setAlpha (   $alpha,
  $mode = 'Normal' 
)

Set the transparancy

$alpha == 0 - transparent $alpha == 1 - opaque

Transparency modes, supported by PDF: Normal (default), Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight, SoftLight, Difference, Exclusion

Parameters
float$alpha
string$mode
Exceptions
Zend_Pdf_Exception
Returns
Zend_Pdf_Canvas_Interface

Definition at line 89 of file GraphicsState.php.

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  }
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
Definition: grid.phtml:15

The documentation for this class was generated from the following file: