-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented interlace support for GD, Imagick, and Gmagick. #196
Changes from 1 commit
4767e3e
3c93c1b
bf01c45
f9df468
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -479,6 +479,27 @@ public function layers() | |
|
||
return $this->layers; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
**/ | ||
public function interlace($type) | ||
{ | ||
$supportedInterlaceTypes = array( | ||
ImageInterface::INTERLACE_NONE => 0, | ||
ImageInterface::INTERLACE_LINE => 1, | ||
ImageInterface::INTERLACE_PLANE => 1, | ||
ImageInterface::INTERLACE_PARTITION => 1, | ||
); | ||
|
||
if (!array_key_exists($supportedInterlaceTypes)) { | ||
throw new InvalidArgumentException('Unsupported interlace type'); | ||
} | ||
|
||
imageinterlace($this->resource, $supportedInterlaceTypes[$type]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would still love to find out what interlacing scheme GD implements so this intended behaviour could be better handled and documented. |
||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Internal | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,11 @@ interface ImageInterface extends ManipulatorInterface | |
{ | ||
const RESOLUTION_PIXELSPERINCH = 'ppi'; | ||
const RESOLUTION_PIXELSPERCENTIMETER = 'ppc'; | ||
|
||
const INTERLACE_NONE = 'none'; | ||
const INTERLACE_LINE = 'line'; | ||
const INTERLACE_PLANE = 'plane'; | ||
const INTERLACE_PARTITION = 'partition'; | ||
|
||
/** | ||
* Returns the image content as a binary string | ||
|
@@ -102,4 +107,13 @@ public function getColorAt(PointInterface $point); | |
* @return LayersInterface | ||
*/ | ||
public function layers(); | ||
|
||
/** | ||
* Enables or disables interlacing | ||
* | ||
* @throws InvalidArgumentException When an unsupported Interface type is supplied | ||
* | ||
* @return ImageInterface | ||
*/ | ||
public function interlace($type); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did notice that the Imagick and Gmagick objects call the interlace types
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about defining it static like at https://github.com/avalanche123/Imagine/blob/develop/lib/Imagine/Imagick/Image.php#L673 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'm happy to do that to help maintain consistency. :)
Thanks.