示例#1
0
 /**
  * Invert color from an image ressource.
  *
  * @param ressource $image Image
  * "param string $color ID of a filter
  */
 public static function applyFilter($image, $color)
 {
     if ($color == 'black') {
         ImageUtil::addInvertFilter($image);
     } else {
         if ($color == 'gray') {
             ImageUtil::addGrayFilter($image);
         } else {
             if ($color == 'blue') {
                 self::addColorFilter($image, array(40, 79, 148));
             } else {
                 if ($color == 'red') {
                     self::addColorFilter($image, array(214, 17, 2));
                 } else {
                     if ($color == 'orange') {
                         self::addColorFilter($image, array(222, 54, 0));
                     } else {
                         if ($color == 'turquoise') {
                             self::addColorFilter($image, array(69, 168, 196));
                         } else {
                             if ($color == 'trans') {
                                 self::addTransFilter($image);
                             } else {
                                 if ($color == 'white') {
                                     return;
                                 } else {
                                     throw new Exception("Unknown filter.");
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }