first commit of free version
This commit is contained in:
48
admin/compiler/joomla_3/wideimage/Font/GDF.php
Normal file
48
admin/compiler/joomla_3/wideimage/Font/GDF.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Gasper Kozak
|
||||
* @copyright 2007-2011
|
||||
|
||||
This file is part of WideImage.
|
||||
|
||||
WideImage is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
WideImage is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with WideImage; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
* @package WideImage
|
||||
**/
|
||||
|
||||
/**
|
||||
* GDF font support class
|
||||
*
|
||||
* @package WideImage
|
||||
*/
|
||||
class WideImage_Font_GDF
|
||||
{
|
||||
protected $font;
|
||||
protected $color;
|
||||
|
||||
function __construct($face, $color)
|
||||
{
|
||||
if (is_int($face) && $face >= 1 && $face <= 5)
|
||||
$this->font = $face;
|
||||
else
|
||||
$this->font = imageloadfont($face);
|
||||
$this->color = $color;
|
||||
}
|
||||
|
||||
function writeText($image, $x, $y, $text)
|
||||
{
|
||||
imagestring($image->getHandle(), $this->font, $x, $y, $text, $this->color);
|
||||
}
|
||||
}
|
60
admin/compiler/joomla_3/wideimage/Font/PS.php
Normal file
60
admin/compiler/joomla_3/wideimage/Font/PS.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Gasper Kozak
|
||||
* @copyright 2007-2011
|
||||
|
||||
This file is part of WideImage.
|
||||
|
||||
WideImage is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
WideImage is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with WideImage; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
* @package WideImage
|
||||
**/
|
||||
|
||||
/**
|
||||
* PS font support class
|
||||
*
|
||||
* @package WideImage
|
||||
*/
|
||||
class WideImage_Font_PS
|
||||
{
|
||||
public $size;
|
||||
public $color;
|
||||
public $handle;
|
||||
|
||||
function __construct($file, $size, $color, $bgcolor = null)
|
||||
{
|
||||
$this->handle = imagepsloadfont($file);
|
||||
$this->size = $size;
|
||||
$this->color = $color;
|
||||
if ($bgcolor === null)
|
||||
$this->bgcolor = $color;
|
||||
else
|
||||
$this->color = $color;
|
||||
}
|
||||
|
||||
function writeText($image, $x, $y, $text, $angle = 0)
|
||||
{
|
||||
if ($image->isTrueColor())
|
||||
$image->alphaBlending(true);
|
||||
|
||||
imagepstext($image->getHandle(), $text, $this->handle, $this->size, $this->color, $this->bgcolor, $x, $y, 0, 0, $angle, 4);
|
||||
}
|
||||
|
||||
function __destruct()
|
||||
{
|
||||
imagepsfreefont($this->handle);
|
||||
$this->handle = null;
|
||||
}
|
||||
}
|
75
admin/compiler/joomla_3/wideimage/Font/TTF.php
Normal file
75
admin/compiler/joomla_3/wideimage/Font/TTF.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Gasper Kozak
|
||||
* @copyright 2007-2011
|
||||
|
||||
This file is part of WideImage.
|
||||
|
||||
WideImage is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
WideImage is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with WideImage; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
* @package WideImage
|
||||
**/
|
||||
|
||||
/**
|
||||
* TTF font support class
|
||||
*
|
||||
* @package WideImage
|
||||
*/
|
||||
class WideImage_Font_TTF
|
||||
{
|
||||
public $face;
|
||||
public $size;
|
||||
public $color;
|
||||
|
||||
function __construct($face, $size, $color)
|
||||
{
|
||||
$this->face = $face;
|
||||
$this->size = $size;
|
||||
$this->color = $color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes text onto an image
|
||||
*
|
||||
* @param WideImage_Image $image
|
||||
* @param mixed $x smart coordinate
|
||||
* @param mixed $y smart coordinate
|
||||
* @param string $text
|
||||
* @param int $angle Angle in degrees clockwise
|
||||
*/
|
||||
function writeText($image, $x, $y, $text, $angle = 0)
|
||||
{
|
||||
if ($image->isTrueColor())
|
||||
$image->alphaBlending(true);
|
||||
|
||||
$box = imageftbbox($this->size, $angle, $this->face, $text);
|
||||
$obox = array(
|
||||
'left' => min($box[0], $box[2], $box[4], $box[6]),
|
||||
'top' => min($box[1], $box[3], $box[5], $box[7]),
|
||||
'right' => max($box[0], $box[2], $box[4], $box[6]) - 1,
|
||||
'bottom' => max($box[1], $box[3], $box[5], $box[7]) - 1
|
||||
);
|
||||
$obox['width'] = abs($obox['left']) + abs($obox['right']);
|
||||
$obox['height'] = abs($obox['top']) + abs($obox['bottom']);
|
||||
|
||||
$x = WideImage_Coordinate::fix($x, $image->getWidth(), $obox['width']);
|
||||
$y = WideImage_Coordinate::fix($y, $image->getHeight(), $obox['height']);
|
||||
|
||||
$fixed_x = $x - $obox['left'];
|
||||
$fixed_y = $y - $obox['top'];
|
||||
|
||||
imagettftext($image->getHandle(), $this->size, $angle, $fixed_x, $fixed_y, $this->color, $this->face, $text);
|
||||
}
|
||||
}
|
1
admin/compiler/joomla_3/wideimage/Font/index.html
Normal file
1
admin/compiler/joomla_3/wideimage/Font/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
Reference in New Issue
Block a user