Java's drawImage method:
drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer)Javascript drawImage:
drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh)
With Java your focus is on the destination first and then where you are reading the information from.
With Javascript, you grab some part of an image and put it onto the canvas.
I found that working with the width and height easier as well instead of doing things like "x + width" all the time.
When I was trying to get it right though, seems I was trying to be too creative.
Found a site with a nice image explaining the situation though:
Props to the guys for making it look easy.
No comments:
Post a Comment