Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iconBorderWidth Doesn't work #291

Closed
kuenzign opened this issue May 12, 2021 · 7 comments · Fixed by #351
Closed

iconBorderWidth Doesn't work #291

kuenzign opened this issue May 12, 2021 · 7 comments · Fixed by #351
Assignees

Comments

@kuenzign
Copy link

Type of issue

[x] Bug
[ ] Question (e.g. about handling/usage)
[ ] Request for new feature/improvement

Expected Behavior

The iconBorderWidth parameter is supposed to specify a border to be drawn around an icon inside the QR code.

Current Behavior

Currently, no border is drawn around icons.

Possible Solution (optional)

It looks like #245 broke this functionality.

Steps to Reproduce (for bugs)

Create a QRCode and call the GetGraphic() function while passing in a bitmap for the icon and a value greater than 1 for iconBorderWidth . Notice that the generated graphic does not have a border around the icon.

Your Environment

Nuget package 1.4.1

@DamienLaw
Copy link

DamienLaw commented Oct 15, 2021

It used to work but after this commit, it doesn't anymore.

e886baa

So revert back to Nuget package 1.3.9

@kuenzign
Copy link
Author

Yes, that is the commit from the pull request that I stated...

@codebude
Copy link
Owner

Hi @kuenzign , hi @DamienLaw ,

I refactored the code and added the functionality again. (But in a different manner without using Region.Exclude, which lead to problems on Linux systems in the past.) The new function behaves as follows:

  • If iconBorderWidth isn't set, the (new) default value of 0 triggers that no border/background is drawn. (=Same behaviour as before the code changes of this issue.)
  • If iconBorderWidth is set and iconBorderWidth > 0, the background/border is drawn as requested by you in this issue (=behaviour as it was before the code broke...)
  • A new (and optional) parameter called iconBackgroundColor can be set to define the color of the border/background of the icon. If iconBackgroundColor isn't set, its default value (null) kicks in and QRCoder chooses the lightColor as icon border/background color. You can checkout the new paramter in our wiki, too.

@codebude codebude added the fixed label Nov 23, 2021
@kuenzign
Copy link
Author

What nuget package release will this fix be included in?

@codebude
Copy link
Owner

In NuGet version 1.4.2. This was the last issue I planned to resolve before publishing 1.4.2. So it will be publicly available within the next couple hours.

@codebude
Copy link
Owner

It's live now. Feel free to check the also new release notes page, to see what has changed in 1.4.2 besides the icon background: https://github.com/codebude/QRCoder/wiki/Release-notes

@DamienLaw
Copy link

DamienLaw commented Dec 15, 2021

It seems that iconBackgroundColor is only available to the class QRCode and not Base64QRCode. I think it would be a nice addition to all types of QR Code renderers. For the moment, I'll use the QRCode class and manually convert to base64 string. Thanks a lot for iconBackgroundColor , it's really nice to have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants