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

Allow SVG exporting under .NET 6 on Linux #490

Merged
merged 4 commits into from
Apr 2, 2024

Conversation

Shane32
Copy link
Contributor

@Shane32 Shane32 commented Apr 2, 2024

Summary

This PR allows SVGs to be created under .NET 6 on Linux. The majority of the code is already compatible and does not use System.Drawing. The only code that does is the constructor for SvgLogo. This implementation simply removes only that constructor on .NET 6 on Linux, without removing any other code, allowing:

  1. SVGs without an embedded logo may be created
  2. The alternate SvgLogo constructor may be used, for SVG-based logos

This does not allow users to use PNG-based logos on .NET 6+ on Linux -- a 3rd constructor could be added for that scenario, either public or protected, where the user would supply the PNG data (generated from a third-party image library, for example). This is solved by #491 which can be merged independently.

What existing problem does the pull request solve?

This allows users of QRCoder on Linux to export SVG files

What is unique about this proposal?

Does not introduce any new dependencies

Test plan

The currently existing tests within the codebase have been updated to run on .NET 6 on Linux, excluding the one for the constructor that references System.Drawing.Bitmap.

@@ -103,6 +103,7 @@ public void can_render_svg_qrcode_without_quietzones_hex()
result.ShouldBe("4ab0417cc6127e347ca1b2322c49ed7d");
}

#if NETFRAMEWORK || NETSTANDARD2_0 || NET5_0 || NET6_0_WINDOWS
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#if !NET6_0 would exclude both .NET 6 on Linux and .NET 6 on Windows. So the ifdef has been fixed to properly run on all applicable test targets

@Shane32 Shane32 changed the title Allow SVG exporting under .NET 6 Allow SVG exporting under .NET 6 on Linux Apr 2, 2024
@codebude
Copy link
Owner

codebude commented Apr 2, 2024

Hi @Shane32 ,

thanks for your PR and your appreciation. I had a first look at your changes. It looks good to me so far. However, before I merge, I would like to run my test cases again. In addition, unfortunately the build and test pipeline (workflow.yml) is also broken. I haven't made any progress on the project for far too long... :-(

Long story short: I'm open to a merge, but I want to fix the workflow first.

@Shane32
Copy link
Contributor Author

Shane32 commented Apr 2, 2024

@codebude Thanks for the update. I've posted PR #492 to fix the workflows, which runs fine on my fork. Of course I can't be sure that publishing will work properly, but it seemed to be a simple matter of bumping the workflow dependencies.

@codebude
Copy link
Owner

codebude commented Apr 2, 2024

Test cases ran without failures. Let's merge.

@codebude codebude merged commit d634b72 into codebude:master Apr 2, 2024
3 checks passed
@codebude
Copy link
Owner

codebude commented Apr 2, 2024

Added .NET 6.0 support for SvgQRCode in the compatibility matrix: https://github.com/codebude/QRCoder/wiki/Advanced-usage---QR-Code-renderers

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

Successfully merging this pull request may close these issues.

2 participants