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 function for rendering to canvas 2D context #50

Merged
merged 1 commit into from Mar 2, 2018

Conversation

Projects
None yet
2 participants
@TomasHubelbauer
Contributor

TomasHubelbauer commented Mar 1, 2018

Hey, I have added renderTo2dContext function which takes a context one would get by calling getContext('2d') on a canvas element and optional cellSize and renders the QR code onto the canvas.

I decided against adding x and y coordinate arguments as I expect people will, like me, want to use this to render to a canvas element prepared so that it is a perfect fit for the QR code. I can add it if you like.

I have also avoided updating the demo, as it didn't seem like showcasing rendering to canvas would add anything to it (it doesn't list API methods or anything). One thing to note, though, is that the qrcode.js file in the demo and the one directly in js are different. I am not sure if you are aware of this. I didn't find any way through which the file in the demo was copied over from the main file or anything like that, so I left it alone, but I can fix that for you by replacing the demo file with the main file. Let me know if you want that.

@kazuhikoarase kazuhikoarase merged commit 28487e9 into kazuhikoarase:master Mar 2, 2018

@TomasHubelbauer TomasHubelbauer deleted the TomasHubelbauer:render-to-canvas-2d-context branch Mar 3, 2018

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