Added feature #2049: Add the possibility to use "Ellipse" in Gifbuilder (thanks to...
authorSusanne Moog <typo3@susannemoog.de>
Fri, 16 Jul 2010 18:40:24 +0000 (18:40 +0000)
committerSusanne Moog <typo3@susannemoog.de>
Fri, 16 Jul 2010 18:40:24 +0000 (18:40 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@8200 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_stdgraphic.php
typo3/sysext/cms/tslib/class.tslib_gifbuilder.php

index aa540aa..c286848 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,8 @@
 
        * Fixed bug #14858: imageLinkWrap.JSwindow triggers XSS warning or Fails (thanks to Jigal van Hemert)
        * Added feature #13797: new TS config option to disable the "Show secondary options" checkbox (thanks to Jörg Klein)
-
+       * Added feature #2049: Add the possibility to use "Ellipse" in Gifbuilder (thanks to Kjeld Schumacher)
+       
 2010-07-16  Xavier Perseguers  <typo3@perseguers.ch>
 
        * Fixed bug #14818: t3lib_db->listQuery() performance (thanks to Caspar Stuebs)
index 10c7003..b4e879b 100644 (file)
@@ -1622,6 +1622,39 @@ class t3lib_stdGraphic   {
                imagefilledrectangle($im, $cords[0], $cords[1], $cords[0]+$cords[2]-1, $cords[1]+$cords[3]-1, $tmpColor);
        }
 
+       /**
+        * Implements the "Ellipse" GIFBUILDER object
+        * Example Typoscript:
+        * file  =  GIFBUILDER
+        * file  {
+        * XY  =  200,200
+        * format  =  jpg
+        * quality  =  100
+        * 10  =  ELLIPSE
+        * 10.dimensions  =  100,100,50,50
+        * 10.color  =  red
+        *
+        * $workArea = X,Y
+        * $conf['dimensions'] = offset x, offset y, width of ellipse, height of ellipse
+        *
+        * @param       pointer GDlib image pointer
+        * @param       array $conf TypoScript array with configuration for the GIFBUILDER object.
+        * @param       array $workArea The current working area coordinates.
+        * @return      void
+        * @see tslib_gifBuilder::make()
+        */
+       public function makeEllipse(&$im, array $conf, array $workArea) {
+               $ellipseConfiguration = t3lib_div::intExplode(',', $conf['dimensions'] . ',,,');
+               $conf['offset'] = $ellipseConfiguration[0] . ',' . $ellipseConfiguration[1]; // ellipse offset inside workArea (x/y)
+
+               // @see objPosition
+               $imageCoordinates = $this->objPosition($conf, $workArea, array($ellipseConfiguration[2], $ellipseConfiguration[3]));
+
+               $color = $this->convertColor($conf['color']);
+               $fillingColor = imagecolorallocate($im, $color[0], $color[1], $color[2]);
+               imagefilledellipse($im, $imageCoordinates[0], $imageCoordinates[1], $imageCoordinates[2], $imageCoordinates[3], $fillingColor);
+       }
+
        /**
         * Implements the "EFFECT" GIFBUILDER object
         * The operation involves ImageMagick for applying effects
index a11664d..eada824 100644 (file)
@@ -287,6 +287,11 @@ class tslib_gifBuilder extends t3lib_stdGraphic {
                                                                $this->setup[$theKey.'.']['height'] = $this->calcOffset($this->setup[$theKey.'.']['height']);
                                                        }
                                                break;
+                                               case 'ELLIPSE':
+                                                       if ($this->setup[$theKey . '.']['dimensions']) {
+                                                               $this->setup[$theKey . '.']['dimensions'] = $this->calcOffset($this->setup[$theKey . '.']['dimensions']);
+                                                       }
+                                               break;
                                        }
                                }
                        }
@@ -432,6 +437,9 @@ class tslib_gifBuilder extends t3lib_stdGraphic {
                                                                $this->workArea = $this->defaultWorkArea;       // this sets the current to the default;
                                                        }
                                                break;
+                                               case 'ELLIPSE':
+                                                       $this->makeEllipse($this->im, $conf, $this->workArea);
+                                               break;
                                        }
                                }
                        }