TileImage: s/drawTo/drawFragment
This commit is contained in:
parent
28be533163
commit
9a285f18ab
3 changed files with 19 additions and 11 deletions
|
@ -86,9 +86,9 @@ class Animation extends TileImage
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawTo(Graphics2D gr, int destX, int destY, int srcX, int srcY)
|
public void drawFragment(Graphics2D gr, int destX, int destY, int srcX, int srcY)
|
||||||
{
|
{
|
||||||
// Warning: drawing without considering the animation
|
// Warning: drawing without considering the animation
|
||||||
getDefaultImage().drawTo(gr, destX, destY, srcX, srcY);
|
getDefaultImage().drawFragment(gr, destX, destY, srcX, srcY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ public class MakeTiles
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawTo(Graphics2D gr, int destX, int destY, int srcX, int srcY) { throw new UnsupportedOperationException(); }
|
public void drawFragment(Graphics2D gr, int destX, int destY, int srcX, int srcY) { throw new UnsupportedOperationException(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
static class Composer
|
static class Composer
|
||||||
|
@ -239,7 +239,7 @@ public class MakeTiles
|
||||||
assert dest instanceof ComposeFrame;
|
assert dest instanceof ComposeFrame;
|
||||||
|
|
||||||
ComposeFrame f = (ComposeFrame) dest;
|
ComposeFrame f = (ComposeFrame) dest;
|
||||||
f.refImage.drawTo(c.getGr(f), f.offsetX, f.offsetY, 0, 0);
|
f.refImage.drawTo(c.getGr(f), f.offsetX, f.offsetY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,15 @@ public abstract class TileImage
|
||||||
{
|
{
|
||||||
public static final int STD_SIZE = 16;
|
public static final int STD_SIZE = 16;
|
||||||
|
|
||||||
public abstract void drawTo(Graphics2D gr, int destX, int destY, int srcX, int srcY);
|
/**
|
||||||
|
* Draws a part of this tile image to the given graphics context.
|
||||||
|
*/
|
||||||
|
public abstract void drawFragment(Graphics2D gr, int destX, int destY, int srcX, int srcY);
|
||||||
|
|
||||||
|
public final void drawTo(Graphics2D gr, int destX, int destY)
|
||||||
|
{
|
||||||
|
this.drawFragment(gr, destX, destY, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
public static class TileImageLayer extends TileImage
|
public static class TileImageLayer extends TileImage
|
||||||
{
|
{
|
||||||
|
@ -21,12 +29,12 @@ public abstract class TileImage
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawTo(Graphics2D gr, int destX, int destY, int srcX, int srcY)
|
public void drawFragment(Graphics2D gr, int destX, int destY, int srcX, int srcY)
|
||||||
{
|
{
|
||||||
if (below != null) {
|
if (below != null) {
|
||||||
below.drawTo(gr, destX, destY, srcX, srcY);
|
below.drawFragment(gr, destX, destY, srcX, srcY);
|
||||||
}
|
}
|
||||||
above.drawTo(gr, destX, destY, srcX, srcY);
|
above.drawFragment(gr, destX, destY, srcX, srcY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,9 +50,9 @@ public abstract class TileImage
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawTo(Graphics2D gr, int destX, int destY, int srcX, int srcY)
|
public void drawFragment(Graphics2D gr, int destX, int destY, int srcX, int srcY)
|
||||||
{
|
{
|
||||||
source.drawTo(gr, destX, destY, srcX+offsetX, srcY+offsetY);
|
source.drawFragment(gr, destX, destY, srcX+offsetX, srcY+offsetY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +73,7 @@ public abstract class TileImage
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawTo(Graphics2D gr, int destX, int destY, int srcX, int srcY)
|
public void drawFragment(Graphics2D gr, int destX, int destY, int srcX, int srcY)
|
||||||
{
|
{
|
||||||
srcX = srcX * basisSize / STD_SIZE;
|
srcX = srcX * basisSize / STD_SIZE;
|
||||||
srcY = srcY * basisSize / STD_SIZE;
|
srcY = srcY * basisSize / STD_SIZE;
|
||||||
|
|
Reference in a new issue