function reset(&$media) { OutputDriverGeneric::reset($media); }
function update_media($media) { parent::update_media($media); /** * Here we use a small hack; media height and width (in millimetres) match * the size of screenshot (in pixels), so we take them as-is */ $this->_heightPixels = $media->height(); $this->_widthPixels = $media->width(); $this->_image = imagecreatetruecolor($this->_widthPixels, $this->_heightPixels); /** * Render white background */ $white = imagecolorallocate($this->_image, 255, 255, 255); imagefill($this->_image, 0, 0, $white); imagecolordeallocate($this->_image, $white); $this->_color[0] = array('rgb' => array(0, 0, 0), 'object' => imagecolorallocate($this->_image, 0, 0, 0)); /** * Setup initial clipping region */ $this->_clipping = array(); $this->_saveClip(new Rectangle(new Point(0, 0), new Point($this->_widthPixels - 1, $this->_heightPixels - 1))); $this->_transform = new AffineTransform($this->_heightPixels, $this->_widthPixels / mm2pt($this->media->width()), $this->_heightPixels / mm2pt($this->media->height())); }