XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
text.php
Go to the documentation of this file.
1 <?php
2 /*
3  +--------------------------------------------------------------------------------------------+
4  | DISCLAIMER - LEGAL NOTICE - |
5  +--------------------------------------------------------------------------------------------+
6  | |
7  | This program is free for non comercial use, see the license terms available at |
8  | http://www.francodacosta.com/licencing/ for more information |
9  | |
10  | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
11  | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
12  | |
13  | USE IT AT YOUR OWN RISK |
14  | |
15  | |
16  +--------------------------------------------------------------------------------------------+
17 
18 */
37  function fromString(phmagick $p, $text = '', phMagickTextObject $format = null){
38 
39  if(is_null($format)) $format = new phMagickTextObject();
40 
41  $cmd = $p->getBinary('convert');
42 
43  if ($format->background !== false)
44  $cmd .= ' -background "' . $format->background . '"';
45 
46  if ($format->color !== false)
47  $cmd .= ' -fill "' . $format->color . '"' ;
48 
49  if ($format->font !== false)
50  $cmd .= ' -font ' . $format->font ;
51 
52  if ($format->fontSize !== false)
53  $cmd .= ' -pointsize ' . $format->fontSize ;
54 
55  if (($format->pText != '') && ($text = '') )
56  $text = $format->pText ;
57 
58  $cmd .= ' label:"'. $text .'"';
59  $cmd .= ' "' . $p->getDestination().'"' ;
60 
61  $p->execute($cmd);
62  $p->setSource($p->getDestination());
63  $p->setHistory($p->getDestination());
64  return $p ;
65  }
66 }
67 
68 
69 ?>