:octocat: integrate reader into QRCode, extract LuminanceSourceInterface

This commit is contained in:
codemasher
2021-11-19 15:49:53 +01:00
parent 9bfe5e1880
commit 5e9cf0047e
9 changed files with 170 additions and 158 deletions
+16 -1
View File
@@ -20,7 +20,7 @@ use function count;
* This class is used to help decode images from files which arrive as Imagick Resource
* It does not support rotation.
*/
final class IMagickLuminanceSource extends LuminanceSource{
final class IMagickLuminanceSource extends LuminanceSourceAbstract{
private Imagick $imagick;
@@ -53,4 +53,19 @@ final class IMagickLuminanceSource extends LuminanceSource{
}
}
/** @inheritDoc */
public static function fromFile(string $path):self{
$path = self::checkFile($path);
return new self(new Imagick($path));
}
/** @inheritDoc */
public static function fromBlob(string $blob):self{
$im = new Imagick;
$im->readImageBlob($blob);
return new self($im);
}
}