[tiled] r584 - trunk/src/tiled/mapeditor/util/cutter
svn@biggeruniverse.com
svn at biggeruniverse.com
Sat Feb 18 00:51:49 PST 2006
Author: bjorn
Date: 2006-02-18 02:51:48 -0600 (Sat, 18 Feb 2006)
New Revision: 584
Modified:
trunk/src/tiled/mapeditor/util/cutter/BasicTileCutter.java
trunk/src/tiled/mapeditor/util/cutter/BorderTileCutter.java
trunk/src/tiled/mapeditor/util/cutter/TileCutter.java
Log:
Some whitespace cleanup and adding the copyright notice.
Modified: trunk/src/tiled/mapeditor/util/cutter/BasicTileCutter.java
===================================================================
--- trunk/src/tiled/mapeditor/util/cutter/BasicTileCutter.java 2006-02-17 23:18:32 UTC (rev 583)
+++ trunk/src/tiled/mapeditor/util/cutter/BasicTileCutter.java 2006-02-18 08:51:48 UTC (rev 584)
@@ -1,3 +1,15 @@
+/*
+ * Tiled Map Editor, (c) 2004-2006
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Adam Turk <aturk at biggeruniverse.com>
+ * Bjorn Lindeijer <b.lindeijer at xs4all.nl>
+ */
+
package tiled.mapeditor.util.cutter;
import java.awt.Dimension;
@@ -5,58 +17,61 @@
import java.awt.Image;
import java.awt.image.BufferedImage;
-public class BasicTileCutter implements TileCutter {
+/**
+ * @version $Id$
+ */
+public class BasicTileCutter implements TileCutter
+{
+ private int nextX, nextY;
+ private BufferedImage image;
+ private int tileWidth, tileHeight, frame, offset;
- private int nextX, nextY;
- private BufferedImage image;
- private int tileWidth, tileHeight, frame, offset;
-
- public BasicTileCutter(int width, int height, int frame, int offset) {
- this.tileWidth = width;
- this.tileHeight = height;
- this.frame = frame;
- this.offset = offset;
-
- //do initial setup
- nextX = offset+frame;
- nextY = offset+frame;
- }
-
- public void setImage(Image image) {
- int iw = image.getWidth(null);
- int ih = image.getHeight(null);
- this.image = new BufferedImage(iw, ih, BufferedImage.TYPE_INT_ARGB);
- //FIXME: although faster, the following doesn't seem to handle alpha on some platforms...
+ public BasicTileCutter(int width, int height, int frame, int offset) {
+ this.tileWidth = width;
+ this.tileHeight = height;
+ this.frame = frame;
+ this.offset = offset;
+
+ //do initial setup
+ nextX = offset + frame;
+ nextY = offset + frame;
+ }
+
+ public void setImage(Image image) {
+ int iw = image.getWidth(null);
+ int ih = image.getHeight(null);
+ this.image = new BufferedImage(iw, ih, BufferedImage.TYPE_INT_ARGB);
+ //FIXME: although faster, the following doesn't seem to handle alpha on some platforms...
//GraphicsConfiguration config =
// GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
//Image tilesetImage = config.createCompatibleImage(tileWidth, tileHeight);
//Graphics tg = tilesetImage.getGraphics();
- Graphics2D tg = this.image.createGraphics();
-
- tg.drawImage(image, 0, 0,
- iw, ih,
+ Graphics2D tg = this.image.createGraphics();
+
+ tg.drawImage(image,
0, 0, iw, ih,
+ 0, 0, iw, ih,
null);
- }
+ }
- public Image getNextTile() throws Exception {
-
- if(nextY + tileHeight < image.getHeight()) {
- BufferedImage tile = image.getSubimage(nextX, nextY, tileWidth, tileHeight);
- nextX += tileWidth+frame;
-
- if(nextX+tileWidth > image.getWidth()) {
- nextX = offset + frame;
- nextY += tileHeight+frame;
- }
-
- return tile;
- }
-
- return null;
- }
+ public Image getNextTile() throws Exception {
+ if (nextY + tileHeight < image.getHeight()) {
+ BufferedImage tile =
+ image.getSubimage(nextX, nextY, tileWidth, tileHeight);
+ nextX += tileWidth+frame;
- public Dimension getDimensions() {
- return new Dimension(tileWidth, tileHeight);
- }
+ if (nextX + tileWidth > image.getWidth()) {
+ nextX = offset + frame;
+ nextY += tileHeight+frame;
+ }
+
+ return tile;
+ }
+
+ return null;
+ }
+
+ public Dimension getDimensions() {
+ return new Dimension(tileWidth, tileHeight);
+ }
}
Modified: trunk/src/tiled/mapeditor/util/cutter/BorderTileCutter.java
===================================================================
--- trunk/src/tiled/mapeditor/util/cutter/BorderTileCutter.java 2006-02-17 23:18:32 UTC (rev 583)
+++ trunk/src/tiled/mapeditor/util/cutter/BorderTileCutter.java 2006-02-18 08:51:48 UTC (rev 584)
@@ -1,3 +1,15 @@
+/*
+ * Tiled Map Editor, (c) 2004-2006
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Adam Turk <aturk at biggeruniverse.com>
+ * Bjorn Lindeijer <b.lindeijer at xs4all.nl>
+ */
+
package tiled.mapeditor.util.cutter;
import java.awt.Dimension;
@@ -3,20 +15,22 @@
import java.awt.Image;
-public class BorderTileCutter implements TileCutter {
+/**
+ * @version $Id$
+ */
+public class BorderTileCutter implements TileCutter
+{
+ public void setImage(Image image) {
+ // TODO Auto-generated method stub
- public void setImage(Image image) {
- // TODO Auto-generated method stub
+ }
- }
+ public Image getNextTile() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
- public Image getNextTile() throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Dimension getDimensions() {
- // TODO Auto-generated method stub
- return null;
- }
-
+ public Dimension getDimensions() {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
Modified: trunk/src/tiled/mapeditor/util/cutter/TileCutter.java
===================================================================
--- trunk/src/tiled/mapeditor/util/cutter/TileCutter.java 2006-02-17 23:18:32 UTC (rev 583)
+++ trunk/src/tiled/mapeditor/util/cutter/TileCutter.java 2006-02-18 08:51:48 UTC (rev 584)
@@ -1,3 +1,15 @@
+/*
+ * Tiled Map Editor, (c) 2004-2006
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Adam Turk <aturk at biggeruniverse.com>
+ * Bjorn Lindeijer <b.lindeijer at xs4all.nl>
+ */
+
package tiled.mapeditor.util.cutter;
import java.awt.Dimension;
@@ -3,7 +15,11 @@
import java.awt.Image;
-public interface TileCutter {
- public void setImage(Image image);
- public Image getNextTile() throws Exception;
- public Dimension getDimensions();
+/**
+ * @version $Id$
+ */
+public interface TileCutter
+{
+ public void setImage(Image image);
+ public Image getNextTile() throws Exception;
+ public Dimension getDimensions();
}
More information about the tiled-commit
mailing list