public function apply($image)
{
if ($this->type === 'ordered') {
return $this->ordered($image);
} else {
if ($this->type === 'diffusion') {
return $this->diffusion($image);
}
}
throw new \Exception(sprintf('Invalid dither type "%s".', $this->type));
}