From 51d7c2b8a300bd72802295c2cc748da95dc9cd7f Mon Sep 17 00:00:00 2001 From: smiley Date: Sun, 12 Mar 2023 14:32:02 +0100 Subject: [PATCH] :octocat: added QRMatrix::M_*_DARK constants for convenience --- examples/eps.php | 34 ++++----- examples/fpdf.php | 31 ++++---- examples/html.php | 34 ++++----- examples/image.php | 42 +++++----- examples/imagick.php | 39 +++++----- examples/imagickWithLogo.php | 7 +- examples/qrcode-interactive.php | 34 ++++----- examples/svg.php | 4 +- examples/svgMeltedModules.php | 6 +- examples/svgRandomColoredDots.php | 16 ++-- examples/svgRoundQuietzone.php | 16 ++-- examples/svgWithLogo.php | 4 +- examples/text.php | 40 +++++----- src/Data/QRMatrix.php | 52 ++++++++----- src/Output/QROutputInterface.php | 40 +++++----- tests/Data/QRMatrixTest.php | 102 +++++++++++++------------ tests/Output/QRFpdfTest.php | 4 +- tests/Output/QRGdImageTestAbstract.php | 4 +- tests/Output/QRImagickTest.php | 4 +- tests/Output/QRMarkupTestAbstract.php | 4 +- tests/Output/QRStringTEXTTest.php | 4 +- 21 files changed, 270 insertions(+), 251 deletions(-) diff --git a/examples/eps.php b/examples/eps.php index a73d18fd0..aca876623 100644 --- a/examples/eps.php +++ b/examples/eps.php @@ -23,32 +23,32 @@ $options = new QROptions([ 'cachefile' => __DIR__.'/test.eps', // save to file 'moduleValues' => [ // finder - (QRMatrix::M_FINDER | QRMatrix::IS_DARK) => [0, 63, 255], // dark (true) - QRMatrix::M_FINDER => [233, 233, 233], // light (false) - (QRMatrix::M_FINDER_DOT | QRMatrix::IS_DARK) => [0, 63, 255], // finder dot, dark (true) + QRMatrix::M_FINDER_DARK => [0, 63, 255], // dark (true) + QRMatrix::M_FINDER_DOT => [0, 63, 255], // finder dot, dark (true) + QRMatrix::M_FINDER => [233, 233, 233], // light (false) // alignment - (QRMatrix::M_ALIGNMENT | QRMatrix::IS_DARK) => [255, 0, 255], - QRMatrix::M_ALIGNMENT => [233, 233, 233], + QRMatrix::M_ALIGNMENT_DARK => [255, 0, 255], + QRMatrix::M_ALIGNMENT => [233, 233, 233], // timing - (QRMatrix::M_TIMING | QRMatrix::IS_DARK) => [255, 0, 0], - QRMatrix::M_TIMING => [233, 233, 233], + QRMatrix::M_TIMING_DARK => [255, 0, 0], + QRMatrix::M_TIMING => [233, 233, 233], // format - (QRMatrix::M_FORMAT | QRMatrix::IS_DARK) => [67, 159, 84], - QRMatrix::M_FORMAT => [233, 233, 233], + QRMatrix::M_FORMAT_DARK => [67, 159, 84], + QRMatrix::M_FORMAT => [233, 233, 233], // version - (QRMatrix::M_VERSION | QRMatrix::IS_DARK) => [62, 174, 190], - QRMatrix::M_VERSION => [233, 233, 233], + QRMatrix::M_VERSION_DARK => [62, 174, 190], + QRMatrix::M_VERSION => [233, 233, 233], // data - (QRMatrix::M_DATA | QRMatrix::IS_DARK) => [0, 0, 0], - QRMatrix::M_DATA => [233, 233, 233], + QRMatrix::M_DATA_DARK => [0, 0, 0], + QRMatrix::M_DATA => [233, 233, 233], // darkmodule - (QRMatrix::M_DARKMODULE | QRMatrix::IS_DARK) => [0, 0, 0], + QRMatrix::M_DARKMODULE => [0, 0, 0], // separator - QRMatrix::M_SEPARATOR => [233, 233, 233], + QRMatrix::M_SEPARATOR => [233, 233, 233], // quietzone - QRMatrix::M_QUIETZONE => [233, 233, 233], + QRMatrix::M_QUIETZONE => [233, 233, 233], // logo (requires a call to QRMatrix::setLogoSpace()), see QRImageWithLogo - QRMatrix::M_LOGO => [233, 233, 233], + QRMatrix::M_LOGO => [233, 233, 233], ], ]); diff --git a/examples/fpdf.php b/examples/fpdf.php index be868ead5..975228ca5 100644 --- a/examples/fpdf.php +++ b/examples/fpdf.php @@ -22,29 +22,30 @@ $options = new QROptions([ 'imageBase64' => false, 'moduleValues' => [ // finder - (QRMatrix::M_FINDER | QRMatrix::IS_DARK) => [0, 63, 255], // dark (true) - QRMatrix::M_FINDER => [255, 255, 255], // light (false), white is the transparency color and is enabled by default + QRMatrix::M_FINDER_DARK => [0, 63, 255], // dark (true) + QRMatrix::M_FINDER_DOT => [0, 63, 255], // finder dot, dark (true) + QRMatrix::M_FINDER => [255, 255, 255], // light (false), white is the transparency color and is enabled by default // alignment - (QRMatrix::M_ALIGNMENT | QRMatrix::IS_DARK) => [255, 0, 255], - QRMatrix::M_ALIGNMENT => [255, 255, 255], + QRMatrix::M_ALIGNMENT_DARK => [255, 0, 255], + QRMatrix::M_ALIGNMENT => [255, 255, 255], // timing - (QRMatrix::M_TIMING | QRMatrix::IS_DARK) => [255, 0, 0], - QRMatrix::M_TIMING => [255, 255, 255], + QRMatrix::M_TIMING_DARK => [255, 0, 0], + QRMatrix::M_TIMING => [255, 255, 255], // format - (QRMatrix::M_FORMAT | QRMatrix::IS_DARK) => [67, 191, 84], - QRMatrix::M_FORMAT => [255, 255, 255], + QRMatrix::M_FORMAT_DARK => [67, 191, 84], + QRMatrix::M_FORMAT => [255, 255, 255], // version - (QRMatrix::M_VERSION | QRMatrix::IS_DARK) => [62, 174, 190], - QRMatrix::M_VERSION => [255, 255, 255], + QRMatrix::M_VERSION_DARK => [62, 174, 190], + QRMatrix::M_VERSION => [255, 255, 255], // data - (QRMatrix::M_DATA | QRMatrix::IS_DARK) => [0, 0, 0], - QRMatrix::M_DATA => [255, 255, 255], + QRMatrix::M_DATA_DARK => [0, 0, 0], + QRMatrix::M_DATA => [255, 255, 255], // darkmodule - (QRMatrix::M_DARKMODULE | QRMatrix::IS_DARK) => [0, 0, 0], + QRMatrix::M_DARKMODULE => [0, 0, 0], // separator - QRMatrix::M_SEPARATOR => [255, 255, 255], + QRMatrix::M_SEPARATOR => [255, 255, 255], // quietzone - QRMatrix::M_QUIETZONE => [255, 255, 255], + QRMatrix::M_QUIETZONE => [255, 255, 255], ], ]); diff --git a/examples/html.php b/examples/html.php index 45a9ea1dc..2fcb21bba 100644 --- a/examples/html.php +++ b/examples/html.php @@ -22,30 +22,30 @@ header('Content-Type: text/html; charset=utf-8'); 'cssClass' => 'qrcode', 'moduleValues' => [ // finder - (QRMatrix::M_FINDER | QRMatrix::IS_DARK) => '#A71111', // dark (true) - QRMatrix::M_FINDER => '#FFBFBF', // light (false) - (QRMatrix::M_FINDER_DOT | QRMatrix::IS_DARK) => '#A71111', // finder dot, dark (true) + QRMatrix::M_FINDER_DARK => '#A71111', // dark (true) + QRMatrix::M_FINDER_DOT => '#A71111', // finder dot, dark (true) + QRMatrix::M_FINDER => '#FFBFBF', // light (false) // alignment - (QRMatrix::M_ALIGNMENT | QRMatrix::IS_DARK) => '#A70364', - QRMatrix::M_ALIGNMENT => '#FFC9C9', + QRMatrix::M_ALIGNMENT_DARK => '#A70364', + QRMatrix::M_ALIGNMENT => '#FFC9C9', // timing - (QRMatrix::M_TIMING | QRMatrix::IS_DARK) => '#98005D', - QRMatrix::M_TIMING => '#FFB8E9', + QRMatrix::M_TIMING_DARK => '#98005D', + QRMatrix::M_TIMING => '#FFB8E9', // format - (QRMatrix::M_FORMAT | QRMatrix::IS_DARK) => '#003804', - QRMatrix::M_FORMAT => '#00FB12', + QRMatrix::M_FORMAT_DARK => '#003804', + QRMatrix::M_FORMAT => '#00FB12', // version - (QRMatrix::M_VERSION | QRMatrix::IS_DARK) => '#650098', - QRMatrix::M_VERSION => '#E0B8FF', + QRMatrix::M_VERSION_DARK => '#650098', + QRMatrix::M_VERSION => '#E0B8FF', // data - (QRMatrix::M_DATA | QRMatrix::IS_DARK) => '#4A6000', - QRMatrix::M_DATA => '#ECF9BE', + QRMatrix::M_DATA_DARK => '#4A6000', + QRMatrix::M_DATA => '#ECF9BE', // darkmodule - (QRMatrix::M_DARKMODULE | QRMatrix::IS_DARK) => '#080063', + QRMatrix::M_DARKMODULE => '#080063', // separator - QRMatrix::M_SEPARATOR => '#AFBFBF', + QRMatrix::M_SEPARATOR => '#AFBFBF', // quietzone - QRMatrix::M_QUIETZONE => '#DDDDDD', + QRMatrix::M_QUIETZONE => '#DDDDDD', ], ]); @@ -58,7 +58,7 @@ header('Content-Type: text/html; charset=utf-8'); QRCode test