diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..4c92784
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+/build
+/dist
+/dfEditor Installer.jar
+/izpack/lib
+/izpack/*.jar
diff --git a/build.xml b/build.xml
index e46f304..9a92ee2 100644
--- a/build.xml
+++ b/build.xml
@@ -130,7 +130,7 @@
-
+
diff --git a/nbproject/private/config.properties b/nbproject/private/config.properties
index e69de29..88a51cc 100644
--- a/nbproject/private/config.properties
+++ b/nbproject/private/config.properties
@@ -0,0 +1 @@
+platforms.JDK_1.6.home=/usr/lib/jvm/java-8-oracle
\ No newline at end of file
diff --git a/src/dfEditor/GraphicObject.java b/src/dfEditor/GraphicObject.java
index 04a2986..1b8ebca 100644
--- a/src/dfEditor/GraphicObject.java
+++ b/src/dfEditor/GraphicObject.java
@@ -30,23 +30,35 @@ public abstract class GraphicObject extends java.util.Observable
public enum Anchor { TOP_LEFT, CENTRE }
protected Rectangle _rect;
+ protected String _id;
protected boolean _bResizable;
protected boolean _bSelected;
protected Rectangle _bounds;
protected Rectangle _savedRect;
protected String _description = null;
+ protected String _savedId;
protected float _angle;
+ protected float _scale;
+ protected float _opacity;
protected float _savedAngle;
+ protected float _savedScale;
+ protected float _savedOpacity;
protected Anchor _anchor;
public GraphicObject(Rectangle aRect)
{
+ _id = "";
_angle = 0;
+ _scale = 100;
+ _opacity = 255;
_bResizable = false;
_bSelected = false;
setRect(aRect);
saveRect();
saveAngle();
+ saveScale();
+ saveOpacity();
+ saveId();
_anchor = Anchor.TOP_LEFT;
_description = super.toString();
@@ -89,6 +101,36 @@ public boolean hasMoved()
{
return ! (_savedRect.equals(_rect));
}
+
+ public void setScale(float scale)
+ {
+ _scale = scale;
+ }
+
+ public float getScale()
+ {
+ return _scale;
+ }
+
+ public void setOpacity(float opacity)
+ {
+ _opacity = opacity;
+ }
+
+ public float getOpacity()
+ {
+ return _opacity;
+ }
+
+ public void setId(String id)
+ {
+ _id = id;
+ }
+
+ public String getId()
+ {
+ return _id;
+ }
public void setAngle(float aAngle)
{
@@ -124,6 +166,18 @@ public void saveAngle()
{
_savedAngle = getAngle();
}
+
+ public void saveScale() {
+ _savedScale = getScale();
+ }
+
+ public void saveOpacity() {
+ _savedOpacity = getOpacity();
+ }
+
+ public void saveId() {
+ _savedId = getId();
+ }
public Rectangle getRect()
{
@@ -140,6 +194,21 @@ public float getSavedAngle()
return _savedAngle;
}
+ public float getSavedScale()
+ {
+ return _savedScale;
+ }
+
+ public float getSavedOpacity()
+ {
+ return _savedOpacity;
+ }
+
+ public String getSavedId()
+ {
+ return _savedId;
+ }
+
public void moveFromSavedPoint(Point aDist)
{
Rectangle r = getRect();
diff --git a/src/dfEditor/GraphicPanel.java b/src/dfEditor/GraphicPanel.java
index af63a8b..8b6ec10 100644
--- a/src/dfEditor/GraphicPanel.java
+++ b/src/dfEditor/GraphicPanel.java
@@ -342,7 +342,7 @@ protected void drawGraphicRotated(GraphicObject graphic, Graphics g, Point aOrig
g2d.setTransform(transform);
- graphic.draw(g2d, aOrigin, aZoom, aAlpha, _bAllowsEditing);
+ graphic.draw(g2d, aOrigin, aZoom * graphic.getScale() * 0.01f, aAlpha * (graphic.getOpacity() / 255.0f), _bAllowsEditing);
g2d.setTransform(oldTransform);
}
diff --git a/src/dfEditor/PixelPacker.java b/src/dfEditor/PixelPacker.java
index 3e34a5c..58735fc 100644
--- a/src/dfEditor/PixelPacker.java
+++ b/src/dfEditor/PixelPacker.java
@@ -32,12 +32,19 @@ public class PixelPacker
private class PixelRectPair
{
public Rectangle rect;
+ public Rectangle padRect;
public int[] pixels;
- public PixelRectPair(final int[] aPixels, final Rectangle aRect)
+ public PixelRectPair(final int[] aPixels, final Rectangle aRect, int padding)
{
rect = aRect;
pixels = aPixels;
+
+ padRect = new Rectangle(rect);
+ padRect.x -= padding;
+ padRect.y -= padding;
+ padRect.width += padding * 2;
+ padRect.height += padding * 2;
}
}
@@ -63,7 +70,7 @@ public boolean packRects(final Rectangle aMasterRect, final Rectangle[] aSubRect
return bSuccess;
}
- public BufferedImage packPixels(final BufferedImage aOrigImage, final Rectangle[] aRects, boolean bPowerOfTwo)
+ public BufferedImage packPixels(final BufferedImage aOrigImage, final Rectangle[] aRects, boolean bPowerOfTwo, int padding)
{
int[] origPixels = new int[aOrigImage.getWidth(null) * aOrigImage.getHeight(null)];
aOrigImage.getRGB( 0,
@@ -92,25 +99,25 @@ public BufferedImage packPixels(final BufferedImage aOrigImage, final Rectangle[
}
}
- pairs[i] = new PixelRectPair(pixels, r);
+ pairs[i] = new PixelRectPair(pixels, r, padding);
}
// TODO: sprites totally enclosed by other sprites should remain enclosed
// TODO: multiple images?
// sort by size
- for (int i=0; i
+
-