0

I've got this picture: The FIrst Picture

Imagine this as a 4x4 tile world of which the tiles are 32x32 pixels each.

then take a look at picture: another example picture:

Look at the stone tile, it has edges which are outside the grid. Can I use a bufferedImage for this or do I need to do something else to make this work?

If so, could you help me with it by explain it because I've got no clue on how to achieve this is my game?

another example picture: another example picture:

Let me explain it More Clearly... 1st image = Grid, 2nd Image = Tile Overlapping the grid... (thats what i want to have because then it's a new tile which I can use to make my game look better!), 3d Image = An example of how it would tile!

Pim Schwippert
  • 105
  • 1
  • 7

2 Answers2

2

Simply use PhotoShop to edit the image to 32x32 pixel size....then use it in your game....

/////////////EDITED//////////////////

As shown here, AffineTransformOp offers the additional flexibility of choosing the interpolation type.

BufferedImage before = getBufferedImage(encoded);
int w = before.getWidth();
int h = before.getHeight();
BufferedImage after = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
AffineTransform at = new AffineTransform();
at.scale(2.0, 2.0);
AffineTransformOp scaleOp = 
   new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR);
after = scaleOp.filter(before, after);
Community
  • 1
  • 1
Kumar Vivek Mitra
  • 33,294
  • 6
  • 48
  • 75
  • i meant, that i wanted to use that image for more than one different tile... how am I supposed to code that... – Pim Schwippert Sep 09 '12 at 14:28
  • But all the tiles will have the same size..right.....?? fine...i am giving you a code to scale the buffered image..try it.. – Kumar Vivek Mitra Sep 09 '12 at 14:30
  • Oh god, this is hard to explain... Look: I want it to go over the edge to create a new tile that way they'll tile better and it less texturing work... Do you get what i mean? – Pim Schwippert Sep 09 '12 at 14:32
  • @ Fine.... if its all 32x32 tiles with the same or different image.... simply make the of that size using PhotoShop or any editor of your choice..then use it... whats the probs in it..... the above code does that programmatically....now its your say...which one to go with – Kumar Vivek Mitra Sep 09 '12 at 14:34
  • Wow... let me explain it AGAIN... 1st image = Grid, 2nd Image = Tile Overlapping the grid... (thats what i want to have because then it's a new tile which I can use to make my game look better!), 3d Image = An example of how it would tile! – Pim Schwippert Sep 09 '12 at 14:39
  • +1 `AffineTransform` may also be used to _translate_ the image so that its center overlies the grid cell. Citation added. – trashgod Sep 10 '12 at 12:49
2

To completely eliminate boundary artifact, you can use Penrose tiles.

You can mitigate the edge artifact using anti-aliasing. This example uses TexturePaint with three variant shades of each color: original, darker and lighter. You can experiment with a larger number of shades for better results.

image

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045