Source for file gd_reflection.inc.php
Documentation is available at gd_reflection.inc.php
* GD Reflection Lib Plugin Definition File
* This file contains the plugin definition for the GD Reflection Lib for PHP Thumb
* PHP Version 5 with GD 2.0+
* PhpThumb : PHP Thumb Library <http://phpthumb.gxdlabs.com>
* Copyright (c) 2009, Ian Selby/Gen X Design
* Author(s): Ian Selby <ian@gen-x-design.com>
* Licensed under the MIT License
* Redistributions of files must retain the above copyright notice.
* @author Ian Selby <ian@gen-x-design.com>
* @copyright Copyright (c) 2009 Gen X Design
* @link http://phpthumb.gxdlabs.com
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* GD Reflection Lib Plugin
* This plugin allows you to create those fun Apple(tm)-style reflections in your images
* Instance of GdThumb passed to this class
public function createReflection ($percent, $reflection, $white, $border, $borderColor, &$that)
// bring stuff from the parent class into this class...
$reflectionHeight =
intval($height *
($reflection /
100));
$newHeight =
$height +
$reflectionHeight;
$reflectedPart =
$height *
($percent /
100);
($height -
$reflectedPart)
for ($i =
0; $i <
$reflectionHeight; $i++
)
$rgb =
$this->hex2rgb($borderColor, false);
$this->options['alphaMaskColor'][0],
$this->options['alphaMaskColor'][1],
$this->options['alphaMaskColor'][2],
* Flips the image vertically
for ($x =
0; $x <
$x_i; $x++
)
for ($y =
0; $y <
$y_i; $y++
)
* Converts a hex color to rgb tuples
protected function hex2rgb ($hex, $asString =
false)
// strip off any leading #
elseif (0 ===
strpos($hex, '&H'))
// break into hex 3-tuple
// convert each tuple to decimal
$rgb[0] =
(isset
($rgb[0]) ?
hexdec($rgb[0]) :
0);
$rgb[1] =
(isset
($rgb[1]) ?
hexdec($rgb[1]) :
0);
$rgb[2] =
(isset
($rgb[2]) ?
hexdec($rgb[2]) :
0);
return ($asString ?
"{
$rgb[0]} {$rgb[1]} {$rgb[2]}" :
$rgb);
$pt->registerPlugin('GdReflectionLib', 'gd');
Documentation generated on Tue, 09 Aug 2011 09:04:59 +0200 by phpDocumentor 1.4.3