Here is my question
I kind of not understand what is the sx and sy is for in below function
context.drawImage(Image, sx, sy, sw, sh, dx, dy, dw, dh);
what I really mean is if we change the values of sx and sy and set our dx and dy to a fix value, let say dx=0 and dy=0, is there really going to make any different to our image on the canvas when we set sx=300 and sy=300 as compared to sx=0 and sy=0? I mean the destination image is still in the location dx=dy=0 even we set sx and sy to different values, right? I know this is a stupid question but I just need to know the answer, thanks!
(sx, sy) is the top-left corner of the source rectangle (within the source image) which are going to draw to the destination. Take a look at the diagram below:
[Reference]
sx=0,sy=0 is different from sx=300,sy=300 because they refer to different source rectangles.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With