Eli Delventhal
|
 |
«
Reply #3 - Posted
2005-11-02 00:20:35 » |
|
Yeah, when I was learning Java2D I actually used the same example and also got confused. Basically the first values tell how much of the actual image you will draw, then the last values specify where it is drawn, as well as width, height, flipping, etc.
The different drawImages you can do:
drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer) Draws the image at (x,y), but transparent piexels are filled with bgcolor. drawImage(Image img, int x, int y, ImageObserver observer) Simply draws the image at (x,y) drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) Draws the image at (x,y) with resized to width and height dimensions and transparency filled in with bgcolor. drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) My favorite one: it draws the image at (x,y) and resizes it to width by height drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer) The most powerful one. Does what I said below, but transparent pixels are filled with bgcolor drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer) Will offset sx1,sy1 from the top left corner of the source and sx2-sx1 width by sy2-sy1 height and then draw that to (dx1,dy1) dx2-dx1 width by dy2-dy1 height.
Hopefully that makes sense.
|