Bacon / BaconQrCode

QR Code Generator for PHP
BSD 2-Clause "Simplified" License
1.86k stars 212 forks source link

Allow eye interfaces to have different paths for each eye #104

Closed mustanggb closed 2 years ago

mustanggb commented 2 years ago

e.g. Means users are able to do something like this:

final class MyEye implements EyeInterface
{
    <snip>

    public function getExternalPath($location) : Path
    {
        switch ($location) {
            case 'topLeft':
                return (new Path())
                    ->move(-3.5, 3.5)
                    ->line(-3.5, 0)
                    ->ellipticArc(3.5, 3.5, 0, false, true, 0, -3.5)
                    ->line(3.5, -3.5)
                    ->line(3.5, 3.5)
                    ->close()
                    ->move(2.5, 0)
                    ->ellipticArc(2.5, 2.5, 0, false, true, 0, 2.5)
                    ->ellipticArc(2.5, 2.5, 0, false, true, -2.5, 0)
                    ->ellipticArc(2.5, 2.5, 0, false, true, 0, -2.5)
                    ->ellipticArc(2.5, 2.5, 0, false, true, 2.5, 0)
                    ->close()
                ;
            case 'topRight':
                return (new Path())
                    ->move(-3.5, -3.5)
                    ->line(0, -3.5)
                    ->ellipticArc(3.5, 3.5, 0, false, true, 3.5, 0)
                    ->line(3.5, 3.5)
                    ->line(-3.5, 3.5)
                    ->close()
                    ->move(2.5, 0)
                    ->ellipticArc(2.5, 2.5, 0, false, true, 0, 2.5)
                    ->ellipticArc(2.5, 2.5, 0, false, true, -2.5, 0)
                    ->ellipticArc(2.5, 2.5, 0, false, true, 0, -2.5)
                    ->ellipticArc(2.5, 2.5, 0, false, true, 2.5, 0)
                    ->close()
                ;
            case 'bottomLeft':
                return (new Path())
                    ->move(3.5, 3.5)
                    ->line(0, 3.5)
                    ->ellipticArc(3.5, 3.5, 0, false, true, -3.5, 0)
                    ->line(-3.5, -3.5)
                    ->line(3.5, -3.5)
                    ->close()
                    ->move(2.5, 0)
                    ->ellipticArc(2.5, 2.5, 0, false, true, 0, 2.5)
                    ->ellipticArc(2.5, 2.5, 0, false, true, -2.5, 0)
                    ->ellipticArc(2.5, 2.5, 0, false, true, 0, -2.5)
                    ->ellipticArc(2.5, 2.5, 0, false, true, 2.5, 0)
                    ->close()
                ;
        }
    }

    <snip>
}
mustanggb commented 2 years ago

Actually on a second look it might just be that eye rotation isn't working.

codecov-commenter commented 2 years ago

Codecov Report

Merging #104 (70590df) into master (d70c840) will increase coverage by 0.05%. The diff coverage is 62.50%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #104      +/-   ##
============================================
+ Coverage     63.42%   63.47%   +0.05%     
  Complexity      928      928              
============================================
  Files            47       47              
  Lines          2783     2787       +4     
============================================
+ Hits           1765     1769       +4     
  Misses         1018     1018              
Impacted Files Coverage Δ
src/Renderer/Eye/CompositeEye.php 0.00% <0.00%> (ø)
src/Renderer/Eye/SimpleCircleEye.php 0.00% <0.00%> (ø)
src/Renderer/Eye/ModuleEye.php 100.00% <100.00%> (ø)
src/Renderer/Eye/SquareEye.php 100.00% <100.00%> (ø)
src/Renderer/ImageRenderer.php 94.91% <100.00%> (+0.36%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d70c840...70590df. Read the comment docs.

DASPRiD commented 2 years ago

Actually on a second look it might just be that eye rotation isn't working.

Yeah, this does somewhat collide with eye rotation indeed.

mustanggb commented 2 years ago

Will close in favour of fixing rotation, see #105.