Procházet zdrojové kódy

:octocat: allow reflectance reversal via QROptions::$invertMatrix

smiley před 2 roky
rodič
revize
81ef065af8
2 změnil soubory, kde provedl 9 přidání a 2 odebrání
  1. 4 0
      src/Output/QROutputAbstract.php
  2. 5 2
      src/QROptionsTrait.php

+ 4 - 0
src/Output/QROutputAbstract.php

@@ -61,6 +61,10 @@ abstract class QROutputAbstract implements QROutputInterface{
 		$this->options = $options;
 		$this->matrix  = $matrix;
 
+		if($this->options->invertMatrix){
+			$this->matrix->invert();
+		}
+
 		$this->setMatrixDimensions();
 		$this->setModuleValues();
 	}

+ 5 - 2
src/QROptionsTrait.php

@@ -157,10 +157,13 @@ trait QROptionsTrait{
 	 */
 	protected $bgColor = null;
 
+	/**
+	 * Whether to invert the matrix (reflectance reversal)
+	 */
+	protected bool $invertMatrix = false;
+
 	/**
 	 * Whether to draw the light (false) modules
-	 *
-	 * @var bool
 	 */
 	protected bool $drawLightModules = true;