Jump to content
  • Advertisement
Sign in to follow this  
deonbotha

[java] tile images

This topic is 4763 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have an image consisting of a few tiles: what I want to do it extract each tile and put it in an Image array, how do I go about copying a part of that image specified by coords into a new image?

Share this post


Link to post
Share on other sites
Advertisement
It might be easier to have each of the tiles as individual images rather than having them all as one big image. Theres a discussion about tiles vs tilesets floating around the isometric forum if I remember

Share this post


Link to post
Share on other sites
granted yea it is easier just to use the individual image, it's what I'm doing at the moment. I'm just trying to implement it as a tileset to learn something new, but I'm having trouble finding a way to copy part of an existing image into a new image... any help?

Share this post


Link to post
Share on other sites
Quote:
Original post by deonbotha
what I want to do it extract each tile and put it in an Image array,

You've got a couple of options. The first - and probably easiest, as you're already using Images - is to simply crop the image using a CropImageFilter.

The second way is to use an array of BufferedImages instead. The main image (tileset) would be loaded using a BufferedImage, and then you'd use the BufferedImage.getSubimage method to obtain the smaller images and copy them.

Both examples (basic usage) are demonstrated here. There are also other Image resources there that might be of interest.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!