Splitting up an Image

I have an image which always has the height of 32 (pixels). The length is 32*?. I want to divide the image into ? pieces each with the height of 32 and the length of 32. Im this far:

// Variables

public Image pic;

// The Method

pic = load(path);// my custom method (it works)

// Following is Pseudocode

for(Image/32)

{

vector.add(image.cutoff(0,0,32,32);

}

thats how it is supposed to work. The problem is i don't know how i can transalate the pseudo-code into real code :(. Also i dont have much experience whith vectors :(.

[838 byte] By [Comp-Freaka] at [2007-11-27 9:17:55]
# 1
BufferedImage is easier to handle because it has getSubimage() method.
hiwaa at 2007-7-12 22:08:43 > top of Java-index,Java Essentials,Java Programming...
# 2
How do i use that method?How do i draw a buffered image onto a canvas?
Comp-Freaka at 2007-7-12 22:08:43 > top of Java-index,Java Essentials,Java Programming...
# 3

> How do i use that method?

http://java.sun.com/j2se/1.5.0/docs/api/java/awt/image/BufferedImage.html#getSubimage(int,%20int,%20int,%20int)

> How do i draw a buffered image onto a canvas?

BufferedImage is a subclass of Image, so you can pass it to the drawImage() method just like you could with the image object.

CaptainMorgan08a at 2007-7-12 22:08:43 > top of Java-index,Java Essentials,Java Programming...
# 4
Thanks! on that website i also found methods like gettilex and gettiley.What do they do? Whats meant by tile?p.s i awarded you guys some duke stars :)Message was edited by: Comp-Freak
Comp-Freaka at 2007-7-12 22:08:43 > top of Java-index,Java Essentials,Java Programming...
# 5

> Thanks! on that website i also found methods like

> gettilex and gettiley.

It's amazing all the information that you can find in the API. ;-)

Here's a reference link: http://java.sun.com/j2se/1.5.0/docs/api/

> What do they do? Whats meant by tile?

Click on the method and it will tell you:

- What the method does.

- What the parameters are.

- What the method returns.

- What exceptions (if any) the method throws.

CaptainMorgan08a at 2007-7-12 22:08:43 > top of Java-index,Java Essentials,Java Programming...
# 6
Nice! Im all set then :) Thanks again!
Comp-Freaka at 2007-7-12 22:08:43 > top of Java-index,Java Essentials,Java Programming...