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

Add new method to return byte[] from QrCode instance. #57

Open
guitarrapc opened this issue Mar 24, 2023 · 0 comments
Open

Add new method to return byte[] from QrCode instance. #57

guitarrapc opened this issue Mar 24, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@guitarrapc
Copy link
Owner

guitarrapc commented Mar 24, 2023

Presudo code.

var content = "foobar";
var qrCode = new QrCode(content, new Vector2Slim(256, 256), SKEncodedImageFormat.Png);
byte[] bytes = qrCode.GetImage(ECCLevel.L); // <- new. return byte[]

// treat byte as you like. .AsSpan() or any.

How change?

Current API is following.

using var stream = new MemoryStream();
var qr = new QrCode("WIFI:T:WPA;S:mynetwork;P:mypass;;", new Vector2Slim(512, 512), SKEncodedImageFormat.Png);
qr.GenerateImage(stream);
Bitmap.FromStream(stream).Dump(); // Show Bitmap on LinqPad

image

This become...

var qrCode = new QrCode("WIFI:T:WPA;S:mynetwork;P:mypass;;", new Vector2Slim(256, 256), SKEncodedImageFormat.Png);
Bitmap.FromStream(new MemoryStream(qrCode.GetImage(ECCLevel.L))).Dump();
@guitarrapc guitarrapc added the enhancement New feature or request label Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant