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

this “drawImage ” API is different from HTML5 Canvas “drawImage” #827

Closed
match08 opened this issue Oct 26, 2016 · 4 comments
Closed

Comments

@match08
Copy link

match08 commented Oct 26, 2016

var Canvas = require('canvas');
var canvas = new Canvas(200, 200);
var ctx = canvas.getContext('2d');
ctx.drawImgae(image,10,10,1000,100);

this “drawImgae ” api different h5 Canvas “drawImgae”

@LinusU
Copy link
Collaborator

LinusU commented Oct 26, 2016

How do they differ?

@match08
Copy link
Author

match08 commented Oct 29, 2016

html5 Canvas: "sx "and "sy" is crop image start point , "swidth " and "sheight " is scale image.
"x" and "y" is canvas start point, "width and "height" is scale "swidth " and "sheight " image

@zbjornson zbjornson changed the title this “drawImgae ” api different h5 Canvas “drawImgae” this “drawImage ” API is different from HTML5 Canvas “drawImage” Nov 5, 2017
@paramaggarwal
Copy link

@match08 That changes based on the number of arguments passed to the function. Please see Mozilla docs.

@zbjornson
Copy link
Collaborator

I think this is working as intended for all three overloads

void ctx.drawImage(image, dx, dy);
void ctx.drawImage(image, dx, dy, dWidth, dHeight);
void ctx.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight);

There's test coverage for all of those. @match08 please let us know if you've found a difference.

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

No branches or pull requests

4 participants