From 866658cded5b92ddb2681dead1ebaf111d712fcc Mon Sep 17 00:00:00 2001 From: cassiopc Date: Mon, 6 Aug 2012 11:09:10 +0200 Subject: init --- boca-1.5.0/src/libchart/classes/Color.php | 74 +++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 boca-1.5.0/src/libchart/classes/Color.php (limited to 'boca-1.5.0/src/libchart/classes/Color.php') diff --git a/boca-1.5.0/src/libchart/classes/Color.php b/boca-1.5.0/src/libchart/classes/Color.php new file mode 100644 index 0000000..178435b --- /dev/null +++ b/boca-1.5.0/src/libchart/classes/Color.php @@ -0,0 +1,74 @@ +red = (int)$red; + $this->green = (int)$green; + $this->blue = (int)$blue; + $this->alpha = (int)round($alpha * 127.0 / 255); + + $this->gdColor = null; + } + + /** + * Get GD color + * + * @access public + * @param $img GD image resource + */ + + function getColor($img) + { + // Checks if color has already been allocated + + if(!$this->gdColor) + { + if($this->alpha == 0 || !function_exists('imagecolorallocatealpha')) + $this->gdColor = imagecolorallocate($img, $this->red, $this->green, $this->blue); + else + $this->gdColor = imagecolorallocatealpha($img, $this->red, $this->green, $this->blue, $this->alpha); + } + + // Returns GD color + + return $this->gdColor; + } + } +?> -- cgit v1.2.3