예제 #1
0
 /**
  * Required by vignette to generate the propper colors.
  *
  * @param  float  $size  Size of the vignette, between 0 and 10. Low is sharper.
  * @param  float  $level Vignete transparency, between 0 and 1
  * @param  int    $x     X position of the pixel.
  * @param  int    $y     Y position of the pixel.
  * @param  array  &$rgb  Current pixel olor information.
  * @return void
  * @codeCoverageIgnore
  */
 protected function vignetteEffect($size, $level, $x, $y, &$rgb)
 {
     $l = sin(M_PI / $this->width * $x) * sin(M_PI / $this->height * $y);
     $l = pow($l, Normalize::fitInRange($size, 0, 10));
     $l = 1 - Normalize::fitInRange($level, 0, 1) * (1 - $l);
     $rgb['red'] *= $l;
     $rgb['green'] *= $l;
     $rgb['blue'] *= $l;
 }
예제 #2
0
 /**
  * @expectedException Elboletaire\Watimage\Exception\InvalidArgumentException
  */
 public function testWatermarkSizeFail()
 {
     Normalize::watermarkSize('not valid');
 }