[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Definition of eZImageLayer class 4 // 5 // Created on: <03-Oct-2002 15:05:09 amos> 6 // 7 // SOFTWARE NAME: eZ publish 8 // SOFTWARE RELEASE: 3.9.0 9 // BUILD VERSION: 17785 10 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS 11 // SOFTWARE LICENSE: GNU General Public License v2.0 12 // NOTICE: > 13 // This program is free software; you can redistribute it and/or 14 // modify it under the terms of version 2.0 of the GNU General 15 // Public License as published by the Free Software Foundation. 16 // 17 // This program is distributed in the hope that it will be useful, 18 // but WITHOUT ANY WARRANTY; without even the implied warranty of 19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 // GNU General Public License for more details. 21 // 22 // You should have received a copy of version 2.0 of the GNU General 23 // Public License along with this program; if not, write to the Free 24 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 25 // MA 02110-1301, USA. 26 // 27 // 28 29 /*! \file ezimagelayer.php 30 */ 31 32 /*! 33 \class eZImageLayer ezimagelayer.php 34 \ingroup eZImageObject 35 \brief Defines a layer in a image object 36 37 */ 38 39 include_once ( 'lib/ezimage/classes/ezimageinterface.php' ); 40 41 class eZImageLayer extends eZImageInterface 42 { 43 /*! 44 Constructor 45 */ 46 function eZImageLayer( $imageObjectRef = null, $imageObject = null, 47 $width = false, $height = false, $font = false ) 48 { 49 $this->eZImageInterface( $imageObjectRef, $imageObject, $width, $height ); 50 $this->setFont( $font ); 51 $this->TemplateURI = 'design:image/layer.tpl'; 52 } 53 54 /*! 55 A definition which tells the template engine which template to use 56 for displaying the image. 57 */ 58 function templateData() 59 { 60 return array( 'type' => 'template', 61 'template_variable_name' => 'layer', 62 'uri' => $this->TemplateURI ); 63 } 64 65 /*! 66 Sets the URI of the template to use for displaying it using the template engine to \a $uri. 67 */ 68 function setTemplateURI( $uri ) 69 { 70 $this->TemplateURI = $uri; 71 } 72 73 /*! 74 \virtual 75 Tries to merge the current layer with the layer \a $lastLayerData 76 onto the image object \a $image. 77 Different kinds of layer classes will merge layers differently. 78 */ 79 function mergeLayer( &$image, &$layerData, &$lastLayerData ) 80 { 81 $position = $image->calculatePosition( $layerData['parameters'], $this->width(), $this->height() ); 82 $x = $position['x']; 83 $y = $position['y']; 84 $imageObject = $this->imageObject(); 85 if ( $lastLayerData === null ) 86 { 87 $destinationImageObject = $image->imageObjectInternal( false ); 88 if ( $destinationImageObject === null ) 89 { 90 $image->clone( $this ); 91 } 92 else 93 { 94 $image->mergeImage( $destinationImageObject, $imageObject, 95 $x, $y, 96 $this->width(), $this->height(), 0, 0, 97 $image->getTransparencyPercent( $layerData['parameters'] ) ); 98 } 99 } 100 else 101 { 102 $destinationImageObject = $image->imageObjectInternal(); 103 $image->mergeImage( $destinationImageObject, $imageObject, 104 $x, $y, 105 $this->width(), $this->height(), 0, 0, 106 $image->getTransparencyPercent( $layerData['parameters'] ) ); 107 } 108 } 109 110 /*! 111 Creates a new file layer for the file \a $fileName in path \a $filePath. 112 */ 113 function &createForFile( $fileName, $filePath, $fileType = false ) 114 { 115 $layer = new eZImageLayer(); 116 $layer->setStoredFile( $fileName, $filePath, $fileType ); 117 $layer->process(); 118 return $layer; 119 } 120 121 /// \privatesection 122 var $TemplateURI; 123 } 124 125 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |