-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Rewrite README.md #660
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
Merged
Rewrite README.md #660
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
90cc1d3
Rewrite README.md
Shane32 4ce6daa
Add QRCoderSamples project and sample code for generating QR codes
Shane32 c7311b5
Update README.md to include renderer requirements and notes for bette…
Shane32 26085ac
Add example for accessing QRCodeData module matrix and rendering as A…
Shane32 5e7e683
Update README.md
Shane32 43dfc0c
Update README.md
Shane32 16ab12d
Add link to upcoming features in README.md
Shane32 be87b89
Clarify Micro QR code storage capacity and link to specification in R…
Shane32 cc31e2a
Clarify storage capacity details for Micro QR codes in README.md
Shane32 8a93b09
Update README.md
Shane32 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>net8.0-windows</TargetFramework> | ||
| <NoWarn>$(NoWarn);CA1707</NoWarn> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\QRCoder\QRCoder.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| using QRCoder; | ||
|
|
||
| namespace QRCoderSamples; | ||
|
|
||
| /// <summary> | ||
| /// Sample code from the README.md file | ||
| /// </summary> | ||
| public static class ReadmeSamples | ||
| { | ||
| /// <summary> | ||
| /// Quick Start - Generate a simple black and white PNG QR code | ||
| /// </summary> | ||
| public static void QuickStart_SimplePng() | ||
| { | ||
| // Generate a simple black and white PNG QR code | ||
| byte[] qrCodeImage = PngByteQRCodeHelper.GetQRCode("Hello World", QRCodeGenerator.ECCLevel.Q, 20); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Quick Start - Generate a scalable black and white SVG QR code | ||
| /// </summary> | ||
| public static void QuickStart_SimpleSvg() | ||
| { | ||
| // Generate a scalable black and white SVG QR code | ||
| using var qrCodeData = QRCodeGenerator.GenerateQrCode("Hello World", QRCodeGenerator.ECCLevel.Q); | ||
| using var svgRenderer = new SvgQRCode(qrCodeData); | ||
| string svg = svgRenderer.GetGraphic(); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Payload Generator - Create a bookmark payload | ||
| /// </summary> | ||
| public static void PayloadGenerator_Bookmark() | ||
| { | ||
| // Create a bookmark payload | ||
| var bookmarkPayload = new PayloadGenerator.Bookmark("https://github.com/Shane32/QRCoder", "QRCoder Repository"); | ||
|
|
||
| // Generate the QR code data from the payload | ||
| using var qrCodeData = QRCodeGenerator.GenerateQrCode(bookmarkPayload); | ||
|
|
||
| // Or override the ECC level | ||
| using var qrCodeData2 = QRCodeGenerator.GenerateQrCode(bookmarkPayload, QRCodeGenerator.ECCLevel.H); | ||
|
|
||
| // Render the QR code | ||
| using var pngRenderer = new PngByteQRCode(qrCodeData); | ||
| byte[] qrCodeImage = pngRenderer.GetGraphic(20); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Micro QR Code - Generate a Micro QR code | ||
| /// </summary> | ||
| public static void MicroQRCode_Simple() | ||
| { | ||
| // Generate a Micro QR code (versions M1-M4, represented as -1 to -4) | ||
| using var qrCodeData = QRCodeGenerator.GenerateMicroQrCode("Hello", QRCodeGenerator.ECCLevel.L, requestedVersion: -2); | ||
| using var qrCode = new PngByteQRCode(qrCodeData); | ||
| byte[] qrCodeImage = qrCode.GetGraphic(20); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Working with QRCodeData - Access the module matrix directly | ||
| /// </summary> | ||
| public static void QRCodeData_ModuleMatrix() | ||
| { | ||
| // Generate QR code data | ||
| using var qrCodeData = QRCodeGenerator.GenerateQrCode("Hello World", QRCodeGenerator.ECCLevel.Q); | ||
|
|
||
| // Access the module matrix | ||
| var moduleMatrix = qrCodeData.ModuleMatrix; | ||
| int size = moduleMatrix.Count; // Size of the QR code (includes quiet zone) | ||
|
|
||
| // Manually render as ASCII (versus the included ASCII renderer) | ||
| for (int y = 0; y < size; y++) | ||
| { | ||
| for (int x = 0; x < size; x++) | ||
| { | ||
| // Check if module is dark (true) or light (false) | ||
| bool isDark = moduleMatrix[y][x]; | ||
| Console.Write(isDark ? "██" : " "); | ||
| } | ||
| Console.WriteLine(); | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.