Bacon / BaconQrCode

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

Eye rotation doesn't work with inherited colors #105

Open mustanggb opened 2 years ago

mustanggb commented 2 years ago

In drawEye() rotation will be ignored if inheritsBothColors() inheritsExternalColor() or inheritsInternalColor() return true.

Not sure what the best solution is, open to suggestions.

DASPRiD commented 2 years ago

Ugh, very good question. To be fair, I've written that code over four years ago, and I'm not even certain anymore what the actual logic in there was supposed to do.

Reading through it a little bit, the general logic was apparently this:

If some element inherits the main color, it is added to the global path object, otherwise it is directly drawn with the given rotation and color through the image back-end.

I guess the correct solution would be to rotate each path when appending it to the module path.

When you write a fix for that, please make sure to cover that new logic with one or more unit test, see:

https://github.com/Bacon/BaconQrCode/tree/master/test/Integration

mustanggb commented 2 years ago

I guess the correct solution would be to rotate each path when appending it to the module path.

This was my thought also, unfortunately path doesn't have a rotate function (yet).

My understanding of the codebase isn't able to chuck one in quickly either at the moment.

If I figure it out I'll be sure to let you know.