Author: caefer
Date: 2010-04-06 08:21:44 +0200 (Tue, 06 Apr 2010)
New Revision: 28989

Removed:
   
plugins/sfImageTransformExtraPlugin/trunk/lib/transforms/sfImageAlphaMaskGD.class.php
   
plugins/sfImageTransformExtraPlugin/trunk/lib/transforms/sfImageRoundedCornersGD.class.php
   
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/transforms/sfImageAlphaMaskGDTest.php
   
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/transforms/sfImageRoundedCornersGDTest.php
Log:
Removed sfImageAlphaMaskGD and sfImageRoundedCornersGD and related tests as 
they are now part of sfImageTransformPlugin.



Deleted: 
plugins/sfImageTransformExtraPlugin/trunk/lib/transforms/sfImageAlphaMaskGD.class.php
===================================================================
--- 
plugins/sfImageTransformExtraPlugin/trunk/lib/transforms/sfImageAlphaMaskGD.class.php
       2010-04-06 04:49:08 UTC (rev 28988)
+++ 
plugins/sfImageTransformExtraPlugin/trunk/lib/transforms/sfImageAlphaMaskGD.class.php
       2010-04-06 06:21:44 UTC (rev 28989)
@@ -1,103 +0,0 @@
-<?php
-/**
- * This file is part of the sfImageTransformExtraPlugin package.
- * (c) 2010 Christian Schaefer <[email protected]>>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- *
- * @package    sfImageTransformExtraPlugin
- * @author     Christian Schaefer <[email protected]>
- * @version    SVN: $Id: sfRawFileCache.class.php 63 2010-03-09 04:34:28Z 
caefer $
- */
-
-/**
- * Image transformation to apply a second image as an alpha mask to the first 
image
- *
- * @package    sfImageTransformExtraPlugin
- * @subpackage transforms
- * @author     Christian Schaefer <[email protected]>
- */
-class sfImageAlphaMaskGD extends sfImageTransformAbstract
-{
-  public function __construct($mask, $color = false) 
-  {
-    $this->mask  = $mask->getAdapter()->getHolder();
-    $this->color = $color;
-  }
-  
-  protected function transform(sfImage $image) 
-  {
-    $resource       = $image->getAdapter()->getHolder();
-    $this->mimeType = $image->getMIMEType();
-
-    switch ($this->mimeType) 
-    {
-      case 'image/png':
-        $this->transformAlpha($resource);
-        break;
-      case 'image/gif':
-      case 'image/jpg':
-      default:
-        $this->transformDefault($resource);
-    }
-    
-    return $image;
-  }
-
-  private function transformAlpha($resource) 
-  {
-    $w = imagesx($resource);
-    $h = imagesy($resource);
-    
-    $canvas = imagecreatetruecolor($w, $h);
-    
-    $color_background = imagecolorallocate($canvas, 0, 0, 0);
-    imagefilledrectangle($canvas, 0, 0, $w, $h, $color_background);
-    imagealphablending($canvas, false);
-    imagesavealpha($canvas, true);
-    
-    for ($x = 0;$x < $w;$x++) 
-    {
-      for ($y = 0;$y < $h;$y++) 
-      {
-        $RealPixel = @imagecolorsforindex($resource, @imagecolorat($resource, 
$x, $y));
-        $MaskPixel = @imagecolorsforindex($this->mask, 
@imagecolorat($this->mask, $x, $y));
-        $MaskAlpha = 127 - (floor($MaskPixel['red'] / 2) * (1 - 
($RealPixel['alpha'] / 127)));
-        
-        if (false === $this->color) 
-        {
-          $newcolor = imagecolorallocatealpha($canvas, $RealPixel['red'], 
$RealPixel['green'], $RealPixel['blue'], intval($MaskAlpha));
-        }
-        else
-        {
-          $newcolorPixel    = sscanf($this->color, '#%2x%2x%2x');
-          $newcolorPixel[0] = ($newcolorPixel[0] * $MaskAlpha + 
$RealPixel['red'] * (127 - $MaskAlpha)) / 127;
-          $newcolorPixel[1] = ($newcolorPixel[1] * $MaskAlpha + 
$RealPixel['green'] * (127 - $MaskAlpha)) / 127;
-          $newcolorPixel[2] = ($newcolorPixel[2] * $MaskAlpha + 
$RealPixel['blue'] * (127 - $MaskAlpha)) / 127;
-          $newcolor         = imagecolorallocate($canvas, $newcolorPixel[0], 
$newcolorPixel[1], $newcolorPixel[2]);
-        }
-        imagesetpixel($canvas, $x, $y, $newcolor);
-      }
-    }
-    imagealphablending($resource, false);
-    imagesavealpha($resource, true);
-    imagecopy($resource, $canvas, 0, 0, 0, 0, $w, $h);
-    
-    imagedestroy($this->mask);
-    imagedestroy($canvas);
-  }
-  
-  private function transformDefault($resource) 
-  {
-    $w = imagesx($resource);
-    $h = imagesy($resource);
-    
-    imagealphablending($resource, true);
-    $resource_transparent = imagecolorallocate($resource, 0, 0, 0);
-    imagecolortransparent($resource, $resource_transparent);
-    //$resource_transparent = $this->getTransparentColor($resource);
-    // Copy $mask over the top of $resource maintaining the Alpha transparency
-    imagecopymerge($resource, $this->mask, 0, 0, 0, 0, $w, $h, 100);
-  }
-}

Deleted: 
plugins/sfImageTransformExtraPlugin/trunk/lib/transforms/sfImageRoundedCornersGD.class.php
===================================================================
--- 
plugins/sfImageTransformExtraPlugin/trunk/lib/transforms/sfImageRoundedCornersGD.class.php
  2010-04-06 04:49:08 UTC (rev 28988)
+++ 
plugins/sfImageTransformExtraPlugin/trunk/lib/transforms/sfImageRoundedCornersGD.class.php
  2010-04-06 06:21:44 UTC (rev 28989)
@@ -1,76 +0,0 @@
-<?php
-/**
- * This file is part of the sfImageTransformExtraPlugin package.
- * (c) 2010 Christian Schaefer <[email protected]>>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- *
- * @package    sfImageTransformExtraPlugin
- * @author     Christian Schaefer <[email protected]>
- * @version    SVN: $Id: sfRawFileCache.class.php 63 2010-03-09 04:34:28Z 
caefer $
- */
-
-/**
- * Image transformation to apply rounded corners to the image
- *
- * @package    sfImageTransformExtraPlugin
- * @subpackage transforms
- * @author     Christian Schaefer <[email protected]>
- */
-class sfImageRoundedCornersGD extends sfImageAlphaMaskGD
-{
-  public function __construct($radius, $color = false) 
-  {
-    $this->radius = $radius;
-    $this->color  = $color;
-  }
-  
-  protected function transform(sfImage $image) 
-  {
-    $resource       = $image->getAdapter()->getHolder();
-
-    $w = imagesx($resource);
-    $h = imagesy($resource);
-    $this->mask   = $this->getMask($w, $h);
-    
-    return parent::transform($image);
-  }
-  
-  private function getMask($w, $h) 
-  {
-    // Create a mask png image of the area you want in the circle/ellipse (a 
'magicpink' image with a black shape on it, with black set to the colour of 
alpha transparency) - $mask
-    $mask = imagecreatetruecolor($w, $h);
-    imagealphablending($mask, true);
-    // Set the masking colours
-    if (false === $this->color||'image/png' == $this->mimeType) 
-    {
-      $mask_black = imagecolorallocate($mask, 0, 0, 0);
-    }
-    else
-    {
-      $colorPixel = sscanf($this->color, '#%2x%2x%2x');
-      $mask_black = imagecolorallocate($mask, $colorPixel[0], $colorPixel[1], 
$colorPixel[2]);
-    }
-    $mask_transparent = imagecolorallocate($mask, 255, 255, 255);
-    imagecolortransparent($mask, $mask_transparent);
-    imagefill($mask, 0, 0, $mask_black);
-    // Draw the rounded rectangle for the mask
-    $this->imagefillroundedrect($mask, 0, 0, $w, $h, $this->radius, 
$mask_transparent);
-    return $mask;
-  }
-  
-  private function imagefillroundedrect($im, $x, $y, $cx, $cy, $rad, $col) 
-  {
-    // Draw the middle cross shape of the rectangle
-    imagefilledrectangle($im, $x, $y + $rad, $cx, $cy - $rad, $col);
-    imagefilledrectangle($im, $x + $rad, $y, $cx - $rad, $cy, $col);
-    
-    $dia = $rad * 2;
-    // Now fill in the rounded corners
-    imagefilledellipse($im, $x + $rad, $y + $rad, $rad * 2, $dia, $col);
-    imagefilledellipse($im, $x + $rad, $cy - $rad, $rad * 2, $dia, $col);
-    imagefilledellipse($im, $cx - $rad, $cy - $rad, $rad * 2, $dia, $col);
-    imagefilledellipse($im, $cx - $rad, $y + $rad, $rad * 2, $dia, $col);
-  }
-}

Deleted: 
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/transforms/sfImageAlphaMaskGDTest.php
===================================================================
--- 
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/transforms/sfImageAlphaMaskGDTest.php
       2010-04-06 04:49:08 UTC (rev 28988)
+++ 
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/transforms/sfImageAlphaMaskGDTest.php
       2010-04-06 06:21:44 UTC (rev 28989)
@@ -1,62 +0,0 @@
-<?php
-/**
- * This file is part of the sfImageTransformExtraPlugin unit tests package.
- * (c) 2010 Christian Schaefer <[email protected]>>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- *
- * @package    sfImageTransformExtraPluginUnitTests
- * @author     Christian Schaefer <[email protected]>
- * @version    SVN: $Id: sfRawFileCache.class.php 63 2010-03-09 04:34:28Z 
caefer $
- */
-
-/** central bootstrap for unit tests */
-require_once dirname(__FILE__).'/../../../bootstrap/unit.php';
-/** PHPUnit Framework */
-require_once 'PHPUnit/Framework.php';
-
-/**
- * PHPUnit test for sfImageAlphaMaskGD transformation
- *
- * @package    sfImageTransformExtraPluginUnitTests
- * @subpackage transformation
- * @author     Christian Schaefer <[email protected]>
- */
-class sfImageAlphaMaskGDTest extends PHPUnit_Framework_TestCase
-{
-  /**
-   * Testing the constructor
-   *
-   * @see sfImageAlphaMaskGD::__construct()
-   * @return void
-   */
-  public function test__construct() 
-  {
-    $mask = new 
sfImage(dirname(__FILE__).'/../../../../data/example-resources/masks/pattern.gif');
-    $transformation = new sfImageAlphaMaskGD($mask, false); 
-    $this->assertType('sfImageAlphaMaskGD', $transformation);
-  }
-
-  public function testTransform() 
-  {
-    $mask = new 
sfImage(dirname(__FILE__).'/../../../../data/example-resources/masks/pattern.gif');
-    $this->assertType('sfImage', $this->img->alphaMask($mask));
-  }
-
-  public function testTransformWithColor() 
-  {
-    $mask = new 
sfImage(dirname(__FILE__).'/../../../../data/example-resources/masks/pattern.gif');
-    $this->assertType('sfImage', $this->img->alphaMask($mask, '#0000FF'));
-  }
-
-  public function testNonPngTransform() 
-  {
-    $mask = new sfImage(dirname(__FILE__).'/../../../../data/caefer.jpg');
-    $this->assertType('sfImage', $this->img->alphaMask($mask));
-  }
-  protected function setUp()
-  {
-    $this->img = new 
sfImage(dirname(__FILE__).'/../../../../data/example-resources/overlays/logo.png');
-  }
-}

Deleted: 
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/transforms/sfImageRoundedCornersGDTest.php
===================================================================
--- 
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/transforms/sfImageRoundedCornersGDTest.php
  2010-04-06 04:49:08 UTC (rev 28988)
+++ 
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/transforms/sfImageRoundedCornersGDTest.php
  2010-04-06 06:21:44 UTC (rev 28989)
@@ -1,41 +0,0 @@
-<?php
-/**
- * This file is part of the sfImageTransformExtraPlugin unit tests package.
- * (c) 2010 Christian Schaefer <[email protected]>>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- *
- * @package    sfImageTransformExtraPluginUnitTests
- * @author     Christian Schaefer <[email protected]>
- * @version    SVN: $Id: sfRawFileCache.class.php 63 2010-03-09 04:34:28Z 
caefer $
- */
-
-/** central bootstrap for unit tests */
-require_once dirname(__FILE__).'/../../../bootstrap/unit.php';
-/** PHPUnit Framework */
-require_once 'PHPUnit/Framework.php';
-
-/**
- * PHPUnit test for sfImageRoundedCornersGD transformation
- *
- * @package    sfImageTransformExtraPluginUnitTests
- * @subpackage transformation
- * @author     Christian Schaefer <[email protected]>
- */
-class sfImageRoundedCornersGDTest extends PHPUnit_Framework_TestCase
-{
-  public function test__construct() 
-  {
-    $transformation = new sfImageRoundedCornersGD(null, false); 
-    $this->assertType('sfImageRoundedCornersGD', $transformation);
-  }
-
-  public function testTransform() 
-  {
-    $img1 = new 
sfImage(dirname(__FILE__).'/../../../../data/example-resources/overlays/logo.png');
-    $this->assertType('sfImage', $img1->roundedCorners(10));
-    $img2 = new sfImage(dirname(__FILE__).'/../../../../data/caefer.jpg');
-    $this->assertType('sfImage', $img2->roundedCorners(10), '#FF0000');
-  }
-}

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to