From 3a6a4f891c99ff96de568ccdc0a61e8f02455cae Mon Sep 17 00:00:00 2001 From: LivingRoot Date: Sun, 17 Sep 2023 19:24:15 +0300 Subject: [PATCH 1/2] added example with png rounded modules --- examples/Readme.md | 1 + examples/imageRoundedModules.png | Bin 0 -> 16798 bytes examples/pngWithRoundedShapes.php | 210 ++++++++++++++++++++++++++++++ 3 files changed, 211 insertions(+) create mode 100644 examples/imageRoundedModules.png create mode 100644 examples/pngWithRoundedShapes.php diff --git a/examples/Readme.md b/examples/Readme.md index 7b1370adc..21652adbd 100644 --- a/examples/Readme.md +++ b/examples/Readme.md @@ -18,6 +18,7 @@ - [Custom output](./custom_output.php): a simple example that demonstrates the usage of custom output classes - [GD Image with logo](./imageWithLogo.php): a logo on top of the QR Code - [GD image with text](./imageWithText.php): description text under the QR Code ([#35](https://github.com/chillerlan/php-qrcode/issues/35)) +- [GD Image with rounded modules](./imageRoundedModules.png): Similar to "melted" modules, but more rounded ([#127](https://github.com/chillerlan/php-qrcode/issues/127)) - [ImageMagick with logo](./imagickWithLogo.php): a logo on top of the QR Code - [SVG with logo](./svgWithLogo.php): an SVG QR Code with embedded logo (that is also SVG) - [SVG with "melted" modules](./svgMeltedModules.php): an effect where the matrix appears to be like melted wax ([#127](https://github.com/chillerlan/php-qrcode/issues/127)) diff --git a/examples/imageRoundedModules.png b/examples/imageRoundedModules.png new file mode 100644 index 0000000000000000000000000000000000000000..3afecef40de4ccae7b6904ffbee602e429df0fbd GIT binary patch literal 16798 zcmeHvc|4Tg`?m;%Xb~w(S}1Fc>|2o~5vrjWMrDSKeH*)k6os-i*`h?2nZ($4*$3Gg zGxjVAV@bv`mfs|eJ3_QZ&?pP-{VNq6n)mD?T(l!3eM zW7^Nf$zM$`Zk?a@&A=MRsvS6iVy`M!bwLz8zi`asOv#wT+}xZ$9o^faEr(@b*n+N@ zi|!HomtRB!r=INQe zYItVK19_K&>>b*j_^0)*XkCQA*)M;5aZO|l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scale); + $y1 = ($y * $this->scale); + $x2 = (($x + 1) * $this->scale); + $y2 = (($y + 1) * $this->scale); + + $rectsize = $this->scale / 2; + + /** + * @var int $neighbours + * The right bit order (starting from 0): + * 0 1 2 + * 7 # 3 + * 6 5 4 + */ + $neighbours = $this->matrix->checkNeighbours($x, $y); + + // ------------------ + // Outer rounding + // ------------------ + + if ($neighbours & (1 << 7)) { // neighbour left + // top left + imagefilledrectangle( + $this->image, + $x1, + $y1, + $x1 + $rectsize, + $y1 + $rectsize, + $this->moduleValues[$M_TYPE] + ); + // bottom left + imagefilledrectangle( + $this->image, + $x1, + $y2 - $rectsize, + $x1 + $rectsize, + $y2, + $this->moduleValues[$M_TYPE] + ); + } + + if ($neighbours & (1 << 3)) { // neighbour right + // top right + imagefilledrectangle( + $this->image, + $x2 - $rectsize, + $y1, + $x2, + $y1 + $rectsize, + $this->moduleValues[$M_TYPE] + ); + // bottom right + imagefilledrectangle( + $this->image, + $x2 - $rectsize, + $y2 - $rectsize, + $x2, + $y2, + $this->moduleValues[$M_TYPE] + ); + } + + if ($neighbours & (1 << 1)) { // neighbour сверху + // top left + imagefilledrectangle( + $this->image, + $x1, + $y1, + $x1 + $rectsize, + $y1 + $rectsize, + $this->moduleValues[$M_TYPE] + ); + // top right + imagefilledrectangle( + $this->image, + $x2 - $rectsize, + $y1, + $x2, + $y1 + $rectsize, + $this->moduleValues[$M_TYPE] + ); + } + + if ($neighbours & (1 << 5)) { // neighbour снизу + // bottom left + imagefilledrectangle( + $this->image, + $x1, + $y2 - $rectsize, + $x1 + $rectsize, + $y2, + $this->moduleValues[$M_TYPE] + ); + // bottom right + imagefilledrectangle( + $this->image, + $x2 - $rectsize, + $y2 - $rectsize, + $x2, + $y2, + $this->moduleValues[$M_TYPE] + ); + } + + // --------------------- + // inner rounding + // --------------------- + + if (!$this->matrix->check($x, $y)) { + + if ($neighbours & 1 && $neighbours & (1 << 7) && $neighbours & (1 << 1)) { + // top left + imagefilledrectangle( + $this->image, + $x1, + $y1, + $x1 + $rectsize, + $y1 + $rectsize, + $this->moduleValues[$M_TYPE | QRMatrix::IS_DARK] + ); + } + + if ($neighbours & (1 << 1) && $neighbours & (1 << 2) && $neighbours & (1 << 3)) { + // top right + imagefilledrectangle( + $this->image, + $x2 - $rectsize, + $y1, + $x2, + $y1 + $rectsize, + $this->moduleValues[$M_TYPE | QRMatrix::IS_DARK] + ); + } + + if ($neighbours & (1 << 7) && $neighbours & (1 << 6) && $neighbours & (1 << 5)) { + // bottom left + imagefilledrectangle( + $this->image, + $x1, + $y2 - $rectsize, + $x1 + $rectsize, + $y2, + $this->moduleValues[$M_TYPE | QRMatrix::IS_DARK] + ); + } + + if ($neighbours & (1 << 3) && $neighbours & (1 << 4) && $neighbours & (1 << 5)) { + // bottom right + imagefilledrectangle( + $this->image, + $x2 - $rectsize, + $y2 - $rectsize, + $x2, + $y2, + $this->moduleValues[$M_TYPE | QRMatrix::IS_DARK] + ); + } + } + + imagefilledellipse( + $this->image, + (int)(($x * $this->scale) + ($this->scale / 2)), + (int)(($y * $this->scale) + ($this->scale / 2)), + (int)(2 * $this->options->circleRadius * $this->scale), + (int)(2 * $this->options->circleRadius * $this->scale), + $this->moduleValues[$M_TYPE] + ); + } +} + + +// -------------------- +// Example +// -------------------- + +$options = new QROptions([ + 'outputType'=> QROutputInterface::CUSTOM, + 'outputInterface' => QRCustomPNG::class, + 'eccLevel' => EccLevel::M, + 'imageTransparent' => false, + 'imageBase64' => false, + 'scale' => 20 +]); + +$qrcode = new QRCode($options); + +$img = $qrcode->render("https://www.youtube.com/watch?v=dQw4w9WgXcQ"); + +header('Content-type: image/png'); + +echo $img; From 516ddc02a8c6955a40e5dea0e332bc9d7ab312fd Mon Sep 17 00:00:00 2001 From: LivingRoot Date: Mon, 18 Sep 2023 20:52:34 +0300 Subject: [PATCH 2/2] code formatting and removing of example image --- examples/Readme.md | 2 +- examples/imageRoundedModules.png | Bin 16798 -> 0 bytes examples/pngWithRoundedShapes.php | 104 +++++++++++++++++------------- 3 files changed, 59 insertions(+), 47 deletions(-) delete mode 100644 examples/imageRoundedModules.png diff --git a/examples/Readme.md b/examples/Readme.md index ec3edbd13..ad09a301c 100644 --- a/examples/Readme.md +++ b/examples/Readme.md @@ -19,7 +19,7 @@ - [Custom output](./custom_output.php): a simple example that demonstrates the usage of custom output classes - [GD Image with logo](./imageWithLogo.php): a logo on top of the QR Code - [GD image with text](./imageWithText.php): description text under the QR Code ([#35](https://github.com/chillerlan/php-qrcode/issues/35)) -- [GD Image with rounded modules](./imageRoundedModules.png): Similar to "melted" modules, but more rounded ([#127](https://github.com/chillerlan/php-qrcode/issues/127)) +- [GD Image with rounded modules](./pngWithRoundedShapes.php): Similar to "melted" modules, but more rounded ([#127](https://github.com/chillerlan/php-qrcode/issues/127)) - [ImageMagick with logo](./imagickWithLogo.php): a logo on top of the QR Code - [SVG with logo](./svgWithLogo.php): an SVG QR Code with embedded logo (that is also SVG) - [SVG with "melted" modules](./svgMeltedModules.php): an effect where the matrix appears to be like melted wax ([#127](https://github.com/chillerlan/php-qrcode/issues/127)) diff --git a/examples/imageRoundedModules.png b/examples/imageRoundedModules.png deleted file mode 100644 index 3afecef40de4ccae7b6904ffbee602e429df0fbd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16798 zcmeHvc|4Tg`?m;%Xb~w(S}1Fc>|2o~5vrjWMrDSKeH*)k6os-i*`h?2nZ($4*$3Gg zGxjVAV@bv`mfs|eJ3_QZ&?pP-{VNq6n)mD?T(l!3eM zW7^Nf$zM$`Zk?a@&A=MRsvS6iVy`M!bwLz8zi`asOv#wT+}xZ$9o^faEr(@b*n+N@ zi|!HomtRB!r=INQe zYItVK19_K&>>b*j_^0)*XkCQA*)M;5aZO|l+$Hm{k*f6(g_+Vx-zbzNREOCZxs)xA zT9EKE#uw_lPc9H6ZUdE?q*5~rC*23(-eHFp_fDfd7mURQ>eIMYb&z2uJ&tMI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var int $neighbours @@ -43,16 +55,16 @@ protected function setPixel(int $x, int $y, int $M_TYPE): void { $this->image, $x1, $y1, - $x1 + $rectsize, - $y1 + $rectsize, + ($x1 + $rectsize), + ($y1 + $rectsize), $this->moduleValues[$M_TYPE] ); // bottom left imagefilledrectangle( $this->image, $x1, - $y2 - $rectsize, - $x1 + $rectsize, + ($y2 - $rectsize), + ($x1 + $rectsize), $y2, $this->moduleValues[$M_TYPE] ); @@ -62,59 +74,59 @@ protected function setPixel(int $x, int $y, int $M_TYPE): void { // top right imagefilledrectangle( $this->image, - $x2 - $rectsize, + ($x2 - $rectsize), $y1, $x2, - $y1 + $rectsize, + ($y1 + $rectsize), $this->moduleValues[$M_TYPE] ); // bottom right imagefilledrectangle( $this->image, - $x2 - $rectsize, - $y2 - $rectsize, + ($x2 - $rectsize), + ($y2 - $rectsize), $x2, $y2, $this->moduleValues[$M_TYPE] ); } - if ($neighbours & (1 << 1)) { // neighbour сверху + if ($neighbours & (1 << 1)) { // neighbour top // top left imagefilledrectangle( $this->image, $x1, $y1, - $x1 + $rectsize, - $y1 + $rectsize, + ($x1 + $rectsize), + ($y1 + $rectsize), $this->moduleValues[$M_TYPE] ); // top right imagefilledrectangle( $this->image, - $x2 - $rectsize, + ($x2 - $rectsize), $y1, $x2, - $y1 + $rectsize, + ($y1 + $rectsize), $this->moduleValues[$M_TYPE] ); } - if ($neighbours & (1 << 5)) { // neighbour снизу + if ($neighbours & (1 << 5)) { // neighbour bottom // bottom left imagefilledrectangle( $this->image, $x1, - $y2 - $rectsize, - $x1 + $rectsize, + ($y2 - $rectsize), + ($x1 + $rectsize), $y2, $this->moduleValues[$M_TYPE] ); // bottom right imagefilledrectangle( $this->image, - $x2 - $rectsize, - $y2 - $rectsize, + ($x2 - $rectsize), + ($y2 - $rectsize), $x2, $y2, $this->moduleValues[$M_TYPE] @@ -127,51 +139,51 @@ protected function setPixel(int $x, int $y, int $M_TYPE): void { if (!$this->matrix->check($x, $y)) { - if ($neighbours & 1 && $neighbours & (1 << 7) && $neighbours & (1 << 1)) { + if (($neighbours & 1) && ($neighbours & (1 << 7)) && ($neighbours & (1 << 1))) { // top left imagefilledrectangle( $this->image, $x1, $y1, - $x1 + $rectsize, - $y1 + $rectsize, - $this->moduleValues[$M_TYPE | QRMatrix::IS_DARK] + ($x1 + $rectsize), + ($y1 + $rectsize), + $this->moduleValues[($M_TYPE | QRMatrix::IS_DARK)] ); } - if ($neighbours & (1 << 1) && $neighbours & (1 << 2) && $neighbours & (1 << 3)) { + if (($neighbours & (1 << 1)) && ($neighbours & (1 << 2)) && ($neighbours & (1 << 3))) { // top right imagefilledrectangle( $this->image, - $x2 - $rectsize, + ($x2 - $rectsize), $y1, $x2, - $y1 + $rectsize, - $this->moduleValues[$M_TYPE | QRMatrix::IS_DARK] + ($y1 + $rectsize), + $this->moduleValues[($M_TYPE | QRMatrix::IS_DARK)] ); } - if ($neighbours & (1 << 7) && $neighbours & (1 << 6) && $neighbours & (1 << 5)) { + if (($neighbours & (1 << 7)) && ($neighbours & (1 << 6)) && ($neighbours & (1 << 5))) { // bottom left imagefilledrectangle( $this->image, $x1, - $y2 - $rectsize, - $x1 + $rectsize, + ($y2 - $rectsize), + ($x1 + $rectsize), $y2, - $this->moduleValues[$M_TYPE | QRMatrix::IS_DARK] + $this->moduleValues[($M_TYPE | QRMatrix::IS_DARK)] ); } - if ($neighbours & (1 << 3) && $neighbours & (1 << 4) && $neighbours & (1 << 5)) { + if (($neighbours & (1 << 3)) && ($neighbours & (1 << 4)) && ($neighbours & (1 << 5))) { // bottom right imagefilledrectangle( $this->image, - $x2 - $rectsize, - $y2 - $rectsize, + ($x2 - $rectsize), + ($y2 - $rectsize), $x2, $y2, - $this->moduleValues[$M_TYPE | QRMatrix::IS_DARK] + $this->moduleValues[($M_TYPE | QRMatrix::IS_DARK)] ); } } @@ -180,8 +192,8 @@ protected function setPixel(int $x, int $y, int $M_TYPE): void { $this->image, (int)(($x * $this->scale) + ($this->scale / 2)), (int)(($y * $this->scale) + ($this->scale / 2)), - (int)(2 * $this->options->circleRadius * $this->scale), - (int)(2 * $this->options->circleRadius * $this->scale), + (int)($this->scale - 1), + (int)($this->scale - 1), $this->moduleValues[$M_TYPE] ); } @@ -193,17 +205,17 @@ protected function setPixel(int $x, int $y, int $M_TYPE): void { // -------------------- $options = new QROptions([ - 'outputType'=> QROutputInterface::CUSTOM, - 'outputInterface' => QRCustomPNG::class, - 'eccLevel' => EccLevel::M, + 'outputType' => QROutputInterface::CUSTOM, + 'outputInterface' => QRGdRounded::class, + 'eccLevel' => EccLevel::M, 'imageTransparent' => false, - 'imageBase64' => false, - 'scale' => 20 + 'imageBase64' => false, + 'scale' => 30 ]); $qrcode = new QRCode($options); -$img = $qrcode->render("https://www.youtube.com/watch?v=dQw4w9WgXcQ"); +$img = $qrcode->render('https://www.youtube.com/watch?v=dQw4w9WgXcQ'); header('Content-type: image/png');