pChart 2.x forum http://wiki.pchart.net/forum/ |
|
Transparent background http://wiki.pchart.net/forum/viewtopic.php?f=3&t=84 |
Page 1 of 1 |
Author: | georgi.m [ Sun Jan 16, 2011 3:52 pm ] |
Post subject: | Transparent background |
I've noticed that pPie draws on transparent background but could not get regular charts with pImage to have transparent backgrounds: I had to amend the code, and I'm not sure i've done the right thing but here goes. In pImage Code: function pImage($XSize,$YSize,$DataSet = NULL) { if ( $DataSet != NULL ) { $this->DataSet = $DataSet; } $this->XSize = $XSize; $this->YSize = $YSize; $this->Picture = imagecreatetruecolor($XSize,$YSize); imagealphablending($this->Picture, false); $col=imagecolorallocatealpha($this->Picture, 255, 255, 255, 127); imagefilledrectangle($this->Picture, 0,0,$XSize, $YSize, $col); imagealphablending($this->Picture,TRUE); // $C_White = $this->AllocateColor($this->Picture,255,255,255); // imagefilledrectangle($this->Picture,0,0,$XSize,$YSize,$C_White); } ... /* Render the picture to a file */ function render($FileName) { imagealphablending($this->Picture,false); imagesavealpha($this->Picture,true); imagepng($this->Picture,$FileName); } as per this blog entry. Is there a legit way of doing this without changing pImage? |
Author: | jean-damien [ Sun Jan 16, 2011 5:11 pm ] | ||
Post subject: | Re: Transparent background | ||
To be honest this is something that I was looking for since long times. I've adapted the code to the last subversion and added a $TransparentBackground switch to the pImage() class constructor. Rendering results are awesome. Thank you very much for this suggestion and code! JD.
|
Author: | jean-damien [ Wed Jan 26, 2011 3:02 pm ] |
Post subject: | Re: Transparent background |
This has been fixed in the 2.1.0 that you can get from here : download. Kind regards, JD. |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |