PageRenderTime 61ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 2ms

/libs/pChart2.1.3/class/pDraw.class.php

https://github.com/CodeYellowBV/piwik
PHP | 6203 lines | 5027 code | 1048 blank | 128 comment | 2366 complexity | f27d42bc9fa34966f4483546254c312c MD5 | raw file
Possible License(s): LGPL-3.0, JSON, MIT, GPL-3.0, LGPL-2.1, GPL-2.0, AGPL-1.0, BSD-2-Clause, BSD-3-Clause

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /*
  3. pDraw - class extension with drawing methods
  4. Version : 2.1.3
  5. Made by : Jean-Damien POGOLOTTI
  6. Last Update : 09/09/11
  7. This file can be distributed under the license you can find at :
  8. http://www.pchart.net/license
  9. You can find the whole class documentation on the pChart web site.
  10. */
  11. define("DIRECTION_VERTICAL" , 690001);
  12. define("DIRECTION_HORIZONTAL" , 690002);
  13. define("SCALE_POS_LEFTRIGHT" , 690101);
  14. define("SCALE_POS_TOPBOTTOM" , 690102);
  15. define("SCALE_MODE_FLOATING" , 690201);
  16. define("SCALE_MODE_START0" , 690202);
  17. define("SCALE_MODE_ADDALL" , 690203);
  18. define("SCALE_MODE_ADDALL_START0" , 690204);
  19. define("SCALE_MODE_MANUAL" , 690205);
  20. define("SCALE_SKIP_NONE" , 690301);
  21. define("SCALE_SKIP_SAME" , 690302);
  22. define("SCALE_SKIP_NUMBERS" , 690303);
  23. define("TEXT_ALIGN_TOPLEFT" , 690401);
  24. define("TEXT_ALIGN_TOPMIDDLE" , 690402);
  25. define("TEXT_ALIGN_TOPRIGHT" , 690403);
  26. define("TEXT_ALIGN_MIDDLELEFT" , 690404);
  27. define("TEXT_ALIGN_MIDDLEMIDDLE" , 690405);
  28. define("TEXT_ALIGN_MIDDLERIGHT" , 690406);
  29. define("TEXT_ALIGN_BOTTOMLEFT" , 690407);
  30. define("TEXT_ALIGN_BOTTOMMIDDLE" , 690408);
  31. define("TEXT_ALIGN_BOTTOMRIGHT" , 690409);
  32. define("POSITION_TOP" , 690501);
  33. define("POSITION_BOTTOM" , 690502);
  34. define("LABEL_POS_LEFT" , 690601);
  35. define("LABEL_POS_CENTER" , 690602);
  36. define("LABEL_POS_RIGHT" , 690603);
  37. define("LABEL_POS_TOP" , 690604);
  38. define("LABEL_POS_BOTTOM" , 690605);
  39. define("LABEL_POS_INSIDE" , 690606);
  40. define("LABEL_POS_OUTSIDE" , 690607);
  41. define("ORIENTATION_HORIZONTAL" , 690701);
  42. define("ORIENTATION_VERTICAL" , 690702);
  43. define("ORIENTATION_AUTO" , 690703);
  44. define("LEGEND_NOBORDER" , 690800);
  45. define("LEGEND_BOX" , 690801);
  46. define("LEGEND_ROUND" , 690802);
  47. define("LEGEND_VERTICAL" , 690901);
  48. define("LEGEND_HORIZONTAL" , 690902);
  49. define("LEGEND_FAMILY_BOX" , 691051);
  50. define("LEGEND_FAMILY_CIRCLE" , 691052);
  51. define("LEGEND_FAMILY_LINE" , 691053);
  52. define("DISPLAY_AUTO" , 691001);
  53. define("DISPLAY_MANUAL" , 691002);
  54. define("LABELING_ALL" , 691011);
  55. define("LABELING_DIFFERENT" , 691012);
  56. define("BOUND_MIN" , 691021);
  57. define("BOUND_MAX" , 691022);
  58. define("BOUND_BOTH" , 691023);
  59. define("BOUND_LABEL_POS_TOP" , 691031);
  60. define("BOUND_LABEL_POS_BOTTOM" , 691032);
  61. define("BOUND_LABEL_POS_AUTO" , 691033);
  62. define("CAPTION_LEFT_TOP" , 691041);
  63. define("CAPTION_RIGHT_BOTTOM" , 691042);
  64. define("GRADIENT_SIMPLE" , 691051);
  65. define("GRADIENT_EFFECT_CAN" , 691052);
  66. define("LABEL_TITLE_NOBACKGROUND" , 691061);
  67. define("LABEL_TITLE_BACKGROUND" , 691062);
  68. define("LABEL_POINT_NONE" , 691071);
  69. define("LABEL_POINT_CIRCLE" , 691072);
  70. define("LABEL_POINT_BOX" , 691073);
  71. define("ZONE_NAME_ANGLE_AUTO" , 691081);
  72. define("PI" , 3.14159265);
  73. define("ALL" , 69);
  74. define("NONE" , 31);
  75. define("AUTO" , 690000);
  76. define("OUT_OF_SIGHT" , -10000000000000);
  77. class pDraw
  78. {
  79. /* Returns the number of drawable series */
  80. function countDrawableSeries()
  81. {
  82. $Results = 0;
  83. $Data = $this->DataSet->getData();
  84. foreach($Data["Series"] as $SerieName => $Serie)
  85. { if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) { $Results++; } }
  86. return($Results);
  87. }
  88. /* Fix box coordinates */
  89. function fixBoxCoordinates($Xa,$Ya,$Xb,$Yb)
  90. {
  91. $X1 = min($Xa,$Xb); $Y1 = min($Ya,$Yb);
  92. $X2 = max($Xa,$Xb); $Y2 = max($Ya,$Yb);
  93. return(array($X1,$Y1,$X2,$Y2));
  94. }
  95. /* Draw a polygon */
  96. function drawPolygon($Points,$Format="")
  97. {
  98. $R = isset($Format["R"]) ? $Format["R"] : 0;
  99. $G = isset($Format["G"]) ? $Format["G"] : 0;
  100. $B = isset($Format["B"]) ? $Format["B"] : 0;
  101. $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
  102. $NoFill = isset($Format["NoFill"]) ? $Format["NoFill"] : FALSE;
  103. $NoBorder = isset($Format["NoBorder"]) ? $Format["NoBorder"] : FALSE;
  104. $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : $R;
  105. $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : $G;
  106. $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : $B;
  107. $BorderAlpha = isset($Format["Alpha"]) ? $Format["Alpha"] : $Alpha / 2;
  108. $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
  109. $SkipX = isset($Format["SkipX"]) ? $Format["SkipX"] : OUT_OF_SIGHT;
  110. $SkipY = isset($Format["SkipY"]) ? $Format["SkipY"] : OUT_OF_SIGHT;
  111. /* Calling the ImageFilledPolygon() function over the $Points array will round it */
  112. $Backup = $Points;
  113. if ( $Surrounding != NULL ) { $BorderR = $R+$Surrounding; $BorderG = $G+$Surrounding; $BorderB = $B+$Surrounding; }
  114. if ( $SkipX != OUT_OF_SIGHT ) { $SkipX = floor($SkipX); }
  115. if ( $SkipY != OUT_OF_SIGHT ) { $SkipY = floor($SkipY); }
  116. $RestoreShadow = $this->Shadow;
  117. if ( !$NoFill )
  118. {
  119. if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
  120. {
  121. $this->Shadow = FALSE;
  122. for($i=0;$i<=count($Points)-1;$i=$i+2)
  123. { $Shadow[] = $Points[$i] + $this->ShadowX; $Shadow[] = $Points[$i+1] + $this->ShadowY; }
  124. $this->drawPolygon($Shadow,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa,"NoBorder"=>TRUE));
  125. }
  126. $FillColor = $this->allocateColor($this->Picture,$R,$G,$B,$Alpha);
  127. if ( count($Points) >= 6 )
  128. { ImageFilledPolygon($this->Picture,$Points,count($Points)/2,$FillColor); }
  129. }
  130. if ( !$NoBorder )
  131. {
  132. $Points = $Backup;
  133. if ( $NoFill )
  134. $BorderSettings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
  135. else
  136. $BorderSettings = array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha);
  137. for($i=0;$i<=count($Points)-1;$i=$i+2)
  138. {
  139. if ( isset($Points[$i+2]) )
  140. {
  141. if ( !($Points[$i] == $Points[$i+2] && $Points[$i] == $SkipX ) && !($Points[$i+1] == $Points[$i+3] && $Points[$i+1] == $SkipY ) )
  142. $this->drawLine($Points[$i],$Points[$i+1],$Points[$i+2],$Points[$i+3],$BorderSettings);
  143. }
  144. else
  145. {
  146. if ( !($Points[$i] == $Points[0] && $Points[$i] == $SkipX ) && !($Points[$i+1] == $Points[1] && $Points[$i+1] == $SkipY ) )
  147. $this->drawLine($Points[$i],$Points[$i+1],$Points[0],$Points[1],$BorderSettings);
  148. }
  149. }
  150. }
  151. $this->Shadow = $RestoreShadow;
  152. }
  153. /* Apply AALias correction to the rounded box boundaries */
  154. function offsetCorrection($Value,$Mode)
  155. {
  156. $Value = round($Value,1);
  157. if ( $Value == 0 && $Mode == 1 ) { return(.9); }
  158. if ( $Value == 0 ) { return(0); }
  159. if ( $Mode == 1)
  160. { if ( $Value == 1 ) { return(.9); }; if ( $Value == .1 ) { return(.9); }; if ( $Value == .2 ) { return(.8); }; if ( $Value == .3 ) { return(.8); }; if ( $Value == .4 ) { return(.7); }; if ( $Value == .5 ) { return(.5); }; if ( $Value == .6 ) { return(.8); }; if ( $Value == .7 ) { return(.7); }; if ( $Value == .8 ) { return(.6); }; if ( $Value == .9 ) { return(.9); }; }
  161. if ( $Mode == 2)
  162. { if ( $Value == 1 ) { return(.9); }; if ( $Value == .1 ) { return(.1); }; if ( $Value == .2 ) { return(.2); }; if ( $Value == .3 ) { return(.3); }; if ( $Value == .4 ) { return(.4); }; if ( $Value == .5 ) { return(.5); }; if ( $Value == .6 ) { return(.8); }; if ( $Value == .7 ) { return(.7); }; if ( $Value == .8 ) { return(.8); }; if ( $Value == .9 ) { return(.9); }; }
  163. if ( $Mode == 3)
  164. { if ( $Value == 1 ) { return(.1); }; if ( $Value == .1 ) { return(.1); }; if ( $Value == .2 ) { return(.2); }; if ( $Value == .3 ) { return(.3); }; if ( $Value == .4 ) { return(.4); }; if ( $Value == .5 ) { return(.9); }; if ( $Value == .6 ) { return(.6); }; if ( $Value == .7 ) { return(.7); }; if ( $Value == .8 ) { return(.4); }; if ( $Value == .9 ) { return(.5); }; }
  165. if ( $Mode == 4)
  166. { if ( $Value == 1 ) { return(-1); }; if ( $Value == .1 ) { return(.1); }; if ( $Value == .2 ) { return(.2); }; if ( $Value == .3 ) { return(.3); }; if ( $Value == .4 ) { return(.1); }; if ( $Value == .5 ) { return(-.1); }; if ( $Value == .6 ) { return(.8); }; if ( $Value == .7 ) { return(.1); }; if ( $Value == .8 ) { return(.1); }; if ( $Value == .9 ) { return(.1); }; }
  167. }
  168. /* Draw a rectangle with rounded corners */
  169. function drawRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$Format="")
  170. {
  171. $R = isset($Format["R"]) ? $Format["R"] : 0;
  172. $G = isset($Format["G"]) ? $Format["G"] : 0;
  173. $B = isset($Format["B"]) ? $Format["B"] : 0;
  174. $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
  175. list($X1,$Y1,$X2,$Y2) = $this->fixBoxCoordinates($X1,$Y1,$X2,$Y2);
  176. if ( $X2 - $X1 < $Radius ) { $Radius = floor((($X2-$X1))/2); }
  177. if ( $Y2 - $Y1 < $Radius ) { $Radius = floor((($Y2-$Y1))/2); }
  178. $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"NoBorder"=>TRUE);
  179. if ( $Radius <= 0 ) { $this->drawRectangle($X1,$Y1,$X2,$Y2,$Color); return(0); }
  180. if ( $this->Antialias )
  181. {
  182. $this->drawLine($X1+$Radius,$Y1,$X2-$Radius,$Y1,$Color);
  183. $this->drawLine($X2,$Y1+$Radius,$X2,$Y2-$Radius,$Color);
  184. $this->drawLine($X2-$Radius,$Y2,$X1+$Radius,$Y2,$Color);
  185. $this->drawLine($X1,$Y1+$Radius,$X1,$Y2-$Radius,$Color);
  186. }
  187. else
  188. {
  189. $Color = $this->allocateColor($this->Picture,$R,$G,$B,$Alpha);
  190. imageline($this->Picture,$X1+$Radius,$Y1,$X2-$Radius,$Y1,$Color);
  191. imageline($this->Picture,$X2,$Y1+$Radius,$X2,$Y2-$Radius,$Color);
  192. imageline($this->Picture,$X2-$Radius,$Y2,$X1+$Radius,$Y2,$Color);
  193. imageline($this->Picture,$X1,$Y1+$Radius,$X1,$Y2-$Radius,$Color);
  194. }
  195. $Step = 360 / (2 * PI * $Radius);
  196. for($i=0;$i<=90;$i=$i+$Step)
  197. {
  198. $X = cos(($i+180)*PI/180) * $Radius + $X1 + $Radius;
  199. $Y = sin(($i+180)*PI/180) * $Radius + $Y1 + $Radius;
  200. $this->drawAntialiasPixel($X,$Y,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
  201. $X = cos(($i+90)*PI/180) * $Radius + $X1 + $Radius;
  202. $Y = sin(($i+90)*PI/180) * $Radius + $Y2 - $Radius;
  203. $this->drawAntialiasPixel($X,$Y,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
  204. $X = cos($i*PI/180) * $Radius + $X2 - $Radius;
  205. $Y = sin($i*PI/180) * $Radius + $Y2 - $Radius;
  206. $this->drawAntialiasPixel($X,$Y,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
  207. $X = cos(($i+270)*PI/180) * $Radius + $X2 - $Radius;
  208. $Y = sin(($i+270)*PI/180) * $Radius + $Y1 + $Radius;
  209. $this->drawAntialiasPixel($X,$Y,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
  210. }
  211. }
  212. /* Draw a rectangle with rounded corners */
  213. function drawRoundedFilledRectangle($X1,$Y1,$X2,$Y2,$Radius,$Format="")
  214. {
  215. $R = isset($Format["R"]) ? $Format["R"] : 0;
  216. $G = isset($Format["G"]) ? $Format["G"] : 0;
  217. $B = isset($Format["B"]) ? $Format["B"] : 0;
  218. $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : -1;
  219. $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : -1;
  220. $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : -1;
  221. $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
  222. $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
  223. /* Temporary fix for AA issue */
  224. $Y1 = floor($Y1); $Y2 = floor($Y2); $X1 = floor($X1); $X2 = floor($X2);
  225. if ( $Surrounding != NULL ) { $BorderR = $R+$Surrounding; $BorderG = $G+$Surrounding; $BorderB = $B+$Surrounding; }
  226. if ( $BorderR == -1 ) { $BorderR = $R; $BorderG = $G; $BorderB = $B; }
  227. list($X1,$Y1,$X2,$Y2) = $this->fixBoxCoordinates($X1,$Y1,$X2,$Y2);
  228. if ( $X2 - $X1 < $Radius*2 ) { $Radius = floor((($X2-$X1))/4); }
  229. if ( $Y2 - $Y1 < $Radius*2 ) { $Radius = floor((($Y2-$Y1))/4); }
  230. $RestoreShadow = $this->Shadow;
  231. if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
  232. {
  233. $this->Shadow = FALSE;
  234. $this->drawRoundedFilledRectangle($X1+$this->ShadowX,$Y1+$this->ShadowY,$X2+$this->ShadowX,$Y2+$this->ShadowY,$Radius,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa));
  235. }
  236. $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"NoBorder"=>TRUE);
  237. if ( $Radius <= 0 ) { $this->drawFilledRectangle($X1,$Y1,$X2,$Y2,$Color); return(0); }
  238. $YTop = $Y1+$Radius;
  239. $YBottom = $Y2-$Radius;
  240. $Step = 360 / (2 * PI * $Radius);
  241. $Positions = ""; $Radius--; $MinY = ""; $MaxY = "";
  242. for($i=0;$i<=90;$i=$i+$Step)
  243. {
  244. $Xp1 = cos(($i+180)*PI/180) * $Radius + $X1 + $Radius;
  245. $Xp2 = cos(((90-$i)+270)*PI/180) * $Radius + $X2 - $Radius;
  246. $Yp = floor(sin(($i+180)*PI/180) * $Radius + $YTop);
  247. if ( $MinY == "" || $Yp > $MinY ) { $MinY = $Yp; }
  248. if ( $Xp1 <= floor($X1) ) { $Xp1++; }
  249. if ( $Xp2 >= floor($X2) ) { $Xp2--; }
  250. $Xp1++;
  251. if ( !isset($Positions[$Yp]) )
  252. { $Positions[$Yp]["X1"] = $Xp1; $Positions[$Yp]["X2"] = $Xp2; }
  253. else
  254. { $Positions[$Yp]["X1"] = ($Positions[$Yp]["X1"]+$Xp1)/2; $Positions[$Yp]["X2"] = ($Positions[$Yp]["X2"]+$Xp2)/2; }
  255. $Xp1 = cos(($i+90)*PI/180) * $Radius + $X1 + $Radius;
  256. $Xp2 = cos((90-$i)*PI/180) * $Radius + $X2 - $Radius;
  257. $Yp = floor(sin(($i+90)*PI/180) * $Radius + $YBottom);
  258. if ( $MaxY == "" || $Yp < $MaxY ) { $MaxY = $Yp; }
  259. if ( $Xp1 <= floor($X1) ) { $Xp1++; }
  260. if ( $Xp2 >= floor($X2) ) { $Xp2--; }
  261. $Xp1++;
  262. if ( !isset($Positions[$Yp]) )
  263. { $Positions[$Yp]["X1"] = $Xp1; $Positions[$Yp]["X2"] = $Xp2; }
  264. else
  265. { $Positions[$Yp]["X1"] = ($Positions[$Yp]["X1"]+$Xp1)/2; $Positions[$Yp]["X2"] = ($Positions[$Yp]["X2"]+$Xp2)/2; }
  266. }
  267. $ManualColor = $this->allocateColor($this->Picture,$R,$G,$B,$Alpha);
  268. foreach($Positions as $Yp => $Bounds)
  269. {
  270. $X1 = $Bounds["X1"]; $X1Dec = $this->getFirstDecimal($X1); if ( $X1Dec != 0 ) { $X1 = floor($X1)+1; }
  271. $X2 = $Bounds["X2"]; $X2Dec = $this->getFirstDecimal($X2); if ( $X2Dec != 0 ) { $X2 = floor($X2)-1; }
  272. imageline($this->Picture,$X1,$Yp,$X2,$Yp,$ManualColor);
  273. }
  274. $this->drawFilledRectangle($X1,$MinY+1,floor($X2),$MaxY-1,$Color);
  275. $Radius++;
  276. $this->drawRoundedRectangle($X1,$Y1,$X2+1,$Y2-1,$Radius,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$Alpha));
  277. $this->Shadow = $RestoreShadow;
  278. }
  279. /* Draw a rectangle with rounded corners */
  280. function drawRoundedFilledRectangle_deprecated($X1,$Y1,$X2,$Y2,$Radius,$Format="")
  281. {
  282. $R = isset($Format["R"]) ? $Format["R"] : 0;
  283. $G = isset($Format["G"]) ? $Format["G"] : 0;
  284. $B = isset($Format["B"]) ? $Format["B"] : 0;
  285. $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : -1;
  286. $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : -1;
  287. $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : -1;
  288. $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
  289. $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
  290. if ( $Surrounding != NULL ) { $BorderR = $R+$Surrounding; $BorderG = $G+$Surrounding; $BorderB = $B+$Surrounding; }
  291. if ( $BorderR == -1 ) { $BorderR = $R; $BorderG = $G; $BorderB = $B; }
  292. list($X1,$Y1,$X2,$Y2) = $this->fixBoxCoordinates($X1,$Y1,$X2,$Y2);
  293. if ( $X2 - $X1 < $Radius ) { $Radius = floor((($X2-$X1)+2)/2); }
  294. if ( $Y2 - $Y1 < $Radius ) { $Radius = floor((($Y2-$Y1)+2)/2); }
  295. $RestoreShadow = $this->Shadow;
  296. if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
  297. {
  298. $this->Shadow = FALSE;
  299. $this->drawRoundedFilledRectangle($X1+$this->ShadowX,$Y1+$this->ShadowY,$X2+$this->ShadowX,$Y2+$this->ShadowY,$Radius,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa));
  300. }
  301. if ( $this->getFirstDecimal($X2) >= 5 ) { $XOffset2 = 1; } else { $XOffset2 = 0; }
  302. if ( $this->getFirstDecimal($X1) <= 5 ) { $XOffset1 = 1; } else { $XOffset1 = 0; }
  303. if ( !$this->Antialias ) { $XOffset1 = 1; $XOffset2 = 1; }
  304. $YTop = floor($Y1+$Radius);
  305. $YBottom = floor($Y2-$Radius);
  306. $this->drawFilledRectangle($X1-$XOffset1,$YTop,$X2+$XOffset2,$YBottom,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"NoBorder"=>TRUE));
  307. $Step = 360 / (2 * PI * $Radius);
  308. $Color = $this->allocateColor($this->Picture,$R,$G,$B,$Alpha);
  309. $Color2 = $this->allocateColor($this->Picture,255,0,0,$Alpha);
  310. $Drawn = "";
  311. if ( $Alpha < 100 ) { $Drawn[$YTop] = FALSE; }
  312. if ( $Alpha < 100 ) { $Drawn[$YBottom] = TRUE; }
  313. for($i=0;$i<=90;$i=$i+$Step)
  314. {
  315. $Xp1 = cos(($i+180)*PI/180) * $Radius + $X1 + $Radius;
  316. $Xp2 = cos(((90-$i)+270)*PI/180) * $Radius + $X2 - $Radius;
  317. $Yp = sin(($i+180)*PI/180) * $Radius + $YTop;
  318. if ( $this->getFirstDecimal($Xp1) > 5 ) { $XOffset1 = 1; } else { $XOffset1 = 0; }
  319. if ( $this->getFirstDecimal($Xp2) > 5 ) { $XOffset2 = 1; } else { $XOffset2 = 0; }
  320. if ( $this->getFirstDecimal($Yp) > 5 ) { $YOffset = 1; } else { $YOffset = 0; }
  321. if ( !isset($Drawn[$Yp+$YOffset]) || $Alpha == 100 )
  322. imageline($this->Picture,$Xp1+$XOffset1,$Yp+$YOffset,$Xp2+$XOffset2,$Yp+$YOffset,$Color);
  323. $Drawn[$Yp+$YOffset] = $Xp2;
  324. $Xp1 = cos(($i+90)*PI/180) * $Radius + $X1 + $Radius;
  325. $Xp2 = cos((90-$i)*PI/180) * $Radius + $X2 - $Radius;
  326. $Yp = sin(($i+90)*PI/180) * $Radius + $YBottom;
  327. if ( $this->getFirstDecimal($Xp1) > 7 ) { $XOffset1 = 1; } else { $XOffset1 = 0; }
  328. if ( $this->getFirstDecimal($Xp2) > 7 ) { $XOffset2 = 1; } else { $XOffset2 = 0; }
  329. if ( $this->getFirstDecimal($Yp) > 5 ) { $YOffset = 1; } else { $YOffset = 0; }
  330. if ( !isset($Drawn[$Yp+$YOffset]) || $Alpha == 100 )
  331. imageline($this->Picture,$Xp1+$XOffset1,$Yp+$YOffset,$Xp2+$XOffset2,$Yp+$YOffset,$Color);
  332. $Drawn[$Yp+$YOffset] = $Xp2;
  333. }
  334. $this->drawRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$Alpha));
  335. $this->Shadow = $RestoreShadow;
  336. }
  337. /* Draw a rectangle */
  338. function drawRectangle($X1,$Y1,$X2,$Y2,$Format="")
  339. {
  340. $R = isset($Format["R"]) ? $Format["R"] : 0;
  341. $G = isset($Format["G"]) ? $Format["G"] : 0;
  342. $B = isset($Format["B"]) ? $Format["B"] : 0;
  343. $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
  344. $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL;
  345. $NoAngle = isset($Format["NoAngle"]) ? $Format["NoAngle"] : FALSE;
  346. if ($X1 > $X2) { list($X1, $X2) = array($X2, $X1); }
  347. if ($Y1 > $Y2) { list($Y1, $Y2) = array($Y2, $Y1); }
  348. if ( $this->Antialias )
  349. {
  350. if ( $NoAngle )
  351. {
  352. $this->drawLine($X1+1,$Y1,$X2-1,$Y1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
  353. $this->drawLine($X2,$Y1+1,$X2,$Y2-1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
  354. $this->drawLine($X2-1,$Y2,$X1+1,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
  355. $this->drawLine($X1,$Y1+1,$X1,$Y2-1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
  356. }
  357. else
  358. {
  359. $this->drawLine($X1+1,$Y1,$X2-1,$Y1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
  360. $this->drawLine($X2,$Y1,$X2,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
  361. $this->drawLine($X2-1,$Y2,$X1+1,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
  362. $this->drawLine($X1,$Y1,$X1,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
  363. }
  364. }
  365. else
  366. {
  367. $Color = $this->allocateColor($this->Picture,$R,$G,$B,$Alpha);
  368. imagerectangle($this->Picture,$X1,$Y1,$X2,$Y2,$Color);
  369. }
  370. }
  371. /* Draw a filled rectangle */
  372. function drawFilledRectangle($X1,$Y1,$X2,$Y2,$Format="")
  373. {
  374. $R = isset($Format["R"]) ? $Format["R"] : 0;
  375. $G = isset($Format["G"]) ? $Format["G"] : 0;
  376. $B = isset($Format["B"]) ? $Format["B"] : 0;
  377. $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
  378. $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : -1;
  379. $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : -1;
  380. $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : -1;
  381. $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : $Alpha;
  382. $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
  383. $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL;
  384. $NoAngle = isset($Format["NoAngle"]) ? $Format["NoAngle"] : NULL;
  385. $Dash = isset($Format["Dash"]) ? $Format["Dash"] : FALSE;
  386. $DashStep = isset($Format["DashStep"]) ? $Format["DashStep"] : 4;
  387. $DashR = isset($Format["DashR"]) ? $Format["DashR"] : 0;
  388. $DashG = isset($Format["DashG"]) ? $Format["DashG"] : 0;
  389. $DashB = isset($Format["DashB"]) ? $Format["DashB"] : 0;
  390. $NoBorder = isset($Format["NoBorder"]) ? $Format["NoBorder"] : FALSE;
  391. if ( $Surrounding != NULL ) { $BorderR = $R+$Surrounding; $BorderG = $G+$Surrounding; $BorderB = $B+$Surrounding; }
  392. if ($X1 > $X2) { list($X1, $X2) = array($X2, $X1); }
  393. if ($Y1 > $Y2) { list($Y1, $Y2) = array($Y2, $Y1); }
  394. $RestoreShadow = $this->Shadow;
  395. if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
  396. {
  397. $this->Shadow = FALSE;
  398. $this->drawFilledRectangle($X1+$this->ShadowX,$Y1+$this->ShadowY,$X2+$this->ShadowX,$Y2+$this->ShadowY,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa,"Ticks"=>$Ticks,"NoAngle"=>$NoAngle));
  399. }
  400. $Color = $this->allocateColor($this->Picture,$R,$G,$B,$Alpha);
  401. if ( $NoAngle )
  402. {
  403. imagefilledrectangle($this->Picture,ceil($X1)+1,ceil($Y1),floor($X2)-1,floor($Y2),$Color);
  404. imageline($this->Picture,ceil($X1),ceil($Y1)+1,ceil($X1),floor($Y2)-1,$Color);
  405. imageline($this->Picture,floor($X2),ceil($Y1)+1,floor($X2),floor($Y2)-1,$Color);
  406. }
  407. else
  408. imagefilledrectangle($this->Picture,ceil($X1),ceil($Y1),floor($X2),floor($Y2),$Color);
  409. if ( $Dash )
  410. {
  411. if ( $BorderR != -1 ) { $iX1=$X1+1; $iY1=$Y1+1; $iX2=$X2-1; $iY2=$Y2-1; } else { $iX1=$X1; $iY1=$Y1; $iX2=$X2; $iY2=$Y2; }
  412. $Color = $this->allocateColor($this->Picture,$DashR,$DashG,$DashB,$Alpha);
  413. $Y=$iY1-$DashStep;
  414. for($X=$iX1; $X<=$iX2+($iY2-$iY1); $X=$X+$DashStep)
  415. {
  416. $Y=$Y+$DashStep;
  417. if ( $X > $iX2 ) { $Xa = $X-($X-$iX2); $Ya = $iY1+($X-$iX2); } else { $Xa = $X; $Ya = $iY1; }
  418. if ( $Y > $iY2 ) { $Xb = $iX1+($Y-$iY2); $Yb = $Y-($Y-$iY2); } else { $Xb = $iX1; $Yb = $Y; }
  419. imageline($this->Picture,$Xa,$Ya,$Xb,$Yb,$Color);
  420. }
  421. }
  422. if ( $this->Antialias && !$NoBorder )
  423. {
  424. if ( $X1 < ceil($X1) )
  425. {
  426. $AlphaA = $Alpha * (ceil($X1) - $X1);
  427. $Color = $this->allocateColor($this->Picture,$R,$G,$B,$AlphaA);
  428. imageline($this->Picture,ceil($X1)-1,ceil($Y1),ceil($X1)-1,floor($Y2),$Color);
  429. }
  430. if ( $Y1 < ceil($Y1) )
  431. {
  432. $AlphaA = $Alpha * (ceil($Y1) - $Y1);
  433. $Color = $this->allocateColor($this->Picture,$R,$G,$B,$AlphaA);
  434. imageline($this->Picture,ceil($X1),ceil($Y1)-1,floor($X2),ceil($Y1)-1,$Color);
  435. }
  436. if ( $X2 > floor($X2) )
  437. {
  438. $AlphaA = $Alpha * (.5-($X2 - floor($X2)));
  439. $Color = $this->allocateColor($this->Picture,$R,$G,$B,$AlphaA);
  440. imageline($this->Picture,floor($X2)+1,ceil($Y1),floor($X2)+1,floor($Y2),$Color);
  441. }
  442. if ( $Y2 > floor($Y2) )
  443. {
  444. $AlphaA = $Alpha * (.5-($Y2 - floor($Y2)));
  445. $Color = $this->allocateColor($this->Picture,$R,$G,$B,$AlphaA);
  446. imageline($this->Picture,ceil($X1),floor($Y2)+1,floor($X2),floor($Y2)+1,$Color);
  447. }
  448. }
  449. if ( $BorderR != -1 )
  450. $this->drawRectangle($X1,$Y1,$X2,$Y2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$Ticks,"NoAngle"=>$NoAngle));
  451. $this->Shadow = $RestoreShadow;
  452. }
  453. /* Draw a rectangular marker of the specified size */
  454. function drawRectangleMarker($X,$Y,$Format="")
  455. {
  456. $Size = isset($Format["Size"]) ? $Format["Size"] : 4;
  457. $HalfSize = floor($Size/2);
  458. $this->drawFilledRectangle($X-$HalfSize,$Y-$HalfSize,$X+$HalfSize,$Y+$HalfSize,$Format);
  459. }
  460. /* Drawn a spline based on the bezier function */
  461. function drawSpline($Coordinates,$Format="")
  462. {
  463. $R = isset($Format["R"]) ? $Format["R"] : 0;
  464. $G = isset($Format["G"]) ? $Format["G"] : 0;
  465. $B = isset($Format["B"]) ? $Format["B"] : 0;
  466. $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
  467. $Force = isset($Format["Force"]) ? $Format["Force"] : 30;
  468. $Forces = isset($Format["Forces"]) ? $Format["Forces"] : NULL;
  469. $ShowC = isset($Format["ShowControl"]) ? $Format["ShowControl"] : FALSE;
  470. $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL;
  471. $PathOnly = isset($Format["PathOnly"]) ? $Format["PathOnly"] : FALSE;
  472. $Weight = isset($Format["Weight"]) ? $Format["Weight"] : NULL;
  473. $Cpt = NULL; $Mode = NULL; $Result = "";
  474. for($i=1;$i<=count($Coordinates)-1;$i++)
  475. {
  476. $X1 = $Coordinates[$i-1][0]; $Y1 = $Coordinates[$i-1][1];
  477. $X2 = $Coordinates[$i][0]; $Y2 = $Coordinates[$i][1];
  478. if ( $Forces != NULL ) { $Force = $Forces[$i]; }
  479. /* First segment */
  480. if ( $i == 1 )
  481. { $Xv1 = $X1; $Yv1 = $Y1; }
  482. else
  483. {
  484. $Angle1 = $this->getAngle($XLast,$YLast,$X1,$Y1);
  485. $Angle2 = $this->getAngle($X1,$Y1,$X2,$Y2);
  486. $XOff = cos($Angle2 * PI / 180) * $Force + $X1;
  487. $YOff = sin($Angle2 * PI / 180) * $Force + $Y1;
  488. $Xv1 = cos($Angle1 * PI / 180) * $Force + $XOff;
  489. $Yv1 = sin($Angle1 * PI / 180) * $Force + $YOff;
  490. }
  491. /* Last segment */
  492. if ( $i == count($Coordinates)-1 )
  493. { $Xv2 = $X2; $Yv2 = $Y2; }
  494. else
  495. {
  496. $Angle1 = $this->getAngle($X2,$Y2,$Coordinates[$i+1][0],$Coordinates[$i+1][1]);
  497. $Angle2 = $this->getAngle($X1,$Y1,$X2,$Y2);
  498. $XOff = cos(($Angle2+180) * PI / 180) * $Force + $X2;
  499. $YOff = sin(($Angle2+180) * PI / 180) * $Force + $Y2;
  500. $Xv2 = cos(($Angle1+180) * PI / 180) * $Force + $XOff;
  501. $Yv2 = sin(($Angle1+180) * PI / 180) * $Force + $YOff;
  502. }
  503. $Path = $this->drawBezier($X1,$Y1,$X2,$Y2,$Xv1,$Yv1,$Xv2,$Yv2,$Format);
  504. if ($PathOnly) { $Result[] = $Path; }
  505. $XLast = $X1; $YLast = $Y1;
  506. }
  507. return($Result);
  508. }
  509. /* Draw a bezier curve with two controls points */
  510. function drawBezier($X1,$Y1,$X2,$Y2,$Xv1,$Yv1,$Xv2,$Yv2,$Format="")
  511. {
  512. $R = isset($Format["R"]) ? $Format["R"] : 0;
  513. $G = isset($Format["G"]) ? $Format["G"] : 0;
  514. $B = isset($Format["B"]) ? $Format["B"] : 0;
  515. $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
  516. $ShowC = isset($Format["ShowControl"]) ? $Format["ShowControl"] : FALSE;
  517. $Segments = isset($Format["Segments"]) ? $Format["Segments"] : NULL;
  518. $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL;
  519. $NoDraw = isset($Format["NoDraw"]) ? $Format["NoDraw"] : FALSE;
  520. $PathOnly = isset($Format["PathOnly"]) ? $Format["PathOnly"] : FALSE;
  521. $Weight = isset($Format["Weight"]) ? $Format["Weight"] : NULL;
  522. $DrawArrow = isset($Format["DrawArrow"]) ? $Format["DrawArrow"] : FALSE;
  523. $ArrowSize = isset($Format["ArrowSize"]) ? $Format["ArrowSize"] : 10;
  524. $ArrowRatio = isset($Format["ArrowRatio"]) ? $Format["ArrowRatio"] : .5;
  525. $ArrowTwoHeads = isset($Format["ArrowTwoHeads"]) ? $Format["ArrowTwoHeads"] : FALSE;
  526. if ( $Segments == NULL )
  527. {
  528. $Length = $this->getLength($X1,$Y1,$X2,$Y2);
  529. $Precision = ($Length*125)/1000;
  530. }
  531. else
  532. $Precision = $Segments;
  533. $P[0]["X"] = $X1; $P[0]["Y"] = $Y1;
  534. $P[1]["X"] = $Xv1; $P[1]["Y"] = $Yv1;
  535. $P[2]["X"] = $Xv2; $P[2]["Y"] = $Yv2;
  536. $P[3]["X"] = $X2; $P[3]["Y"] = $Y2;
  537. /* Compute the bezier points */
  538. $Q = ""; $ID = 0; $Path = "";
  539. for($i=0;$i<=$Precision;$i=$i+1)
  540. {
  541. $u = $i / $Precision;
  542. $C = "";
  543. $C[0] = (1 - $u) * (1 - $u) * (1 - $u);
  544. $C[1] = ($u * 3) * (1 - $u) * (1 - $u);
  545. $C[2] = 3 * $u * $u * (1 - $u);
  546. $C[3] = $u * $u * $u;
  547. for($j=0;$j<=3;$j++)
  548. {
  549. if ( !isset($Q[$ID]) ) { $Q[$ID] = ""; }
  550. if ( !isset($Q[$ID]["X"]) ) { $Q[$ID]["X"] = 0; }
  551. if ( !isset($Q[$ID]["Y"]) ) { $Q[$ID]["Y"] = 0; }
  552. $Q[$ID]["X"] = $Q[$ID]["X"] + $P[$j]["X"] * $C[$j];
  553. $Q[$ID]["Y"] = $Q[$ID]["Y"] + $P[$j]["Y"] * $C[$j];
  554. }
  555. $ID++;
  556. }
  557. $Q[$ID]["X"] = $X2; $Q[$ID]["Y"] = $Y2;
  558. if ( !$NoDraw )
  559. {
  560. /* Display the control points */
  561. if ( $ShowC && !$PathOnly )
  562. {
  563. $Xv1 = floor($Xv1); $Yv1 = floor($Yv1); $Xv2 = floor($Xv2); $Yv2 = floor($Yv2);
  564. $this->drawLine($X1,$Y1,$X2,$Y2,array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>30));
  565. $MyMarkerSettings = array("R"=>255,"G"=>0,"B"=>0,"BorderR"=>255,"BorderB"=>255,"BorderG"=>255,"Size"=>4);
  566. $this->drawRectangleMarker($Xv1,$Yv1,$MyMarkerSettings);
  567. $this->drawText($Xv1+4,$Yv1,"v1");
  568. $MyMarkerSettings = array("R"=>0,"G"=>0,"B"=>255,"BorderR"=>255,"BorderB"=>255,"BorderG"=>255,"Size"=>4);
  569. $this->drawRectangleMarker($Xv2,$Yv2,$MyMarkerSettings);
  570. $this->drawText($Xv2+4,$Yv2,"v2");
  571. }
  572. /* Draw the bezier */
  573. $LastX = NULL; $LastY = NULL; $Cpt = NULL; $Mode = NULL; $ArrowS = NULL;
  574. foreach ($Q as $Key => $Point)
  575. {
  576. $X = $Point["X"]; $Y = $Point["Y"];
  577. /* Get the first segment */
  578. if ( $ArrowS == NULL && $LastX != NULL && $LastY != NULL )
  579. { $ArrowS["X2"] = $LastX; $ArrowS["Y2"] = $LastY; $ArrowS["X1"] = $X; $ArrowS["Y1"] = $Y; }
  580. if ( $LastX != NULL && $LastY != NULL && !$PathOnly)
  581. list($Cpt,$Mode) = $this->drawLine($LastX,$LastY,$X,$Y,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Cpt"=>$Cpt,"Mode"=>$Mode,"Weight"=>$Weight));
  582. /* Get the last segment */
  583. $ArrowE["X1"] = $LastX; $ArrowE["Y1"] = $LastY; $ArrowE["X2"] = $X; $ArrowE["Y2"] = $Y;
  584. $LastX = $X; $LastY = $Y;
  585. }
  586. if ( $DrawArrow && !$PathOnly )
  587. {
  588. $ArrowSettings = array("FillR"=>$R,"FillG"=>$G,"FillB"=>$B,"Alpha"=>$Alpha,"Size"=>$ArrowSize,"Ratio"=>$ArrowRatio);
  589. if ( $ArrowTwoHeads )
  590. $this->drawArrow($ArrowS["X1"],$ArrowS["Y1"],$ArrowS["X2"],$ArrowS["Y2"],$ArrowSettings);
  591. $this->drawArrow($ArrowE["X1"],$ArrowE["Y1"],$ArrowE["X2"],$ArrowE["Y2"],$ArrowSettings);
  592. }
  593. }
  594. return($Q);
  595. }
  596. /* Draw a line between two points */
  597. function drawLine($X1,$Y1,$X2,$Y2,$Format="")
  598. {
  599. $R = isset($Format["R"]) ? $Format["R"] : 0;
  600. $G = isset($Format["G"]) ? $Format["G"] : 0;
  601. $B = isset($Format["B"]) ? $Format["B"] : 0;
  602. $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
  603. $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL;
  604. $Cpt = isset($Format["Cpt"]) ? $Format["Cpt"] : 1;
  605. $Mode = isset($Format["Mode"]) ? $Format["Mode"] : 1;
  606. $Weight = isset($Format["Weight"]) ? $Format["Weight"] : NULL;
  607. $Threshold = isset($Format["Threshold"]) ? $Format["Threshold"] : NULL;
  608. if ( $this->Antialias == FALSE && $Ticks == NULL )
  609. {
  610. if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
  611. {
  612. $ShadowColor = $this->allocateColor($this->Picture,$this->ShadowR,$this->ShadowG,$this->ShadowB,$this->Shadowa);
  613. imageline($this->Picture,$X1+$this->ShadowX,$Y1+$this->ShadowY,$X2+$this->ShadowX,$Y2+$this->ShadowY,$ShadowColor);
  614. }
  615. $Color = $this->allocateColor($this->Picture,$R,$G,$B,$Alpha);
  616. imageline($this->Picture,$X1,$Y1,$X2,$Y2,$Color);
  617. return(0);
  618. }
  619. $Distance = sqrt(($X2-$X1)*($X2-$X1)+($Y2-$Y1)*($Y2-$Y1));
  620. if ( $Distance == 0 ) { return(-1); }
  621. /* Derivative algorithm for overweighted lines, re-route to polygons primitives */
  622. if ( $Weight != NULL )
  623. {
  624. $Angle = $this->getAngle($X1,$Y1,$X2,$Y2);
  625. $PolySettings = array ("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"BorderAlpha"=>$Alpha);
  626. if ( $Ticks == NULL )
  627. {
  628. $Points = "";
  629. $Points[] = cos(deg2rad($Angle-90)) * $Weight + $X1; $Points[] = sin(deg2rad($Angle-90)) * $Weight + $Y1;
  630. $Points[] = cos(deg2rad($Angle+90)) * $Weight + $X1; $Points[] = sin(deg2rad($Angle+90)) * $Weight + $Y1;
  631. $Points[] = cos(deg2rad($Angle+90)) * $Weight + $X2; $Points[] = sin(deg2rad($Angle+90)) * $Weight + $Y2;
  632. $Points[] = cos(deg2rad($Angle-90)) * $Weight + $X2; $Points[] = sin(deg2rad($Angle-90)) * $Weight + $Y2;
  633. $this->drawPolygon($Points,$PolySettings);
  634. }
  635. else
  636. {
  637. for($i=0;$i<=$Distance;$i=$i+$Ticks*2)
  638. {
  639. $Xa = (($X2-$X1)/$Distance) * $i + $X1; $Ya = (($Y2-$Y1)/$Distance) * $i + $Y1;
  640. $Xb = (($X2-$X1)/$Distance) * ($i+$Ticks) + $X1; $Yb = (($Y2-$Y1)/$Distance) * ($i+$Ticks) + $Y1;
  641. $Points = "";
  642. $Points[] = cos(deg2rad($Angle-90)) * $Weight + $Xa; $Points[] = sin(deg2rad($Angle-90)) * $Weight + $Ya;
  643. $Points[] = cos(deg2rad($Angle+90)) * $Weight + $Xa; $Points[] = sin(deg2rad($Angle+90)) * $Weight + $Ya;
  644. $Points[] = cos(deg2rad($Angle+90)) * $Weight + $Xb; $Points[] = sin(deg2rad($Angle+90)) * $Weight + $Yb;
  645. $Points[] = cos(deg2rad($Angle-90)) * $Weight + $Xb; $Points[] = sin(deg2rad($Angle-90)) * $Weight + $Yb;
  646. $this->drawPolygon($Points,$PolySettings);
  647. }
  648. }
  649. return(1);
  650. }
  651. $XStep = ($X2-$X1) / $Distance;
  652. $YStep = ($Y2-$Y1) / $Distance;
  653. for($i=0;$i<=$Distance;$i++)
  654. {
  655. $X = $i * $XStep + $X1;
  656. $Y = $i * $YStep + $Y1;
  657. $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
  658. if ( $Threshold != NULL )
  659. {
  660. foreach($Threshold as $Key => $Parameters)
  661. {
  662. if ( $Y <= $Parameters["MinX"] && $Y >= $Parameters["MaxX"])
  663. {
  664. if ( isset($Parameters["R"]) ) { $RT = $Parameters["R"]; } else { $RT = 0; }
  665. if ( isset($Parameters["G"]) ) { $GT = $Parameters["G"]; } else { $GT = 0; }
  666. if ( isset($Parameters["B"]) ) { $BT = $Parameters["B"]; } else { $BT = 0; }
  667. if ( isset($Parameters["Alpha"]) ) { $AlphaT = $Parameters["Alpha"]; } else { $AlphaT = 0; }
  668. $Color = array("R"=>$RT,"G"=>$GT,"B"=>$BT,"Alpha"=>$AlphaT);
  669. }
  670. }
  671. }
  672. if ( $Ticks != NULL )
  673. {
  674. if ( $Cpt % $Ticks == 0 )
  675. { $Cpt = 0; if ( $Mode == 1 ) { $Mode = 0; } else { $Mode = 1; } }
  676. if ( $Mode == 1 )
  677. $this->drawAntialiasPixel($X,$Y,$Color);
  678. $Cpt++;
  679. }
  680. else
  681. $this->drawAntialiasPixel($X,$Y,$Color);
  682. }
  683. return(array($Cpt,$Mode));
  684. }
  685. /* Draw a circle */
  686. function drawCircle($Xc,$Yc,$Height,$Width,$Format="")
  687. {
  688. $R = isset($Format["R"]) ? $Format["R"] : 0;
  689. $G = isset($Format["G"]) ? $Format["G"] : 0;
  690. $B = isset($Format["B"]) ? $Format["B"] : 0;
  691. $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
  692. $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL;
  693. $Height = abs($Height);
  694. $Width = abs($Width);
  695. if ( $Height == 0 ) { $Height = 1; }
  696. if ( $Width == 0 ) { $Width = 1; }
  697. $Xc = floor($Xc); $Yc = floor($Yc);
  698. $RestoreShadow = $this->Shadow;
  699. if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
  700. {
  701. $this->Shadow = FALSE;
  702. $this->drawCircle($Xc+$this->ShadowX,$Yc+$this->ShadowY,$Height,$Width,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa,"Ticks"=>$Ticks));
  703. }
  704. if ( $Width == 0 ) { $Width = $Height; }
  705. if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
  706. if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
  707. if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
  708. $Step = 360 / (2 * PI * max($Width,$Height));
  709. $Mode = 1; $Cpt = 1;
  710. for($i=0;$i<=360;$i=$i+$Step)
  711. {
  712. $X = cos($i*PI/180) * $Height + $Xc;
  713. $Y = sin($i*PI/180) * $Width + $Yc;
  714. if ( $Ticks != NULL )
  715. {
  716. if ( $Cpt % $Ticks == 0 )
  717. { $Cpt = 0; if ( $Mode == 1 ) { $Mode = 0; } else { $Mode = 1; } }
  718. if ( $Mode == 1 )
  719. $this->drawAntialiasPixel($X,$Y,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
  720. $Cpt++;
  721. }
  722. else
  723. $this->drawAntialiasPixel($X,$Y,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
  724. }
  725. $this->Shadow = $RestoreShadow;
  726. }
  727. /* Draw a filled circle */
  728. function drawFilledCircle($X,$Y,$Radius,$Format="")
  729. {
  730. $R = isset($Format["R"]) ? $Format["R"] : 0;
  731. $G = isset($Format["G"]) ? $Format["G"] : 0;
  732. $B = isset($Format["B"]) ? $Format["B"] : 0;
  733. $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
  734. $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : -1;
  735. $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : -1;
  736. $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : -1;
  737. $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : $Alpha;
  738. $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL;
  739. $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
  740. if ( $Radius == 0 ) { $Radius = 1; }
  741. if ( $Surrounding != NULL ) { $BorderR = $R+$Surrounding; $BorderG = $G+$Surrounding; $BorderB = $B+$Surrounding; }
  742. $X = floor($X); $Y = floor($Y);
  743. $Radius = abs($Radius);
  744. $RestoreShadow = $this->Shadow;
  745. if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
  746. {
  747. $this->Shadow = FALSE;
  748. $this->drawFilledCircle($X+$this->ShadowX,$Y+$this->ShadowY,$Radius,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa,"Ticks"=>$Ticks));
  749. }
  750. $this->Mask = "";
  751. $Color = $this->allocateColor($this->Picture,$R,$G,$B,$Alpha);
  752. for ($i=0; $i<=$Radius*2; $i++)
  753. {
  754. $Slice = sqrt($Radius * $Radius - ($Radius - $i) * ($Radius - $i));
  755. $XPos = floor($Slice);
  756. $YPos = $Y + $i - $Radius;
  757. $AAlias = $Slice - floor($Slice);
  758. $this->Mask[$X-$XPos][$YPos] = TRUE;
  759. $this->Mask[$X+$XPos][$YPos] = TRUE;
  760. imageline($this->Picture,$X-$XPos,$YPos,$X+$XPos,$YPos,$Color);
  761. }
  762. if ( $this->Antialias )
  763. $this->drawCircle($X,$Y,$Radius,$Radius,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
  764. $this->Mask = "";
  765. if ( $BorderR != -1 )
  766. $this->drawCircle($X,$Y,$Radius,$Radius,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$Ticks));
  767. $this->Shadow = $RestoreShadow;
  768. }
  769. /* Write text */
  770. function drawText($X,$Y,$Text,$Format="")
  771. {
  772. $R = isset($Format["R"]) ? $Format["R"] : $this->FontColorR;
  773. $G = isset($Format["G"]) ? $Format["G"] : $this->FontColorG;
  774. $B = isset($Format["B"]) ? $Format["B"] : $this->FontColorB;
  775. $Angle = isset($Format["Angle"]) ? $Format["Angle"] : 0;
  776. $Align = isset($Format["Align"]) ? $Format["Align"] : TEXT_ALIGN_BOTTOMLEFT;
  777. $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : $this->FontColorA;
  778. $FontName = isset($Format["FontName"]) ? $Format["FontName"] : $this->FontName;
  779. $FontSize = isset($Format["FontSize"]) ? $Format["FontSize"] : $this->FontSize;
  780. $ShowOrigine = isset($Format["ShowOrigine"]) ? $Format["ShowOrigine"] : FALSE;
  781. $TOffset = isset($Format["TOffset"]) ? $Format["TOffset"] : 2;
  782. $DrawBox = isset($Format["DrawBox"]) ? $Format["DrawBox"] : FALSE;
  783. $DrawBoxBorder = isset($Format["DrawBoxBorder"]) ? $Format["DrawBoxBorder"] : TRUE;
  784. $BorderOffset = isset($Format["BorderOffset"]) ? $Format["BorderOffset"] : 6;
  785. $BoxRounded = isset($Format["BoxRounded"]) ? $Format["BoxRounded"] : FALSE;
  786. $RoundedRadius = isset($Format["RoundedRadius"]) ? $Format["RoundedRadius"] : 6;
  787. $BoxR = isset($Format["BoxR"]) ? $Format["BoxR"] : 255;
  788. $BoxG = isset($Format["BoxG"]) ? $Format["BoxG"] : 255;
  789. $BoxB = isset($Format["BoxB"]) ? $Format["BoxB"] : 255;
  790. $BoxAlpha = isset($Format["BoxAlpha"]) ? $Format["BoxAlpha"] : 50;
  791. $BoxSurrounding = isset($Format["BoxSurrounding"]) ? $Format["BoxSurrounding"] : "";
  792. $BoxBorderR = isset($Format["BoxR"]) ? $Format["BoxR"] : 0;
  793. $BoxBorderG = isset($Format["BoxG"]) ? $Format["BoxG"] : 0;
  794. $BoxBorderB = isset($Format["BoxB"]) ? $Format["BoxB"] : 0;
  795. $BoxBorderAlpha = isset($Format["BoxAlpha"]) ? $Format["BoxAlpha"] : 50;
  796. $NoShadow = isset($Format["NoShadow"]) ? $Format["NoShadow"] : FALSE;
  797. $Shadow = $this->Shadow;
  798. if ( $NoShadow ) { $this->Shadow = FALSE; }
  799. if ( $BoxSurrounding != "" ) { $BoxBorderR = $BoxR - $BoxSurrounding; $BoxBorderG = $BoxG - $BoxSurrounding; $BoxBorderB = $BoxB - $BoxSurrounding; $BoxBorderAlpha = $BoxAlpha; }
  800. if ( $ShowOrigine )
  801. {
  802. $MyMarkerSettings = array("R"=>255,"G"=>0,"B"=>0,"BorderR"=>255,"BorderB"=>255,"BorderG"=>255,"Size"=>4);
  803. $this->drawRectangleMarker($X,$Y,$MyMarkerSettings);
  804. }
  805. $TxtPos = $this->getTextBox($X,$Y,$FontName,$FontSize,$Angle,$Text);
  806. if ( $DrawBox && ($Angle == 0 || $Angle == 90 || $Angle == 180 || $Angle == 270))
  807. {
  808. $T[0]["X"]=0;$T[0]["Y"]=0;$T[1]["X"]=0;$T[1]["Y"]=0;$T[2]["X"]=0;$T[2]["Y"]=0;$T[3]["X"]=0;$T[3]["Y"]=0;
  809. if ( $Angle == 0 ) { $T[0]["X"]=-$TOffset;$T[0]["Y"]=$TOffset;$T[1]["X"]=$TOffset;$T[1]["Y"]=$TOffset;$T[2]["X"]=$TOffset;$T[2]["Y"]=-$TOffset;$T[3]["X"]=-$TOffset;$T[3]["Y"]=-$TOffset; }
  810. $X1 = min($TxtPos[0]["X"],$TxtPos[1]["X"],$TxtPos[2]["X"],$TxtPos[3]["X"]) - $BorderOffset + 3;
  811. $Y1 = min($TxtPos[0]["Y"],$TxtPos[1]["Y"],$TxtPos[2]["Y"],$TxtPos[3]["Y"]) - $BorderOffset;
  812. $X2 = max($TxtPos[0]["X"],$TxtPos[1]["X"],$TxtPos[2]["X"],$TxtPos[3]["X"]) + $BorderOffset + 3;
  813. $Y2 = max($TxtPos[0]["Y"],$TxtPos[1]["Y"],$TxtPos[2]["Y"],$TxtPos[3]["Y"]) + $BorderOffset - 3;
  814. $X1 = $X1 - $TxtPos[$Align]["X"] + $X + $T[0]["X"];
  815. $Y1 = $Y1 - $TxtPos[$Align]["Y"] + $Y + $T[0]["Y"];
  816. $X2 = $X2 - $TxtPos[$Align]["X"] + $X + $T[0]["X"];
  817. $Y2 = $Y2 - $TxtPos[$Align]["Y"] + $Y + $T[0]["Y"];
  818. $Settings = array("R"=>$BoxR,"G"=>$BoxG,"B"=>$BoxB,"Alpha"=>$BoxAlpha,"BorderR"=>$BoxBorderR,"BorderG"=>$BoxBorderG,"BorderB"=>$BoxBorderB,"BorderAlpha"=>$BoxBorderAlpha);
  819. if ( $BoxRounded )
  820. { $this->drawRoundedFilledRectangle($X1,$Y1,$X2,$Y2,$RoundedRadius,$Settings); }
  821. else
  822. { $this->drawFilledRectangle($X1,$Y1,$X2,$Y2,$Settings); }
  823. }
  824. $X = $X - $TxtPos[$Align]["X"] + $X;
  825. $Y = $Y - $TxtPos[$Align]["Y"] + $Y;
  826. if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
  827. {
  828. $C_ShadowColor = $this->allocateColor($this->Picture,$this->ShadowR,$this->ShadowG,$this->ShadowB,$this->Shadowa);
  829. imagettftext($this->Picture,$FontSize,$Angle,$X+$this->ShadowX,$Y+$this->ShadowY,$C_ShadowColor,$FontName,$this->getEncodedText($Text));
  830. }
  831. $C_TextColor = $this->AllocateColor($this->Picture,$R,$G,$B,$Alpha);
  832. imagettftext($this->Picture,$FontSize,$Angle,$X,$Y,$C_TextColor,$FontName,$this->getEncodedText($Text));
  833. $this->Shadow = $Shadow;
  834. return($TxtPos);
  835. }
  836. function getEncodedText($text)
  837. {
  838. $gdinfo = gd_info();
  839. if (!empty($gdinfo['JIS-mapped Japanese Font Support'])) {
  840. return mb_convert_encoding($text, "SJIS", "UTF-8");
  841. }
  842. return $text;
  843. }
  844. /* Draw a gradient within a defined area */
  845. function drawGradientArea($X1,$Y1,$X2,$Y2,$Direction,$Format="")
  846. {
  847. $StartR = isset($Format["StartR"]) ? $Format["StartR"] : 90;
  848. $StartG = isset($Format["StartG"]) ? $Format["StartG"] : 90;
  849. $StartB = isset($Format["StartB"]) ? $Format["StartB"] : 90;
  850. $EndR = isset($Format["EndR"]) ? $Format["EndR"] : 0;
  851. $EndG = isset($Format["EndG"]) ? $Format["EndG"] : 0;
  852. $EndB = isset($Format["EndB"]) ? $Format["EndB"] : 0;
  853. $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
  854. $Levels = isset($Format["Levels"]) ? $Format["Levels"] : NULL;
  855. $Shadow = $this->Shadow;
  856. $this->Shadow = FALSE;
  857. if ( $StartR == $EndR && $StartG == $EndG && $StartB == $EndB )
  858. {
  859. $this->drawFilledRectangle($X1,$Y1,$X2,$Y2,array("R"=>$StartR,"G"=>$StartG,"B"=>$StartB,"Alpha"=>$Alpha));
  860. return(0);
  861. }
  862. if ( $Levels != NULL )
  863. { $EndR=$StartR+$Levels; $EndG=$StartG+$Levels; $EndB=$StartB+$Levels; }
  864. if ($X1 > $X2) { list($X1, $X2) = array($X2, $X1); }
  865. if ($Y1 > $Y2) { list($Y1, $Y2) = array($Y2, $Y1); }
  866. if ( $Direction == DIRECTION_VERTICAL ) { $Width = abs($Y2-$Y1); }
  867. if ( $Direction == DIRECTION_HORIZONTAL ) { $Width = abs($X2-$X1); }
  868. $Step = max(abs($EndR-$StartR),abs($EndG-$StartG),abs($EndB-$StartB));
  869. $StepSize = $Width/$Step;
  870. $RStep = ($EndR-$StartR)/$Step;
  871. $GStep = ($EndG-$StartG)/$Step;
  872. $BStep = ($EndB-$StartB)/$Step;
  873. $R=$StartR;$G=$StartG;$B=$StartB;
  874. switch($Direction)
  875. {
  876. case DIRECTION_VERTICAL:
  877. $StartY = $Y1; $EndY = floor($Y2)+1; $LastY2 = $StartY;
  878. for($i=0;$i<=$Step;$i++)
  879. {
  880. $Y2 = floor($StartY + ($i * $StepSize));
  881. if ($Y2 > $EndY) { $Y2 = $EndY; }
  882. if (($Y1 != $Y2 && $Y1 < $Y2) || $Y2 == $EndY)
  883. {
  884. $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
  885. $this->drawFilledRectangle($X1,$Y1,$X2,$Y2,$Color);
  886. $LastY2 = max($LastY2,$Y2);
  887. $Y1 = $Y2+1;
  888. }
  889. $R = $R + $RStep; $G = $G + $GStep; $B = $B + $BStep;
  890. }
  891. if ( $LastY2 < $EndY && isset($Color)) { for ($i=$LastY2+1;$i<=$EndY;$i++) { $this->drawLine($X1,$i,$X2,$i,$Color); } }
  892. break;
  893. case DIRECTION_HORIZONTAL:
  894. $StartX = $X1; $EndX = $X2;
  895. for($i=0;$i<=$Step;$i++)
  896. {
  897. $X2 = floor($StartX + ($i * $StepSize));
  898. if ($X2 > $EndX) { $X2 = $EndX; }
  899. if (($X1 != $X2 && $X1 < $X2) || $X2 == $EndX)
  900. {
  901. $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
  902. $this->drawFilledRectangle($X1,$Y1,$X2,$Y2,$Color);
  903. $X1 = $X2+1;
  904. }
  905. $R = $R + $RStep; $G = $G + $GStep; $B = $B + $BStep;
  906. }
  907. if ( $X2 < $EndX && isset($Color)) { $this->drawFilledRectangle($X2,$Y1,$EndX,$Y2,$Color); }
  908. break;
  909. }
  910. $this->Shadow = $Shadow;
  911. }
  912. /* Draw an aliased pixel */
  913. function drawAntialiasPixel($X,$Y,$Format="")
  914. {
  915. $R = isset($Format["R"]) ? $Format["R"] : 0;
  916. $G = isset($Format["G"]) ? $Format["G"] : 0;
  917. $B = isset($Format["B"]) ? $Format["B"] : 0;
  918. $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
  919. if ( $X < 0 || $Y < 0 || $X >= $this->XSize || $Y >= $this->YSize )
  920. return(-1);
  921. if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
  922. if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
  923. if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
  924. if ( !$this->Antialias )
  925. {
  926. if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
  927. {
  928. $ShadowColor = $this->allocateColor($this->Picture,$this->ShadowR,$this->ShadowG,$this->ShadowB,$this->Shadowa);
  929. imagesetpixel($this->Picture,$X+$this->ShadowX,$Y+$this->ShadowY,$ShadowColor);
  930. }
  931. $PlotColor = $this->allocateColor($this->Picture,$R,$G,$B,$Alpha);
  932. imagesetpixel($this->Picture,$X,$Y,$PlotColor);
  933. return(0);
  934. }
  935. $Plot = "";
  936. $Xi = floor($X);
  937. $Yi = floor($Y);
  938. if ( $Xi == $X && $Yi == $Y)
  939. {
  940. if ( $Alpha == 100 )
  941. $this->drawAlphaPixel($X,$Y,100,$R,$G,$B);
  942. else
  943. $this->drawAlphaPixel($X,$Y,$Alpha,$R,$G,$B);
  944. }
  945. else
  946. {
  947. $Alpha1 = (((1 - ($X - floor($X))) * (1 - ($Y - floor($Y))) * 100) / 100) * $Alpha;
  948. if ( $Alpha1 > $this->AntialiasQuality ) { $this->drawAlphaPixel($Xi,$Yi,$Alpha1,$R,$G,$B); }
  949. $Alpha2 = ((($X - floor($X)) * (1 - ($Y - floor($Y))) * 100) / 100) * $Alpha;
  950. if ( $Alpha2 > $this->AntialiasQuality ) { $this->drawAlphaPixel($Xi+1,$Yi,$Alpha2,$R,$G,$B); }
  951. $Alpha3 = (((1 - ($X - floor($X))) * ($Y - floor($Y)) * 100) / 100) * $Alpha;
  952. if ( $Alpha3 > $this->AntialiasQuality ) { $this->drawAlphaPixel($Xi,$Yi+1,$Alpha3,$R,$G,$B); }
  953. $Alpha4 = ((($X - floor($X)) * ($Y - floor($Y)) * 100) / 100) * $Alpha;
  954. if ( $Alpha4 > $this->AntialiasQuality ) { $this->drawAlphaPixel($Xi+1,$Yi+1,$Alpha4,$R,$G,$B); }
  955. }
  956. }
  957. /* Draw a semi-transparent pixel */
  958. function drawAlphaPixel($X,$Y,$Alpha,$R,$G,$B)
  959. {
  960. if ( isset($this->Mask[$X])) { if ( isset($this->Mask[$X][$Y]) ) { return(0); } }
  961. if ( $X < 0 || $Y < 0 || $X >= $this->XSize || $Y >= $this->YSize )
  962. return(-1);
  963. if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
  964. if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
  965. if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
  966. if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
  967. {
  968. $AlphaFactor = floor(($Alpha / 100) * $this->Sha

Large files files are truncated, but you can click here to view the full file