/**
  * @covers \Imagine\Filter\Advanced\Grayscale::apply
  *
  * @dataProvider getDataSet
  *
  * @param \Imagine\Image\BoxInterface $size
  * @param \Imagine\Image\Color $color
  * @param \Imagine\Image\Color $filteredColor
  */
 public function testGrayscaling(BoxInterface $size, Color $color, Color $filteredColor)
 {
     $image = $this->getImage();
     $imageWidth = $size->getWidth();
     $imageHeight = $size->getHeight();
     $size = $this->getMock('Imagine\\Image\\BoxInterface');
     $size->expects($this->exactly($imageWidth + 1))->method('getWidth')->will($this->returnValue($imageWidth));
     $size->expects($this->exactly($imageWidth * ($imageHeight + 1)))->method('getHeight')->will($this->returnValue($imageHeight));
     $image->expects($this->any())->method('getSize')->will($this->returnValue($size));
     $image->expects($this->exactly($imageWidth * $imageHeight))->method('getColorAt')->will($this->returnValue($color));
     $draw = $this->getDrawer();
     $draw->expects($this->exactly($imageWidth * $imageHeight))->method('dot')->with($this->isInstanceOf('Imagine\\Image\\Point'), $this->equalTo($filteredColor));
     $image->expects($this->exactly($imageWidth * $imageHeight))->method('draw')->will($this->returnValue($draw));
     $filter = new Grayscale();
     $this->assertSame($image, $filter->apply($image));
 }
 /**
  * {@inheritdoc}
  */
 public function load(ImageInterface $image, array $options = array())
 {
     $filter = new Grayscale();
     return $filter->apply($image);
 }