patchanim-commit Mailing List for patchanim (Page 5)
Brought to you by:
dbrosius
You can subscribe to this list here.
| 2008 |
Jan
(80) |
Feb
(158) |
Mar
|
Apr
|
May
(3) |
Jun
(7) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(26) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(6) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(9) |
Aug
(1) |
Sep
(2) |
Oct
|
Nov
(2) |
Dec
(3) |
| 2010 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <dbr...@us...> - 2008-02-18 06:48:19
|
Revision: 205
http://patchanim.svn.sourceforge.net/patchanim/?rev=205&view=rev
Author: dbrosius
Date: 2008-02-17 22:48:22 -0800 (Sun, 17 Feb 2008)
Log Message:
-----------
loop unroll the 3 patches when building pixel values
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java 2008-02-18 04:00:10 UTC (rev 204)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java 2008-02-18 06:48:22 UTC (rev 205)
@@ -71,9 +71,9 @@
for (int j = 0; j < order; j++) {
for (int i = 0; i < order; i++) {
double coeff = uCoeffs[i] * vCoeffs[j];
- for (int k = 0; k < 3; k++) {
- value[k] += coords[k].getCoordinate(i, j).getColor() * coeff;
- }
+ value[0] += coords[0].getCoordinate(i, j).getColor() * coeff;
+ value[1] += coords[1].getCoordinate(i, j).getColor() * coeff;
+ value[2] += coords[2].getCoordinate(i, j).getColor() * coeff;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-18 04:00:04
|
Revision: 204
http://patchanim.svn.sourceforge.net/patchanim/?rev=204&view=rev
Author: dbrosius
Date: 2008-02-17 20:00:10 -0800 (Sun, 17 Feb 2008)
Log Message:
-----------
simplify
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java 2008-02-18 03:58:59 UTC (rev 203)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java 2008-02-18 04:00:10 UTC (rev 204)
@@ -84,7 +84,7 @@
}
public NodeList getPatches(@SuppressWarnings("unused") ExpressionContext context) {
- NodeList nl = new NodeList() {
+ return new NodeList() {
public int getLength() {
return paDoc.getPatches().size();
@@ -94,8 +94,6 @@
return d.createTextNode(String.valueOf(index));
}
};
-
- return nl;
}
public String getPatchName(@SuppressWarnings("unused") ExpressionContext context, Node patchIndexNode) {
@@ -104,7 +102,7 @@
}
public NodeList getCoordinates(@SuppressWarnings("unused") ExpressionContext context) {
- NodeList nl = new NodeList() {
+ return new NodeList() {
public int getLength() {
int order = paDoc.getOrder();
@@ -115,8 +113,6 @@
return d.createTextNode(String.valueOf(index));
}
};
-
- return nl;
}
public String getX(@SuppressWarnings("unused") ExpressionContext context, String color, Node patchIndexNode, Node coordIndexNode) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-18 03:58:56
|
Revision: 203
http://patchanim.svn.sourceforge.net/patchanim/?rev=203&view=rev
Author: dbrosius
Date: 2008-02-17 19:58:59 -0800 (Sun, 17 Feb 2008)
Log Message:
-----------
make image transient
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionEvent.java
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionEvent.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionEvent.java 2008-02-18 03:26:07 UTC (rev 202)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionEvent.java 2008-02-18 03:58:59 UTC (rev 203)
@@ -23,8 +23,8 @@
public class PatchCompletionEvent extends EventObject {
- private static final long serialVersionUID = -2446326623721576523L;
- private BufferedImage image;
+ private static final long serialVersionUID = -565663620059754119L;
+ private transient BufferedImage image;
public PatchCompletionEvent(Object src, BufferedImage animatedImage) {
super(src);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-18 03:26:01
|
Revision: 202
http://patchanim.svn.sourceforge.net/patchanim/?rev=202&view=rev
Author: dbrosius
Date: 2008-02-17 19:26:07 -0800 (Sun, 17 Feb 2008)
Log Message:
-----------
add copyrights
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/ExportType.java
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/ExportEvent.java
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/ExportListener.java
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionEvent.java
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionListener.java
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/ExportType.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/ExportType.java 2008-02-18 03:24:01 UTC (rev 201)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/ExportType.java 2008-02-18 03:26:07 UTC (rev 202)
@@ -1,3 +1,21 @@
+/*
+ * patchanim - A bezier surface patch color blend gif builder
+ * Copyright (C) 2008 Dave Brosius
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
package com.mebigfatguy.patchanim;
import com.mebigfatguy.patchanim.main.PatchAnimBundle;
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/ExportEvent.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/ExportEvent.java 2008-02-18 03:24:01 UTC (rev 201)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/ExportEvent.java 2008-02-18 03:26:07 UTC (rev 202)
@@ -1,3 +1,21 @@
+/*
+ * patchanim - A bezier surface patch color blend gif builder
+ * Copyright (C) 2008 Dave Brosius
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
package com.mebigfatguy.patchanim.gui.events;
import java.util.EventObject;
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/ExportListener.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/ExportListener.java 2008-02-18 03:24:01 UTC (rev 201)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/ExportListener.java 2008-02-18 03:26:07 UTC (rev 202)
@@ -1,3 +1,21 @@
+/*
+ * patchanim - A bezier surface patch color blend gif builder
+ * Copyright (C) 2008 Dave Brosius
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
package com.mebigfatguy.patchanim.gui.events;
public interface ExportListener {
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionEvent.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionEvent.java 2008-02-18 03:24:01 UTC (rev 201)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionEvent.java 2008-02-18 03:26:07 UTC (rev 202)
@@ -1,3 +1,21 @@
+/*
+ * patchanim - A bezier surface patch color blend gif builder
+ * Copyright (C) 2008 Dave Brosius
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
package com.mebigfatguy.patchanim.gui.events;
import java.awt.image.BufferedImage;
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionListener.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionListener.java 2008-02-18 03:24:01 UTC (rev 201)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionListener.java 2008-02-18 03:26:07 UTC (rev 202)
@@ -1,3 +1,21 @@
+/*
+ * patchanim - A bezier surface patch color blend gif builder
+ * Copyright (C) 2008 Dave Brosius
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
package com.mebigfatguy.patchanim.gui.events;
public interface PatchCompletionListener {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-18 03:23:57
|
Revision: 201
http://patchanim.svn.sourceforge.net/patchanim/?rev=201&view=rev
Author: dbrosius
Date: 2008-02-17 19:24:01 -0800 (Sun, 17 Feb 2008)
Log Message:
-----------
oi
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimPanel.java
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimPanel.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimPanel.java 2008-02-18 03:23:26 UTC (rev 200)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimPanel.java 2008-02-18 03:24:01 UTC (rev 201)
@@ -23,7 +23,6 @@
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
-import javax.swing.JComponent;
import javax.swing.JPanel;
import com.mebigfatguy.patchanim.PatchColor;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-18 03:23:23
|
Revision: 200
http://patchanim.svn.sourceforge.net/patchanim/?rev=200&view=rev
Author: dbrosius
Date: 2008-02-17 19:23:26 -0800 (Sun, 17 Feb 2008)
Log Message:
-----------
add copyright
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchAnimator.java
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchAnimator.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchAnimator.java 2008-02-18 03:22:40 UTC (rev 199)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchAnimator.java 2008-02-18 03:23:26 UTC (rev 200)
@@ -1,3 +1,21 @@
+/*
+ * patchanim - A bezier surface patch color blend gif builder
+ * Copyright (C) 2008 Dave Brosius
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
package com.mebigfatguy.patchanim.surface;
import java.awt.image.BufferedImage;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-18 03:22:35
|
Revision: 199
http://patchanim.svn.sourceforge.net/patchanim/?rev=199&view=rev
Author: dbrosius
Date: 2008-02-17 19:22:40 -0800 (Sun, 17 Feb 2008)
Log Message:
-----------
add document name in title bar
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java
trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java
trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-02-18 03:16:18 UTC (rev 198)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-02-18 03:22:40 UTC (rev 199)
@@ -27,6 +27,7 @@
import java.awt.event.WindowFocusListener;
import java.io.File;
import java.io.IOException;
+import java.text.MessageFormat;
import java.util.ResourceBundle;
import javax.swing.ImageIcon;
@@ -88,8 +89,10 @@
mediator.setDocument(document);
cp.add(patchPanel, BorderLayout.CENTER);
- setTitle(rb.getString(PatchAnimBundle.TITLE));
+ String title = MessageFormat.format(rb.getString(PatchAnimBundle.NAMEDTITLE), rb.getString(PatchAnimBundle.UNTITLED));
+ setTitle(title);
+
setIconImage(new ImageIcon(JPatchAnimFrame.class.getResource(ICON_URL)).getImage());
pack();
}
@@ -204,6 +207,8 @@
saveItem.setEnabled(false);
PatchPanelMediator mediator = PatchPanelMediator.getMediator();
mediator.setDocument(document);
+ String title = MessageFormat.format(rb.getString(PatchAnimBundle.NAMEDTITLE), rb.getString(PatchAnimBundle.UNTITLED));
+ setTitle(title);
} catch (IOException ioe) {
JOptionPane.showMessageDialog(JPatchAnimFrame.this, rb.getString(PatchAnimBundle.SAVEFAILED));
}
@@ -222,6 +227,11 @@
}
}
load();
+
+ ResourceBundle rb = PatchAnimBundle.getBundle();
+ String title = MessageFormat.format(rb.getString(PatchAnimBundle.NAMEDTITLE), documentLocation.getName());
+ setTitle(title);
+
} catch (IOException ioe) {
ResourceBundle rb = PatchAnimBundle.getBundle();
JOptionPane.showMessageDialog(JPatchAnimFrame.this, rb.getString(PatchAnimBundle.LOADFAILED));
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-02-18 03:16:18 UTC (rev 198)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-02-18 03:22:40 UTC (rev 199)
@@ -24,6 +24,8 @@
public static final String ROOT = "patchanim.";
public static final String TITLE = "patchanim.title";
+ public static final String NAMEDTITLE = "patchanim.namedtitle";
+ public static final String UNTITLED = "patchanim.untitled";
public static final String FILE = "patchanim.file";
public static final String NEW = "patchanim.new";
public static final String OPEN = "patchanim.open";
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-02-18 03:16:18 UTC (rev 198)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-02-18 03:22:40 UTC (rev 199)
@@ -17,6 +17,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
patchanim.title = PatchAnim
+patchanim.namedtitle = PatchAnim - {0}
+patchanim.untitled = Untitled
patchanim.file = File
patchanim.new = New
patchanim.open = Open...
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-18 03:16:14
|
Revision: 198
http://patchanim.svn.sourceforge.net/patchanim/?rev=198&view=rev
Author: dbrosius
Date: 2008-02-17 19:16:18 -0800 (Sun, 17 Feb 2008)
Log Message:
-----------
rework exported to use the new PatchAnimator as well.
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchExporter.java
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchExporter.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchExporter.java 2008-02-18 03:04:31 UTC (rev 197)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchExporter.java 2008-02-18 03:16:18 UTC (rev 198)
@@ -23,30 +23,34 @@
import java.io.IOException;
import java.text.NumberFormat;
import java.util.HashSet;
-import java.util.List;
+import java.util.ResourceBundle;
import java.util.Set;
import javax.imageio.ImageIO;
+import javax.swing.JOptionPane;
import com.fmsware.gif.AnimatedGifEncoder;
-import com.mebigfatguy.patchanim.encoders.APngEncoder;
-import com.mebigfatguy.patchanim.encoders.MngEncoder;
import com.mebigfatguy.patchanim.AnimationType;
import com.mebigfatguy.patchanim.ExportType;
-import com.mebigfatguy.patchanim.OutOfBoundsColor;
import com.mebigfatguy.patchanim.PatchAnimDocument;
+import com.mebigfatguy.patchanim.encoders.APngEncoder;
+import com.mebigfatguy.patchanim.encoders.MngEncoder;
import com.mebigfatguy.patchanim.gui.events.ExportEvent;
import com.mebigfatguy.patchanim.gui.events.ExportListener;
-import com.mebigfatguy.patchanim.surface.CombinedPatch;
-import com.mebigfatguy.patchanim.surface.PatchGenerator;
+import com.mebigfatguy.patchanim.gui.events.PatchCompletionEvent;
+import com.mebigfatguy.patchanim.gui.events.PatchCompletionListener;
+import com.mebigfatguy.patchanim.main.PatchAnimBundle;
+import com.mebigfatguy.patchanim.surface.PatchAnimator;
-public class PatchExporter {
+public class PatchExporter implements PatchCompletionListener {
private ExportType type;
private File loc;
private AnimatedGifEncoder agEncoder;
private APngEncoder apngEncoder;
private MngEncoder mngEncoder;
private int totalImages;
+ private int imageIndex;
+ private String baseName;
private Set<ExportListener> elisteners = new HashSet<ExportListener>();
public PatchExporter(ExportType exportType, File location) {
@@ -66,7 +70,7 @@
public void export(PatchAnimDocument document) throws IOException {
try {
- String baseName = loc.getName();
+ baseName = loc.getName();
if (type.isMultipleFiles()) {
loc.mkdir();
} else {
@@ -83,74 +87,33 @@
}
totalImages = calcImageCount(document);
+ imageIndex = 1;
- BufferedImage image = PatchGenerator.buildImage(null, document.getWidth(), document.getHeight());
- List<CombinedPatch> patches = document.getPatches();
- int lastPatch = patches.size() - 1;
- int tweenCount = document.getTweenCount();
- OutOfBoundsColor oob = document.getOutOfBoundsColor();
- int imageIndex = 1;
AnimationType atype = document.getAnimationType();
-
- if (type == ExportType.AnimatedGif) {
- agEncoder.setRepeat((atype != AnimationType.None) ? 0 : -1);
- } else if (type == ExportType.AnimatedPng) {
- apngEncoder.setRepeat(atype != AnimationType.None);
- apngEncoder.setNumFrames(totalImages);
- } else if (type == ExportType.AnimatedMng) {
- mngEncoder.setRepeat(atype != AnimationType.None);
- mngEncoder.setNumFrames(totalImages);
- mngEncoder.setDelay(100);
+ switch (type) {
+ case AnimatedGif:
+ agEncoder.setRepeat((atype != AnimationType.None) ? 0 : -1);
+ break;
+
+ case AnimatedPng:
+ apngEncoder.setRepeat(atype != AnimationType.None);
+ apngEncoder.setNumFrames(totalImages);
+ break;
+
+ case AnimatedMng:
+ mngEncoder.setRepeat(atype != AnimationType.None);
+ mngEncoder.setNumFrames(totalImages);
+ mngEncoder.setDelay(100);
}
+
- if (lastPatch == 0) {
- PatchGenerator.recalcCombinedImage(patches.get(0), image, oob);
- writeSingleFile(image, imageIndex++, loc, baseName, type);
- } else {
- for(int p = 0; p < lastPatch; p++) {
- CombinedPatch startPatch = patches.get(p);
- CombinedPatch endPatch = patches.get(p+1);
- for (int t = 0; t < tweenCount + 1; t++) {
- CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)(tweenCount + 1));
- PatchGenerator.recalcCombinedImage(tweenPatch, image, oob);
- writeSingleFile(image, imageIndex++, loc, baseName, type);
- }
- }
-
- switch (atype) {
- case None: {
- CombinedPatch patch = patches.get(lastPatch);
- PatchGenerator.recalcCombinedImage(patch, image, oob);
- writeSingleFile(image, imageIndex++, loc, baseName, type);
- if (atype == AnimationType.None)
- return;
- }
- break;
-
- case Cycle: {
- CombinedPatch startPatch = patches.get(lastPatch);
- CombinedPatch endPatch = patches.get(0);
- for (int t = 0; t < tweenCount + 1; t++) {
- CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)(tweenCount + 1));
- PatchGenerator.recalcCombinedImage(tweenPatch, image, oob);
- writeSingleFile(image, imageIndex++, loc, baseName, type);
- }
- }
- break;
-
- case Wave: {
- for (int p = lastPatch; p > 0; p--) {
- CombinedPatch startPatch = patches.get(p-1);
- CombinedPatch endPatch = patches.get(p);
- for (int t = tweenCount + 1; t > 0; t--) {
- CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)(tweenCount + 1));
- PatchGenerator.recalcCombinedImage(tweenPatch, image, oob);
- writeSingleFile(image, imageIndex++, loc, baseName, type);
- }
- }
- }
- break;
- }
+ PatchAnimator animator = new PatchAnimator(document);
+ animator.addPatchCompletionListener(this);
+ try {
+ animator.animatePatches();
+ } catch (InterruptedException ie) {
+ ResourceBundle rb = PatchAnimBundle.getBundle();
+ JOptionPane.showMessageDialog(null, rb.getString(PatchAnimBundle.EXPORTFAILED));
}
} finally {
if (type == ExportType.AnimatedGif) {
@@ -163,6 +126,16 @@
}
}
+ public void patchCompleted(PatchCompletionEvent pce) throws InterruptedException {
+ try {
+ writeSingleFile(pce.getImage(), imageIndex++, loc, baseName, type);
+ } catch (IOException ioe) {
+ InterruptedException ie = new InterruptedException("Failed saving animation");
+ ie.initCause(ioe);
+ throw ie;
+ }
+ }
+
private void writeSingleFile(BufferedImage image, int index, File dir, String baseName, ExportType type) throws IOException {
NumberFormat nf = NumberFormat.getIntegerInstance();
nf.setMinimumIntegerDigits(5);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-18 03:04:25
|
Revision: 197
http://patchanim.svn.sourceforge.net/patchanim/?rev=197&view=rev
Author: dbrosius
Date: 2008-02-17 19:04:31 -0800 (Sun, 17 Feb 2008)
Log Message:
-----------
pull out the patch animation into a separate class and hook in the test pane thru listeners, so that the code can be shared with export.
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java
Added Paths:
-----------
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionEvent.java
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionListener.java
trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchAnimator.java
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java 2008-02-18 02:31:45 UTC (rev 196)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java 2008-02-18 03:04:31 UTC (rev 197)
@@ -25,7 +25,6 @@
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.lang.reflect.InvocationTargetException;
-import java.util.List;
import java.util.ResourceBundle;
import javax.swing.JFrame;
@@ -33,42 +32,24 @@
import javax.swing.SwingUtilities;
import com.mebigfatguy.patchanim.AnimationType;
-import com.mebigfatguy.patchanim.OutOfBoundsColor;
import com.mebigfatguy.patchanim.PatchAnimDocument;
+import com.mebigfatguy.patchanim.gui.events.PatchCompletionEvent;
+import com.mebigfatguy.patchanim.gui.events.PatchCompletionListener;
import com.mebigfatguy.patchanim.main.PatchAnimBundle;
-import com.mebigfatguy.patchanim.surface.CombinedPatch;
-import com.mebigfatguy.patchanim.surface.PatchGenerator;
+import com.mebigfatguy.patchanim.surface.PatchAnimator;
-public class JTestFrame extends JFrame {
+public class JTestFrame extends JFrame implements PatchCompletionListener {
private static final long serialVersionUID = -7975149184522257748L;
private Thread animThread = null;
private TestPanel testPanel = null;
- private int tweenCount;
- private int width;
- private int height;
- private AnimationType type;
- private OutOfBoundsColor oob;
- private List<CombinedPatch> patches;
- private BufferedImage image;
+ private PatchAnimDocument document;
+ private long lastRedraw;
public JTestFrame() {
PatchPanelMediator mediator = PatchPanelMediator.getMediator();
- PatchAnimDocument document = mediator.getDocument();
- tweenCount = document.getTweenCount();
- width = document.getWidth();
- height = document.getHeight();
- type = document.getAnimationType();
- oob = document.getOutOfBoundsColor();
- patches = document.getPatches();
-
- if (width == 0)
- width = 100;
- if (height == 0)
- height = 100;
- if (tweenCount == 0)
- tweenCount = 1;
+ document = mediator.getDocument();
initComponents();
initListeners();
@@ -77,73 +58,16 @@
public synchronized void beginAnimation() {
if (animThread != null)
return;
- image = PatchGenerator.buildImage(null, width, height);
animThread = new Thread(new Runnable() {
public void run() {
try {
- PatchGenerator.recalcCombinedImage(patches.get(0), image, oob);
- while (!Thread.interrupted()) {
- testPanel.redraw();
- int lastPatch = patches.size() - 1;
- long lastRedraw = System.currentTimeMillis();
- for (int p = 0; p < lastPatch; p++) {
- CombinedPatch startPatch = patches.get(p);
- CombinedPatch endPatch = patches.get(p+1);
- for (int t = 0; t < tweenCount + 1; t++) {
- CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)(tweenCount + 1));
- PatchGenerator.recalcCombinedImage(tweenPatch, image, oob);
- long now = System.currentTimeMillis();
- long sleepTime = 100 - (now - lastRedraw);
- if (sleepTime > 0)
- Thread.sleep(sleepTime);
- testPanel.redraw();
- lastRedraw = now;
- }
- }
-
- switch (type) {
- case None: {
- return;
- }
-
- case Cycle: {
- CombinedPatch startPatch = patches.get(lastPatch);
- CombinedPatch endPatch = patches.get(0);
- for (int t = 0; t <= tweenCount + 1; t++) {
- CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)(tweenCount + 1));
- PatchGenerator.recalcCombinedImage(tweenPatch, image, oob);
- long now = System.currentTimeMillis();
- long sleepTime = 100 - (now - lastRedraw);
- if (sleepTime > 0)
- Thread.sleep(sleepTime);
- testPanel.redraw();
- lastRedraw = now;
- }
- }
- break;
-
- case Wave: {
- for (int p = lastPatch; p > 0; p--) {
- CombinedPatch startPatch = patches.get(p-1);
- CombinedPatch endPatch = patches.get(p);
- for (int t = tweenCount + 1; t > 0; t--) {
- CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)(tweenCount + 1));
- PatchGenerator.recalcCombinedImage(tweenPatch, image, oob);
- long now = System.currentTimeMillis();
- long sleepTime = 100 - (now - lastRedraw);
- if (sleepTime > 0)
- Thread.sleep(sleepTime);
- testPanel.redraw();
- lastRedraw = now;
- }
- }
- }
- break;
- }
- }
+ PatchAnimator animator = new PatchAnimator(document);
+ animator.addPatchCompletionListener(JTestFrame.this);
+ AnimationType type = document.getAnimationType();
+ while (type != AnimationType.None)
+ animator.animatePatches();
} catch (InterruptedException ie) {
- //OK
}
}
});
@@ -165,6 +89,15 @@
}
}
+ public void patchCompleted(PatchCompletionEvent pce) throws InterruptedException {
+ long now = System.currentTimeMillis();
+ long sleepTime = 100 - (now - lastRedraw);
+ if (sleepTime > 0)
+ Thread.sleep(sleepTime);
+ testPanel.redraw(pce.getImage());
+ lastRedraw = now;
+ }
+
private void initComponents() {
ResourceBundle rb = PatchAnimBundle.getBundle();
testPanel = new TestPanel();
@@ -185,9 +118,20 @@
}
class TestPanel extends JPanel {
- private static final long serialVersionUID = 6268304008663415749L;
+ private static final long serialVersionUID = -6464417075282170562L;
+ private BufferedImage image = null;
+ private int width;
+ private int height;
public TestPanel() {
+ width = document.getWidth();
+ height = document.getHeight();
+
+ if (width == 0)
+ width = 100;
+ if (height == 0)
+ height = 100;
+
Dimension d = new Dimension(width, height);
setMinimumSize(d);
setMaximumSize(d);
@@ -195,8 +139,9 @@
setSize(width, height);
}
- public void redraw() throws InterruptedException {
+ public void redraw(BufferedImage redrawImage) throws InterruptedException {
try {
+ image = redrawImage;
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
invalidate();
@@ -213,7 +158,8 @@
@Override
public void paintComponent(Graphics g) {
- g.drawImage(image, 0, 0, width, height, 0, 0, width, height, null);
+ if (image != null)
+ g.drawImage(image, 0, 0, width, height, 0, 0, width, height, null);
}
}
}
Added: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionEvent.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionEvent.java (rev 0)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionEvent.java 2008-02-18 03:04:31 UTC (rev 197)
@@ -0,0 +1,19 @@
+package com.mebigfatguy.patchanim.gui.events;
+
+import java.awt.image.BufferedImage;
+import java.util.EventObject;
+
+public class PatchCompletionEvent extends EventObject {
+
+ private static final long serialVersionUID = -2446326623721576523L;
+ private BufferedImage image;
+
+ public PatchCompletionEvent(Object src, BufferedImage animatedImage) {
+ super(src);
+ image = animatedImage;
+ }
+
+ public BufferedImage getImage() {
+ return image;
+ }
+}
Property changes on: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionEvent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionListener.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionListener.java (rev 0)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionListener.java 2008-02-18 03:04:31 UTC (rev 197)
@@ -0,0 +1,5 @@
+package com.mebigfatguy.patchanim.gui.events;
+
+public interface PatchCompletionListener {
+ void patchCompleted(PatchCompletionEvent pce) throws InterruptedException;
+}
Property changes on: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/events/PatchCompletionListener.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchAnimator.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchAnimator.java (rev 0)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchAnimator.java 2008-02-18 03:04:31 UTC (rev 197)
@@ -0,0 +1,92 @@
+package com.mebigfatguy.patchanim.surface;
+
+import java.awt.image.BufferedImage;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import com.mebigfatguy.patchanim.AnimationType;
+import com.mebigfatguy.patchanim.OutOfBoundsColor;
+import com.mebigfatguy.patchanim.PatchAnimDocument;
+import com.mebigfatguy.patchanim.gui.events.PatchCompletionEvent;
+import com.mebigfatguy.patchanim.gui.events.PatchCompletionListener;
+
+public class PatchAnimator {
+
+ private Set<PatchCompletionListener> pcListeners = new HashSet<PatchCompletionListener>();
+ private PatchAnimDocument document;
+
+ public PatchAnimator(PatchAnimDocument paDocument) {
+ document = paDocument;
+ }
+
+ public void addPatchCompletionListener(PatchCompletionListener listener) {
+ pcListeners.add(listener);
+ }
+
+ public void animatePatches() throws InterruptedException {
+ BufferedImage image = PatchGenerator.buildImage(null, document.getWidth(), document.getHeight());
+ List<CombinedPatch> patches = document.getPatches();
+ int lastPatch = patches.size() - 1;
+ int tweenCount = document.getTweenCount();
+ OutOfBoundsColor oob = document.getOutOfBoundsColor();
+ AnimationType atype = document.getAnimationType();
+
+ if (lastPatch == 0) {
+ PatchGenerator.recalcCombinedImage(patches.get(0), image, oob);
+ firePatchCompleted(image);
+ } else {
+ for(int p = 0; p < lastPatch; p++) {
+ CombinedPatch startPatch = patches.get(p);
+ CombinedPatch endPatch = patches.get(p+1);
+ for (int t = 0; t < tweenCount + 1; t++) {
+ CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)(tweenCount + 1));
+ PatchGenerator.recalcCombinedImage(tweenPatch, image, oob);
+ firePatchCompleted(image);
+ }
+ }
+
+ switch (atype) {
+ case None: {
+ CombinedPatch patch = patches.get(lastPatch);
+ PatchGenerator.recalcCombinedImage(patch, image, oob);
+ firePatchCompleted(image);
+ if (atype == AnimationType.None)
+ return;
+ }
+ break;
+
+ case Cycle: {
+ CombinedPatch startPatch = patches.get(lastPatch);
+ CombinedPatch endPatch = patches.get(0);
+ for (int t = 0; t < tweenCount + 1; t++) {
+ CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)(tweenCount + 1));
+ PatchGenerator.recalcCombinedImage(tweenPatch, image, oob);
+ firePatchCompleted(image);
+ }
+ }
+ break;
+
+ case Wave: {
+ for (int p = lastPatch; p > 0; p--) {
+ CombinedPatch startPatch = patches.get(p-1);
+ CombinedPatch endPatch = patches.get(p);
+ for (int t = tweenCount + 1; t > 0; t--) {
+ CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)(tweenCount + 1));
+ PatchGenerator.recalcCombinedImage(tweenPatch, image, oob);
+ firePatchCompleted(image);
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ private void firePatchCompleted(BufferedImage image) throws InterruptedException {
+ PatchCompletionEvent pce = new PatchCompletionEvent(this, image);
+ for (PatchCompletionListener listener : pcListeners) {
+ listener.patchCompleted(pce);
+ }
+ }
+}
Property changes on: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchAnimator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-18 02:31:39
|
Revision: 196
http://patchanim.svn.sourceforge.net/patchanim/?rev=196&view=rev
Author: dbrosius
Date: 2008-02-17 18:31:45 -0800 (Sun, 17 Feb 2008)
Log Message:
-----------
fix cycle so that the last frame blends into the first
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java
trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchExporter.java
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java 2008-02-16 04:35:19 UTC (rev 195)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java 2008-02-18 02:31:45 UTC (rev 196)
@@ -90,8 +90,8 @@
for (int p = 0; p < lastPatch; p++) {
CombinedPatch startPatch = patches.get(p);
CombinedPatch endPatch = patches.get(p+1);
- for (int t = 0; t < tweenCount; t++) {
- CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)tweenCount);
+ for (int t = 0; t < tweenCount + 1; t++) {
+ CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)(tweenCount + 1));
PatchGenerator.recalcCombinedImage(tweenPatch, image, oob);
long now = System.currentTimeMillis();
long sleepTime = 100 - (now - lastRedraw);
@@ -102,15 +102,16 @@
}
}
- if (type == AnimationType.None)
- return;
-
- if (type == AnimationType.Wave) {
- for (int p = lastPatch; p > 0; p--) {
- CombinedPatch startPatch = patches.get(p-1);
- CombinedPatch endPatch = patches.get(p);
- for (int t = tweenCount - 1; t >= 0; t--) {
- CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)tweenCount);
+ switch (type) {
+ case None: {
+ return;
+ }
+
+ case Cycle: {
+ CombinedPatch startPatch = patches.get(lastPatch);
+ CombinedPatch endPatch = patches.get(0);
+ for (int t = 0; t <= tweenCount + 1; t++) {
+ CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)(tweenCount + 1));
PatchGenerator.recalcCombinedImage(tweenPatch, image, oob);
long now = System.currentTimeMillis();
long sleepTime = 100 - (now - lastRedraw);
@@ -120,6 +121,25 @@
lastRedraw = now;
}
}
+ break;
+
+ case Wave: {
+ for (int p = lastPatch; p > 0; p--) {
+ CombinedPatch startPatch = patches.get(p-1);
+ CombinedPatch endPatch = patches.get(p);
+ for (int t = tweenCount + 1; t > 0; t--) {
+ CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)(tweenCount + 1));
+ PatchGenerator.recalcCombinedImage(tweenPatch, image, oob);
+ long now = System.currentTimeMillis();
+ long sleepTime = 100 - (now - lastRedraw);
+ if (sleepTime > 0)
+ Thread.sleep(sleepTime);
+ testPanel.redraw();
+ lastRedraw = now;
+ }
+ }
+ }
+ break;
}
}
} catch (InterruptedException ie) {
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchExporter.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchExporter.java 2008-02-16 04:35:19 UTC (rev 195)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchExporter.java 2008-02-18 02:31:45 UTC (rev 196)
@@ -116,25 +116,40 @@
writeSingleFile(image, imageIndex++, loc, baseName, type);
}
}
+
+ switch (atype) {
+ case None: {
+ CombinedPatch patch = patches.get(lastPatch);
+ PatchGenerator.recalcCombinedImage(patch, image, oob);
+ writeSingleFile(image, imageIndex++, loc, baseName, type);
+ if (atype == AnimationType.None)
+ return;
+ }
+ break;
- if ((atype == AnimationType.None) || (atype == AnimationType.Cycle)) {
- CombinedPatch patch = patches.get(lastPatch);
- PatchGenerator.recalcCombinedImage(patch, image, oob);
- writeSingleFile(image, imageIndex++, loc, baseName, type);
- if (atype == AnimationType.None)
- return;
- }
-
- if (atype == AnimationType.Wave) {
- for (int p = lastPatch; p > 0; p--) {
- CombinedPatch startPatch = patches.get(p-1);
- CombinedPatch endPatch = patches.get(p);
- for (int t = tweenCount + 1; t > 0; t--) {
+ case Cycle: {
+ CombinedPatch startPatch = patches.get(lastPatch);
+ CombinedPatch endPatch = patches.get(0);
+ for (int t = 0; t < tweenCount + 1; t++) {
CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)(tweenCount + 1));
PatchGenerator.recalcCombinedImage(tweenPatch, image, oob);
writeSingleFile(image, imageIndex++, loc, baseName, type);
}
}
+ break;
+
+ case Wave: {
+ for (int p = lastPatch; p > 0; p--) {
+ CombinedPatch startPatch = patches.get(p-1);
+ CombinedPatch endPatch = patches.get(p);
+ for (int t = tweenCount + 1; t > 0; t--) {
+ CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)(tweenCount + 1));
+ PatchGenerator.recalcCombinedImage(tweenPatch, image, oob);
+ writeSingleFile(image, imageIndex++, loc, baseName, type);
+ }
+ }
+ }
+ break;
}
}
} finally {
@@ -188,10 +203,19 @@
int numPatches = document.getPatches().size();
int total = (numPatches - 1) * document.getTweenCount() + (numPatches - 1);
- if (document.getAnimationType() == AnimationType.Wave)
- total = total * 2;
- else
- total++;
+ switch (document.getAnimationType()) {
+ case None:
+ total++;
+ break;
+
+ case Cycle:
+ total += document.getTweenCount() + 1;
+ break;
+
+ case Wave:
+ total = total * 2;
+ break;
+ }
return total;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-16 04:35:14
|
Revision: 195
http://patchanim.svn.sourceforge.net/patchanim/?rev=195&view=rev
Author: dbrosius
Date: 2008-02-15 20:35:19 -0800 (Fri, 15 Feb 2008)
Log Message:
-----------
add doc
Modified Paths:
--------------
trunk/patchanim/htdocs/index.html
Modified: trunk/patchanim/htdocs/index.html
===================================================================
--- trunk/patchanim/htdocs/index.html 2008-02-16 04:25:53 UTC (rev 194)
+++ trunk/patchanim/htdocs/index.html 2008-02-16 04:35:19 UTC (rev 195)
@@ -50,10 +50,11 @@
to generate one full color blend. Since the description of the blend is very succinct (just 3 * 16 points), It is
very easy to generate in-between images from two separate blend descriptions.</p>
- <p>February 15, 2008 - added lately</p>
+ <p>February 16, 2008 - added lately</p>
<ul>
- <li>Context Patch menu option to generate linear blends for patch values</li>
+ <li>Context Patch menu option to generate linear gradients for patch values</li>
<li>Patches can now be any order from 2 - 9, specified on the new dialog</li>
+ <li>Context Patch menu option to invert the patch</li>
</ul>
<p>If you would like to see the tool as it progresses, you can run the webstart version
<a href="http://patchanim.sourceforge.net/jnlp/patchanim.jnlp">here.</a></p>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-16 04:25:47
|
Revision: 194
http://patchanim.svn.sourceforge.net/patchanim/?rev=194&view=rev
Author: dbrosius
Date: 2008-02-15 20:25:53 -0800 (Fri, 15 Feb 2008)
Log Message:
-----------
add invert to patch context menu
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java
trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java
trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java 2008-02-15 06:59:38 UTC (rev 193)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java 2008-02-16 04:25:53 UTC (rev 194)
@@ -249,7 +249,7 @@
});
menu.add(darkenPatch);
- JMenu linearBlend = new JMenu(rb.getString(PatchAnimBundle.LINEARBLEND));
+ JMenu linearBlend = new JMenu(rb.getString(PatchAnimBundle.LINEARGRADIENT));
JMenuItem leftToRight = new JMenuItem(rb.getString(PatchAnimBundle.LEFTTORIGHT));
leftToRight.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
@@ -284,6 +284,14 @@
linearBlend.add(bottomToTop);
menu.add(linearBlend);
+ JMenuItem invert = new JMenuItem(rb.getString(PatchAnimBundle.INVERT));
+ invert.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ invertPatch();
+ }
+ });
+ menu.add(invert);
+
JMenu copy = new JMenu(rb.getString(PatchAnimBundle.COPYPATCHFROM));
if (color != PatchColor.Red) {
JMenuItem copyRed = new JMenuItem(rb.getString(PatchAnimBundle.REDPATCH));
@@ -317,6 +325,21 @@
menu.show(JPatchSamplePanel.this, me.getX(), me.getY());
}
+ private void invertPatch() {
+ PatchPanelMediator mediator = PatchPanelMediator.getMediator();
+ CombinedPatch patch = mediator.getActivePatch();
+ PatchCoords coords = patch.getPatch(color);
+ int order = coords.getOrder();
+ for (int i = 0; i < order; i++) {
+ for (int j = 0; j < order; j++) {
+ Coordinate c = coords.getCoordinate(i, j);
+ c.setColor(255 - c.getColor());
+ coords.setCoordinate(i, j, c);
+ }
+ }
+ mediator.setNewActivePatch(patch);
+ }
+
private void copyPatch(PatchColor copyColor) {
PatchPanelMediator mediator = PatchPanelMediator.getMediator();
CombinedPatch patch = mediator.getActivePatch();
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-02-15 06:59:38 UTC (rev 193)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-02-16 04:25:53 UTC (rev 194)
@@ -78,11 +78,12 @@
public static final String VALUE="patchanim.value";
public static final String LIGHTENPATCH = "patchanim.lightenpatch";
public static final String DARKENPATCH = "patchanim.darkenpatch";
- public static final String LINEARBLEND = "patchanim.linearblend";
+ public static final String LINEARGRADIENT = "patchanim.lineargradient";
public static final String LEFTTORIGHT = "patchanim.lefttoright";
public static final String TOPTOBOTTOM = "patchanim.toptobottom";
public static final String RIGHTTOLEFT = "patchanim.righttoleft";
public static final String BOTTOMTOTOP = "patchanim.bottomtotop";
+ public static final String INVERT = "patchanim.invert";
public static final String COPYPATCHFROM = "patchanim.copypatchfrom";
public static final String REDPATCH = "patchanim.redpatch";
public static final String GREENPATCH = "patchanim.greenpatch";
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-02-15 06:59:38 UTC (rev 193)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-02-16 04:25:53 UTC (rev 194)
@@ -71,11 +71,12 @@
patchanim.value = Value...
patchanim.lightenpatch = Lighten Patch
patchanim.darkenpatch = Darken Patch
-patchanim.linearblend = Linear Blend...
+patchanim.lineargradient = Linear Gradient...
patchanim.lefttoright = Left to Right
patchanim.toptobottom = Top to Bottom
patchanim.righttoleft = Right to Left
patchanim.bottomtotop = Bottom to Top
+patchanim.invert = Invert
patchanim.copypatchfrom = Copy patch from...
patchanim.redpatch = Red Patch
patchanim.greenpatch = Green Patch
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-15 07:01:53
|
Revision: 193
http://patchanim.svn.sourceforge.net/patchanim/?rev=193&view=rev
Author: dbrosius
Date: 2008-02-14 22:59:38 -0800 (Thu, 14 Feb 2008)
Log Message:
-----------
document linear blends
Modified Paths:
--------------
trunk/patchanim/htdocs/index.html
Modified: trunk/patchanim/htdocs/index.html
===================================================================
--- trunk/patchanim/htdocs/index.html 2008-02-15 06:56:14 UTC (rev 192)
+++ trunk/patchanim/htdocs/index.html 2008-02-15 06:59:38 UTC (rev 193)
@@ -50,8 +50,9 @@
to generate one full color blend. Since the description of the blend is very succinct (just 3 * 16 points), It is
very easy to generate in-between images from two separate blend descriptions.</p>
- <p>February 14, 2008 - added lately</p>
+ <p>February 15, 2008 - added lately</p>
<ul>
+ <li>Context Patch menu option to generate linear blends for patch values</li>
<li>Patches can now be any order from 2 - 9, specified on the new dialog</li>
</ul>
<p>If you would like to see the tool as it progresses, you can run the webstart version
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-15 07:01:51
|
Revision: 192
http://patchanim.svn.sourceforge.net/patchanim/?rev=192&view=rev
Author: dbrosius
Date: 2008-02-14 22:56:14 -0800 (Thu, 14 Feb 2008)
Log Message:
-----------
add linear blend menu item
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java
trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java
trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties
Added Paths:
-----------
trunk/patchanim/src/com/mebigfatguy/patchanim/BlendDirection.java
Added: trunk/patchanim/src/com/mebigfatguy/patchanim/BlendDirection.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/BlendDirection.java (rev 0)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/BlendDirection.java 2008-02-15 06:56:14 UTC (rev 192)
@@ -0,0 +1,39 @@
+/*
+ * patchanim - A bezier surface patch color blend gif builder
+ * Copyright (C) 2008 Dave Brosius
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package com.mebigfatguy.patchanim;
+
+import java.util.ResourceBundle;
+
+import com.mebigfatguy.patchanim.main.PatchAnimBundle;
+
+public enum BlendDirection {
+ LeftToRight,
+ TopToBottom,
+ RightToLeft,
+ BottomToTop;
+
+ /**
+ * returns the localized value of the type
+ */
+ @Override
+ public String toString() {
+ ResourceBundle rb = PatchAnimBundle.getBundle();
+ return rb.getString(PatchAnimBundle.ROOT + name().toLowerCase());
+ }
+}
Property changes on: trunk/patchanim/src/com/mebigfatguy/patchanim/BlendDirection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java 2008-02-15 06:30:52 UTC (rev 191)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java 2008-02-15 06:56:14 UTC (rev 192)
@@ -40,6 +40,7 @@
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
+import com.mebigfatguy.patchanim.BlendDirection;
import com.mebigfatguy.patchanim.OutOfBoundsColor;
import com.mebigfatguy.patchanim.PatchAnimDocument;
import com.mebigfatguy.patchanim.PatchColor;
@@ -247,7 +248,42 @@
}
});
menu.add(darkenPatch);
+
+ JMenu linearBlend = new JMenu(rb.getString(PatchAnimBundle.LINEARBLEND));
+ JMenuItem leftToRight = new JMenuItem(rb.getString(PatchAnimBundle.LEFTTORIGHT));
+ leftToRight.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ linearBlend(BlendDirection.LeftToRight);
+ }
+ });
+
+ JMenuItem topToBottom = new JMenuItem(rb.getString(PatchAnimBundle.TOPTOBOTTOM));
+ topToBottom.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ linearBlend(BlendDirection.TopToBottom);
+ }
+ });
+
+ JMenuItem rightToLeft = new JMenuItem(rb.getString(PatchAnimBundle.RIGHTTOLEFT));
+ rightToLeft.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ linearBlend(BlendDirection.RightToLeft);
+ }
+ });
+ JMenuItem bottomToTop = new JMenuItem(rb.getString(PatchAnimBundle.BOTTOMTOTOP));
+ bottomToTop.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ linearBlend(BlendDirection.BottomToTop);
+ }
+ });
+
+ linearBlend.add(leftToRight);
+ linearBlend.add(topToBottom);
+ linearBlend.add(rightToLeft);
+ linearBlend.add(bottomToTop);
+ menu.add(linearBlend);
+
JMenu copy = new JMenu(rb.getString(PatchAnimBundle.COPYPATCHFROM));
if (color != PatchColor.Red) {
JMenuItem copyRed = new JMenuItem(rb.getString(PatchAnimBundle.REDPATCH));
@@ -329,6 +365,41 @@
mediator.setNewActivePatch(patch);
}
+ private void linearBlend(BlendDirection direction) {
+ PatchPanelMediator mediator = PatchPanelMediator.getMediator();
+ CombinedPatch patch = mediator.getActivePatch();
+ PatchCoords coords = patch.getPatch(color);
+ int order = coords.getOrder();
+ double color = 0.0;
+
+ for (int i = 0; i < order; i++) {
+ for (int j = 0; j < order; j++) {
+ Coordinate c = coords.getCoordinate(i, j);
+ switch (direction) {
+ case LeftToRight:
+ color = (255.0 * i) / (order - 1);
+ break;
+
+ case TopToBottom:
+ color = (255.0 * j) / (order - 1);
+ break;
+
+ case RightToLeft:
+ color = (255.0 * (order - 1 - i)) / (order - 1);
+ break;
+
+ case BottomToTop:
+ color = (255.0 * (order - 1 - j)) / (order - 1);
+ break;
+ }
+
+ c.setColor(color);
+ coords.setCoordinate(i, j, c);
+ }
+ }
+ mediator.setNewActivePatch(patch);
+ }
+
@Override
public void paintComponent(Graphics g) {
Shape clip = g.getClip();
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-02-15 06:30:52 UTC (rev 191)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-02-15 06:56:14 UTC (rev 192)
@@ -78,6 +78,11 @@
public static final String VALUE="patchanim.value";
public static final String LIGHTENPATCH = "patchanim.lightenpatch";
public static final String DARKENPATCH = "patchanim.darkenpatch";
+ public static final String LINEARBLEND = "patchanim.linearblend";
+ public static final String LEFTTORIGHT = "patchanim.lefttoright";
+ public static final String TOPTOBOTTOM = "patchanim.toptobottom";
+ public static final String RIGHTTOLEFT = "patchanim.righttoleft";
+ public static final String BOTTOMTOTOP = "patchanim.bottomtotop";
public static final String COPYPATCHFROM = "patchanim.copypatchfrom";
public static final String REDPATCH = "patchanim.redpatch";
public static final String GREENPATCH = "patchanim.greenpatch";
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-02-15 06:30:52 UTC (rev 191)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-02-15 06:56:14 UTC (rev 192)
@@ -71,6 +71,11 @@
patchanim.value = Value...
patchanim.lightenpatch = Lighten Patch
patchanim.darkenpatch = Darken Patch
+patchanim.linearblend = Linear Blend...
+patchanim.lefttoright = Left to Right
+patchanim.toptobottom = Top to Bottom
+patchanim.righttoleft = Right to Left
+patchanim.bottomtotop = Bottom to Top
patchanim.copypatchfrom = Copy patch from...
patchanim.redpatch = Red Patch
patchanim.greenpatch = Green Patch
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-15 06:30:51
|
Revision: 191
http://patchanim.svn.sourceforge.net/patchanim/?rev=191&view=rev
Author: dbrosius
Date: 2008-02-14 22:30:52 -0800 (Thu, 14 Feb 2008)
Log Message:
-----------
use varargs for sizeUniformly
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimPanel.java
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/Utils.java
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimPanel.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimPanel.java 2008-02-15 06:22:04 UTC (rev 190)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimPanel.java 2008-02-15 06:30:52 UTC (rev 191)
@@ -58,7 +58,7 @@
JPanel listPanel = new JPatchListPanel();
p.add(listPanel, BorderLayout.WEST);
- Utils.sizeUniformly(new JComponent[] { ctrl, listPanel }, Utils.Sizing.Width);
+ Utils.sizeUniformly(Utils.Sizing.Width, ctrl, listPanel );
q = new JPanel();
{
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java 2008-02-15 06:22:04 UTC (rev 190)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java 2008-02-15 06:30:52 UTC (rev 191)
@@ -136,8 +136,8 @@
testButton.setToolTipText(rb.getString(PatchAnimBundle.TEST_TT));
add(testButton);
- Utils.sizeUniformly(new JComponent[] { widthLabel, heightLabel, animationLabel, outOfBoundsLabel, tweenFramesLabel }, Utils.Sizing.Both);
- Utils.sizeUniformly(new JComponent[] { widthField, heightField, animationCB, outOfBoundsColorCB, tweenFramesField }, Utils.Sizing.Width);
+ Utils.sizeUniformly(Utils.Sizing.Both, widthLabel, heightLabel, animationLabel, outOfBoundsLabel, tweenFramesLabel);
+ Utils.sizeUniformly(Utils.Sizing.Width, new JComponent[] { widthField, heightField, animationCB, outOfBoundsColorCB, tweenFramesField });
add(Box.createVerticalGlue());
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java 2008-02-15 06:22:04 UTC (rev 190)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java 2008-02-15 06:30:52 UTC (rev 191)
@@ -82,7 +82,7 @@
addButton = new JButton(rb.getString(PatchAnimBundle.ADD));
removeButton = new JButton(rb.getString(PatchAnimBundle.REMOVE));
removeButton.setEnabled(false);
- Utils.sizeUniformly(new JComponent[] {addButton, removeButton}, Utils.Sizing.Both);
+ Utils.sizeUniformly(Utils.Sizing.Both, addButton, removeButton);
modCtrls.add(addButton);
modCtrls.add(Box.createHorizontalStrut(10));
modCtrls.add(removeButton);
@@ -94,7 +94,7 @@
downButton = new JButton(new ImageIcon(getClass().getResource(DOWNBUTTON)));
upButton.setEnabled(false);
downButton.setEnabled(false);
- Utils.sizeUniformly(new JComponent[] {upButton, downButton}, Utils.Sizing.Both);
+ Utils.sizeUniformly(Utils.Sizing.Both, new JComponent[] {upButton, downButton});
moveCtrls.setLayout(new BoxLayout(moveCtrls, BoxLayout.Y_AXIS));
moveCtrls.add(Box.createVerticalGlue());
moveCtrls.add(upButton);
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/Utils.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/Utils.java 2008-02-15 06:22:04 UTC (rev 190)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/Utils.java 2008-02-15 06:30:52 UTC (rev 191)
@@ -47,7 +47,7 @@
p.setMaximumSize(ms);
}
- public static void sizeUniformly(JComponent[] components, Sizing sizing) {
+ public static void sizeUniformly(Sizing sizing, JComponent... components) {
int width = 0;
int height = 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-15 06:22:35
|
Revision: 190
http://patchanim.svn.sourceforge.net/patchanim/?rev=190&view=rev
Author: dbrosius
Date: 2008-02-14 22:22:04 -0800 (Thu, 14 Feb 2008)
Log Message:
-----------
update doc
Modified Paths:
--------------
trunk/patchanim/htdocs/index.html
Modified: trunk/patchanim/htdocs/index.html
===================================================================
--- trunk/patchanim/htdocs/index.html 2008-02-15 06:21:17 UTC (rev 189)
+++ trunk/patchanim/htdocs/index.html 2008-02-15 06:22:04 UTC (rev 190)
@@ -52,7 +52,7 @@
<p>February 14, 2008 - added lately</p>
<ul>
- <li>Patches can now be any order from 3 - 9, specified on the new dialog</li>
+ <li>Patches can now be any order from 2 - 9, specified on the new dialog</li>
</ul>
<p>If you would like to see the tool as it progresses, you can run the webstart version
<a href="http://patchanim.sourceforge.net/jnlp/patchanim.jnlp">here.</a></p>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-15 06:21:13
|
Revision: 189
http://patchanim.svn.sourceforge.net/patchanim/?rev=189&view=rev
Author: dbrosius
Date: 2008-02-14 22:21:17 -0800 (Thu, 14 Feb 2008)
Log Message:
-----------
allow order 2 patches
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-02-14 07:46:25 UTC (rev 188)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-02-15 06:21:17 UTC (rev 189)
@@ -187,7 +187,8 @@
rb.getString(PatchAnimBundle.TITLE),
JOptionPane.QUESTION_MESSAGE,
new ImageIcon(JPatchAnimFrame.this.getIconImage()),
- new Object[] { Integer.valueOf(3),
+ new Object[] { Integer.valueOf(2),
+ Integer.valueOf(3),
Integer.valueOf(4),
Integer.valueOf(5),
Integer.valueOf(6),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-14 07:46:20
|
Revision: 188
http://patchanim.svn.sourceforge.net/patchanim/?rev=188&view=rev
Author: dbrosius
Date: 2008-02-13 23:46:25 -0800 (Wed, 13 Feb 2008)
Log Message:
-----------
update doc
Modified Paths:
--------------
trunk/patchanim/htdocs/index.html
Modified: trunk/patchanim/htdocs/index.html
===================================================================
--- trunk/patchanim/htdocs/index.html 2008-02-14 07:42:44 UTC (rev 187)
+++ trunk/patchanim/htdocs/index.html 2008-02-14 07:46:25 UTC (rev 188)
@@ -36,7 +36,7 @@
a color from black to a full primary color (red in this case). By using a curve, we can give a separate color for
each section of the curve, as seen in the color blend below the curve.</p>
<div style="position:relative;left:300px;"/><img src="bezier.jpg"/></div>
- <p>Now this tool uses Cubic Bezier <b>patches</b>, not curves. A Bezier patch is a description of a 3D surface
+ <p>Now this tool uses Bezier <b>patches</b>, not curves. A Cubic Bezier patch is a description of a 3D surface
consisting of 16 control points. You can think of a patch as a set of bezier curves running in parallel along the
x axis, and a cross cutting set of curves running along the y axis. (This is an over-simplification, and in fact incorrect,
but is good enough to understand what this application is doing). Again, though, the z value in
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-14 07:42:39
|
Revision: 187
http://patchanim.svn.sourceforge.net/patchanim/?rev=187&view=rev
Author: dbrosius
Date: 2008-02-13 23:42:44 -0800 (Wed, 13 Feb 2008)
Log Message:
-----------
add rename patch to context menu, and update doc
Modified Paths:
--------------
trunk/patchanim/htdocs/nameediting.jpg
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java
trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java
trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties
Modified: trunk/patchanim/htdocs/nameediting.jpg
===================================================================
(Binary files differ)
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java 2008-02-14 07:34:15 UTC (rev 186)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java 2008-02-14 07:42:44 UTC (rev 187)
@@ -205,16 +205,7 @@
if (me.getClickCount() == 2) {
CombinedPatch patch = (CombinedPatch)patchList.getSelectedValue();
if (patch != null) {
- ResourceBundle rb = PatchAnimBundle.getBundle();
- String newName = JOptionPane.showInputDialog(JPatchListPanel.this, rb.getString(PatchAnimBundle.ENTERNEWPATCHNAME), patch.getName());
- if (newName != null) {
- patch.setName(newName);
- PatchPanelMediator mediator = PatchPanelMediator.getMediator();
- mediator.getDocument().setDirty(true);
- patchList.invalidate();
- patchList.revalidate();
- patchList.repaint();
- }
+ renamePatch(patch);
}
}
}
@@ -235,9 +226,34 @@
});
}
+ private void renamePatch(CombinedPatch patch) {
+ if (patch != null) {
+ ResourceBundle rb = PatchAnimBundle.getBundle();
+ String newName = JOptionPane.showInputDialog(JPatchListPanel.this, rb.getString(PatchAnimBundle.ENTERNEWPATCHNAME), patch.getName());
+ if (newName != null) {
+ patch.setName(newName);
+ PatchPanelMediator mediator = PatchPanelMediator.getMediator();
+ mediator.getDocument().setDirty(true);
+ patchList.invalidate();
+ patchList.revalidate();
+ patchList.repaint();
+ }
+ }
+ }
+
private void showPatchListMenu(MouseEvent me) {
ResourceBundle rb = PatchAnimBundle.getBundle();
JPopupMenu patchMenu = new JPopupMenu();
+ JMenuItem renameItem = new JMenuItem(rb.getString(PatchAnimBundle.RENAME));
+ renameItem.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ CombinedPatch patch = (CombinedPatch)patchList.getSelectedValue();
+ if (patch != null) {
+ renamePatch(patch);
+ }
+ }
+ });
+ patchMenu.add(renameItem);
JMenuItem cloneItem = new JMenuItem(rb.getString(PatchAnimBundle.CLONE));
cloneItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-02-14 07:34:15 UTC (rev 186)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-02-14 07:42:44 UTC (rev 187)
@@ -69,6 +69,7 @@
public static final String ENTERNEWPATCHNAME = "patchanim.enternewpatchname";
public static final String ADD = "patchanim.add";
public static final String REMOVE = "patchanim.remove";
+ public static final String RENAME = "patchanim.rename";
public static final String CLONE = "patchanim.clone";
public static final String COLOR = "patchanim.color";
public static final String SETALLPOINTS = "patchanim.setallpoints";
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-02-14 07:34:15 UTC (rev 186)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-02-14 07:42:44 UTC (rev 187)
@@ -62,6 +62,7 @@
patchanim.enternewpatchname = Rename Patch to
patchanim.add = Add
patchanim.remove = Remove
+patchanim.rename = Rename
patchanim.clone = Clone
patchanim.color = Color
patchanim.setallpoints = Set all control points to...
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-14 07:34:13
|
Revision: 186
http://patchanim.svn.sourceforge.net/patchanim/?rev=186&view=rev
Author: dbrosius
Date: 2008-02-13 23:34:15 -0800 (Wed, 13 Feb 2008)
Log Message:
-----------
add more doc
Modified Paths:
--------------
trunk/patchanim/htdocs/index.html
Added Paths:
-----------
trunk/patchanim/htdocs/order.gif
Modified: trunk/patchanim/htdocs/index.html
===================================================================
--- trunk/patchanim/htdocs/index.html 2008-02-14 07:18:45 UTC (rev 185)
+++ trunk/patchanim/htdocs/index.html 2008-02-14 07:34:15 UTC (rev 186)
@@ -50,20 +50,20 @@
to generate one full color blend. Since the description of the blend is very succinct (just 3 * 16 points), It is
very easy to generate in-between images from two separate blend descriptions.</p>
-
- <p><b>Feb 10, 2008 - This tool is not finished at this time, although the patch animations work</b><br/>
- Still to be done:
- <ul>
- <li>export to mpeg?</li>
- <li>Patch Library</li>
- <li>Color Swatch for editing values</li>
- <li>....and much more</li>
- </ul>
- </p>
+ <p>February 14, 2008 - added lately</p>
+ <ul>
+ <li>Patches can now be any order from 3 - 9, specified on the new dialog</li>
+ </ul>
<p>If you would like to see the tool as it progresses, you can run the webstart version
<a href="http://patchanim.sourceforge.net/jnlp/patchanim.jnlp">here.</a></p>
<img src="sample.jpg"/>
- <p><table cellpadding="10"><tr><td><img src="nameediting.jpg"/></td><td><img src="patchediting.jpg"/></td></tr></table></p>
+ <p><table cellpadding="10">
+ <tr>
+ <td><img src="order.gif"/></td>
+ <td><img src="nameediting.jpg"/></td>
+ <td><img src="patchediting.jpg"/></td>
+ </tr>
+ </table></p>
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
Added: trunk/patchanim/htdocs/order.gif
===================================================================
(Binary files differ)
Property changes on: trunk/patchanim/htdocs/order.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-14 07:18:40
|
Revision: 185
http://patchanim.svn.sourceforge.net/patchanim/?rev=185&view=rev
Author: dbrosius
Date: 2008-02-13 23:18:45 -0800 (Wed, 13 Feb 2008)
Log Message:
-----------
allow for documents with user specified patch order
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java
trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd
trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsl
trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java
trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java
trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java
trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties
trunk/patchanim/src/com/mebigfatguy/patchanim/surface/CombinedPatch.java
trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchCoords.java
trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java 2008-02-14 05:14:11 UTC (rev 184)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java 2008-02-14 07:18:45 UTC (rev 185)
@@ -29,9 +29,10 @@
*/
public class PatchAnimDocument implements Serializable {
- private static final long serialVersionUID = -587863884486252874L;
+ private static final long serialVersionUID = -7412254429829665944L;
private boolean dirty;
+ private int order;
private List<CombinedPatch> patches;
private int width;
private int height;
@@ -42,9 +43,10 @@
/**
* constructs a new document for the New menu item
*/
- public PatchAnimDocument() {
+ public PatchAnimDocument(int patchOrder) {
+ order = patchOrder;
patches = new ArrayList<CombinedPatch>();
- CombinedPatch patch = new CombinedPatch(true);
+ CombinedPatch patch = new CombinedPatch(order, true);
patches.add(patch);
width = 200;
height = 200;
@@ -70,6 +72,14 @@
}
/**
+ * returns the order of the bezier patch used for this document
+ * @return the order of the patch
+ */
+ public int getOrder() {
+ return order;
+ }
+
+ /**
* retrieves a list of all the bezier patches
* @return the list of all the bezier patches
*/
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java 2008-02-14 05:14:11 UTC (rev 184)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java 2008-02-14 07:18:45 UTC (rev 185)
@@ -143,8 +143,9 @@
return;
g.setColor(Color.yellow);
- for (int u = 0; u < PatchCoords.ORDER; u++) {
- for (int v = 0; v < PatchCoords.ORDER; v++) {
+ int order = coords.getOrder();
+ for (int u = 0; u < order; u++) {
+ for (int v = 0; v < order; v++) {
Coordinate c = coords.getCoordinate(u, v);
if ((selectedXPt == u) && (selectedYPt == v)) {
g.fillOval((int)(((c.getX() * (bounds.width - 5)) / 100.0) + bounds.x),
@@ -210,8 +211,9 @@
int minU = 0;
int minV = 0;
- for (int u = 0; u < PatchCoords.ORDER; u++) {
- for (int v = 0; v < PatchCoords.ORDER; v++) {
+ int order = coords.getOrder();
+ for (int u = 0; u < order; u++) {
+ for (int v = 0; v < order; v++) {
Coordinate c = coords.getCoordinate(u, v);
double xSq = c.getX() - inputX;
xSq *= xSq;
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-02-14 05:14:11 UTC (rev 184)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-02-14 07:18:45 UTC (rev 185)
@@ -82,7 +82,7 @@
cp.setLayout(new BorderLayout(4, 4));
JPatchAnimPanel patchPanel = new JPatchAnimPanel();
- document = new PatchAnimDocument();
+ document = new PatchAnimDocument(4);
documentLocation = null;
PatchPanelMediator mediator = PatchPanelMediator.getMediator();
mediator.setDocument(document);
@@ -171,6 +171,7 @@
newItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
+ ResourceBundle rb = PatchAnimBundle.getBundle();
try {
if (document.isDirty()) {
int choice = askSave();
@@ -181,13 +182,28 @@
}
}
- document = new PatchAnimDocument();
+ Integer choice = (Integer)JOptionPane.showInputDialog(JPatchAnimFrame.this,
+ rb.getString(PatchAnimBundle.SETORDER),
+ rb.getString(PatchAnimBundle.TITLE),
+ JOptionPane.QUESTION_MESSAGE,
+ new ImageIcon(JPatchAnimFrame.this.getIconImage()),
+ new Object[] { Integer.valueOf(3),
+ Integer.valueOf(4),
+ Integer.valueOf(5),
+ Integer.valueOf(6),
+ Integer.valueOf(7),
+ Integer.valueOf(8),
+ Integer.valueOf(9) },
+ Integer.valueOf(4));
+ if (choice == null)
+ choice = Integer.valueOf(4);
+
+ document = new PatchAnimDocument(choice.intValue());
documentLocation = null;
saveItem.setEnabled(false);
PatchPanelMediator mediator = PatchPanelMediator.getMediator();
mediator.setDocument(document);
} catch (IOException ioe) {
- ResourceBundle rb = PatchAnimBundle.getBundle();
JOptionPane.showMessageDialog(JPatchAnimFrame.this, rb.getString(PatchAnimBundle.SAVEFAILED));
}
}
@@ -338,7 +354,7 @@
ResourceBundle rb = PatchAnimBundle.getBundle();
JOptionPane.showMessageDialog(JPatchAnimFrame.this, rb.getString(PatchAnimBundle.LOADFAILED));
documentLocation = null;
- document = new PatchAnimDocument();
+ document = new PatchAnimDocument(4);
} finally {
PatchPanelMediator mediator = PatchPanelMediator.getMediator();
mediator.setDocument(document);
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java 2008-02-14 05:14:11 UTC (rev 184)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java 2008-02-14 07:18:45 UTC (rev 185)
@@ -130,7 +130,8 @@
else
selIndex++;
- CombinedPatch newPatch = new CombinedPatch(true);
+ PatchPanelMediator mediator = PatchPanelMediator.getMediator();
+ CombinedPatch newPatch = new CombinedPatch(mediator.getDocument().getOrder(), true);
patchListModel.add(selIndex, newPatch);
patchList.setSelectedIndex(selIndex);
removeButton.setEnabled(patchListModel.getSize() > 1);
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java 2008-02-14 05:14:11 UTC (rev 184)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java 2008-02-14 07:18:45 UTC (rev 185)
@@ -286,8 +286,9 @@
CombinedPatch patch = mediator.getActivePatch();
PatchCoords srcCoords = patch.getPatch(copyColor);
PatchCoords dstCoords = patch.getPatch(color);
- for (int i = 0; i < PatchCoords.ORDER; i++) {
- for (int j = 0; j < PatchCoords.ORDER; j++) {
+ int order = srcCoords.getOrder();
+ for (int i = 0; i < order; i++) {
+ for (int j = 0; j < order; j++) {
Coordinate srcCoord = srcCoords.getCoordinate(i, j);
double value = srcCoord.getColor();
Coordinate dstCoord = dstCoords.getCoordinate(i, j);
@@ -302,8 +303,9 @@
PatchPanelMediator mediator = PatchPanelMediator.getMediator();
CombinedPatch patch = mediator.getActivePatch();
PatchCoords coords = patch.getPatch(color);
- for (int i = 0; i < PatchCoords.ORDER; i++) {
- for (int j = 0; j < PatchCoords.ORDER; j++) {
+ int order = coords.getOrder();
+ for (int i = 0; i < order; i++) {
+ for (int j = 0; j < order; j++) {
Coordinate c = coords.getCoordinate(i, j);
c.setColor(c.getColor() + d);
coords.setCoordinate(i, j, c);
@@ -316,8 +318,9 @@
PatchPanelMediator mediator = PatchPanelMediator.getMediator();
CombinedPatch patch = mediator.getActivePatch();
PatchCoords coords = patch.getPatch(color);
- for (int i = 0; i < PatchCoords.ORDER; i++) {
- for (int j = 0; j < PatchCoords.ORDER; j++) {
+ int order = coords.getOrder();
+ for (int i = 0; i < order; i++) {
+ for (int j = 0; j < order; j++) {
Coordinate c = coords.getCoordinate(i, j);
c.setColor(d);
coords.setCoordinate(i, j, c);
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd 2008-02-14 05:14:11 UTC (rev 184)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd 2008-02-14 07:18:45 UTC (rev 185)
@@ -29,6 +29,7 @@
<xsd:complexType name="SettingsClass">
<xsd:attribute name="animationType" type="AnimationTypeClass" use="required"/>
<xsd:attribute name="height" type="xsd:integer" use="required"/>
+ <xsd:attribute name="order" type="xsd:positiveInteger" default="4"/>
<xsd:attribute name="outOfBoundsColor" type="OutOfBoundsColorClass" use="required"/>
<xsd:attribute name="tweenCount" type="xsd:integer" use="required"/>
<xsd:attribute name="width" type="xsd:integer" use="required"/>
@@ -77,7 +78,7 @@
</xsd:simpleType>
<xsd:complexType name="PatchesClass">
<xsd:sequence>
- <xsd:element maxOccurs="4" minOccurs="4" name="CombinedPatch" type="CombinedPatchClass"/>
+ <xsd:element maxOccurs="unbounded" minOccurs="1" name="CombinedPatch" type="CombinedPatchClass"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="PatchAnimDoc" type="PatchAnimDocClass"/>
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsl
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsl 2008-02-14 05:14:11 UTC (rev 184)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsl 2008-02-14 07:18:45 UTC (rev 185)
@@ -37,6 +37,9 @@
<xsl:value-of select="pae:getVersion($ext)"/>
</xsl:attribute>
<Settings>
+ <xsl:attribute name="order">
+ <xsl:value-of select="pae:getOrder($ext)"/>
+ </xsl:attribute>
<xsl:attribute name="width">
<xsl:value-of select="pae:getWidth($ext)"/>
</xsl:attribute>
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java 2008-02-14 05:14:11 UTC (rev 184)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java 2008-02-14 07:18:45 UTC (rev 185)
@@ -34,7 +34,6 @@
import com.mebigfatguy.patchanim.PatchAnimDocument;
import com.mebigfatguy.patchanim.PatchColor;
import com.mebigfatguy.patchanim.surface.Coordinate;
-import com.mebigfatguy.patchanim.surface.PatchCoords;
public class PatchAnimExtension {
private static final String VERSION_URL = "/com/mebigfatguy/patchanim/io/Version.txt";
@@ -60,6 +59,10 @@
}
}
+ public String getOrder(@SuppressWarnings("unused") ExpressionContext context) {
+ return String.valueOf(paDoc.getOrder());
+ }
+
public String getWidth(@SuppressWarnings("unused") ExpressionContext context) {
return String.valueOf(paDoc.getWidth());
}
@@ -104,11 +107,11 @@
NodeList nl = new NodeList() {
public int getLength() {
- return PatchCoords.ORDER * PatchCoords.ORDER;
+ int order = paDoc.getOrder();
+ return order * order;
}
public Node item(int index) {
- // TODO Auto-generated method stub
return d.createTextNode(String.valueOf(index));
}
};
@@ -117,30 +120,24 @@
}
public String getX(@SuppressWarnings("unused") ExpressionContext context, String color, Node patchIndexNode, Node coordIndexNode) {
- PatchColor patchColor = PatchColor.valueOf(PatchColor.class, color);
- int patchIndex = Integer.parseInt(patchIndexNode.getNodeValue());
- int coordIndex = Integer.parseInt(coordIndexNode.getNodeValue());
-
- Coordinate coord = paDoc.getPatches().get(patchIndex).getPatch(patchColor).getCoordinate(coordIndex % PatchCoords.ORDER, coordIndex / PatchCoords.ORDER);
- return String.valueOf(coord.getX());
+ return String.valueOf(getCoordinate(color, patchIndexNode, coordIndexNode).getX());
}
public String getY(@SuppressWarnings("unused") ExpressionContext context, String color, Node patchIndexNode, Node coordIndexNode) {
- PatchColor patchColor = PatchColor.valueOf(PatchColor.class, color);
- int patchIndex = Integer.parseInt(patchIndexNode.getNodeValue());
- int coordIndex = Integer.parseInt(coordIndexNode.getNodeValue());
-
- Coordinate coord = paDoc.getPatches().get(patchIndex).getPatch(patchColor).getCoordinate(coordIndex % PatchCoords.ORDER, coordIndex / PatchCoords.ORDER);
- return String.valueOf(coord.getY());
+ return String.valueOf(getCoordinate(color, patchIndexNode, coordIndexNode).getY());
}
public String getColor(@SuppressWarnings("unused") ExpressionContext context, String color, Node patchIndexNode, Node coordIndexNode) {
+ return String.valueOf(getCoordinate(color, patchIndexNode, coordIndexNode).getColor());
+ }
+
+ private Coordinate getCoordinate(String color, Node patchIndexNode, Node coordIndexNode) {
PatchColor patchColor = PatchColor.valueOf(PatchColor.class, color);
int patchIndex = Integer.parseInt(patchIndexNode.getNodeValue());
int coordIndex = Integer.parseInt(coordIndexNode.getNodeValue());
+ int order = paDoc.getOrder();
- Coordinate coord = paDoc.getPatches().get(patchIndex).getPatch(patchColor).getCoordinate(coordIndex % PatchCoords.ORDER, coordIndex / PatchCoords.ORDER);
- return String.valueOf(coord.getColor());
+ return paDoc.getPatches().get(patchIndex).getPatch(patchColor).getCoordinate(coordIndex % order, coordIndex / order);
}
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2008-02-14 05:14:11 UTC (rev 184)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2008-02-14 07:18:45 UTC (rev 185)
@@ -86,73 +86,18 @@
public static PatchAnimDocument loadFile(File f) throws IOException {
InputStream xmlIs = null;
- final PatchAnimDocument doc = new PatchAnimDocument();
- doc.getPatches().clear();
try {
XMLReader reader = XMLReaderFactory.createXMLReader();
- reader.setContentHandler(new DefaultHandler() {
- private static final String SETTINGS = "Settings";
- private static final String WIDTH = "width";
- private static final String HEIGHT = "height";
- private static final String ANIMATIONTYPE = "animationType";
- private static final String OUTOFBOUNDSCOLOR = "outOfBoundsColor";
- private static final String TWEENCOUNT = "tweenCount";
- private static final String COMBINEDPATCH = "CombinedPatch";
- private static final String PATCH = "Patch";
- private static final String COLOR = "color";
- private static final String COORDINATE = "Coordinate";
- private static final String X = "x";
- private static final String Y = "y";
-
- private CombinedPatch cPatch = null;
- private PatchCoords patchCoords = null;
- private PatchColor patchColor = null;
- private int coordIndex = 0;
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes atts) {
- if (SETTINGS.equals(localName)) {
- doc.setWidth(Integer.parseInt(atts.getValue(WIDTH)));
- doc.setHeight(Integer.parseInt(atts.getValue(HEIGHT)));
- doc.setAnimationType(AnimationType.valueOf(AnimationType.class, atts.getValue(ANIMATIONTYPE)));
- doc.setOutOfBoundsColor(OutOfBoundsColor.valueOf(OutOfBoundsColor.class, atts.getValue(OUTOFBOUNDSCOLOR)));
- doc.setTweenCount(Integer.parseInt(atts.getValue(TWEENCOUNT)));
- } else if (COMBINEDPATCH.equals(localName)) {
- cPatch = new CombinedPatch(false);
- } else if (PATCH.equals(localName)) {
- patchCoords = new PatchCoords();
- patchColor = PatchColor.valueOf(PatchColor.class, atts.getValue(COLOR));
- } else if (COORDINATE.equals(localName)) {
- Coordinate c = new Coordinate(Double.parseDouble(atts.getValue(X)),
- Double.parseDouble(atts.getValue(Y)),
- Double.parseDouble(atts.getValue(COLOR)));
- patchCoords.setCoordinate(coordIndex / PatchCoords.ORDER, coordIndex % PatchCoords.ORDER, c);
- coordIndex++;
- c = null;
- }
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) {
- if (COMBINEDPATCH.equals(localName)) {
- doc.getPatches().add(cPatch);
- cPatch = null;
- } else if (PATCH.equals(localName)) {
- cPatch.setPatch(patchColor, patchCoords);
- patchColor = null;
- patchCoords = null;
- coordIndex = 0;
- }
- }
- });
+ PatchAnimDocContentHandler handler = new PatchAnimDocContentHandler();
+ reader.setContentHandler(handler);
xmlIs = new BufferedInputStream(new FileInputStream(f));
reader.setFeature("http://apache.org/xml/features/validation/schema", true);
reader.setFeature("http://xml.org/sax/features/validation", true);
reader.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation", PatchAnimDocument.class.getResource(PATCHANIMDOC_SCHEMA).toString());
reader.parse(new InputSource(xmlIs));
- return doc;
+ return handler.getDocument();
} catch (IOException ioe) {
throw ioe;
} catch (Exception e) {
@@ -163,4 +108,71 @@
Closer.close(xmlIs);
}
}
+
+ static class PatchAnimDocContentHandler extends DefaultHandler {
+ private static final String SETTINGS = "Settings";
+ private static final String ORDER = "order";
+ private static final String WIDTH = "width";
+ private static final String HEIGHT = "height";
+ private static final String ANIMATIONTYPE = "animationType";
+ private static final String OUTOFBOUNDSCOLOR = "outOfBoundsColor";
+ private static final String TWEENCOUNT = "tweenCount";
+ private static final String COMBINEDPATCH = "CombinedPatch";
+ private static final String PATCH = "Patch";
+ private static final String COLOR = "color";
+ private static final String COORDINATE = "Coordinate";
+ private static final String X = "x";
+ private static final String Y = "y";
+
+ PatchAnimDocument doc = null;
+
+ private CombinedPatch cPatch = null;
+ private PatchCoords patchCoords = null;
+ private PatchColor patchColor = null;
+ private int coordIndex = 0;
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes atts) {
+ if (SETTINGS.equals(localName)) {
+ int order = Integer.parseInt(atts.getValue(ORDER));
+ doc = new PatchAnimDocument(order);
+ doc.getPatches().clear();
+ doc.setWidth(Integer.parseInt(atts.getValue(WIDTH)));
+ doc.setHeight(Integer.parseInt(atts.getValue(HEIGHT)));
+ doc.setAnimationType(AnimationType.valueOf(AnimationType.class, atts.getValue(ANIMATIONTYPE)));
+ doc.setOutOfBoundsColor(OutOfBoundsColor.valueOf(OutOfBoundsColor.class, atts.getValue(OUTOFBOUNDSCOLOR)));
+ doc.setTweenCount(Integer.parseInt(atts.getValue(TWEENCOUNT)));
+ } else if (COMBINEDPATCH.equals(localName)) {
+ cPatch = new CombinedPatch(doc.getOrder(), false);
+ } else if (PATCH.equals(localName)) {
+ patchCoords = new PatchCoords(doc.getOrder());
+ patchColor = PatchColor.valueOf(PatchColor.class, atts.getValue(COLOR));
+ } else if (COORDINATE.equals(localName)) {
+ Coordinate c = new Coordinate(Double.parseDouble(atts.getValue(X)),
+ Double.parseDouble(atts.getValue(Y)),
+ Double.parseDouble(atts.getValue(COLOR)));
+ int order = doc.getOrder();
+ patchCoords.setCoordinate(coordIndex % order, coordIndex / order, c);
+ coordIndex++;
+ c = null;
+ }
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) {
+ if (COMBINEDPATCH.equals(localName)) {
+ doc.getPatches().add(cPatch);
+ cPatch = null;
+ } else if (PATCH.equals(localName)) {
+ cPatch.setPatch(patchColor, patchCoords);
+ patchColor = null;
+ patchCoords = null;
+ coordIndex = 0;
+ }
+ }
+
+ public PatchAnimDocument getDocument() {
+ return doc;
+ }
+ }
}
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-02-14 05:14:11 UTC (rev 184)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-02-14 07:18:45 UTC (rev 185)
@@ -45,6 +45,7 @@
public static final String EXPORTINGFILE = "patchanim.exportfile";
public static final String QUIT = "patchanim.quit";
public static final String CONTROLS = "patchanim.control";
+ public static final String SETORDER = "patchanim.setorder";
public static final String PATCHES = "patchanim.patches";
public static final String WIDTH = "patchanim.width";
public static final String WIDTH_TT = "patchanim.tooltip.width";
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-02-14 05:14:11 UTC (rev 184)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-02-14 07:18:45 UTC (rev 185)
@@ -38,6 +38,7 @@
patchanim.exportfile = Exporting Animation
patchanim.quit = Quit
patchanim.control = Controls
+patchanim.setorder = Set the order of the patches to
patchanim.patches = Patches
patchanim.width = Width
patchanim.tooltip.width = The width of the exported animation
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/CombinedPatch.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/surface/CombinedPatch.java 2008-02-14 05:14:11 UTC (rev 184)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/surface/CombinedPatch.java 2008-02-14 07:18:45 UTC (rev 185)
@@ -32,15 +32,15 @@
private EnumMap<PatchColor, PatchCoords> patches = new EnumMap<PatchColor, PatchCoords>(PatchColor.class);
private String name;
- public CombinedPatch(boolean init) {
+ public CombinedPatch(int order, boolean init) {
if (init) {
- patches.put(PatchColor.Red, PatchCoords.buildRandomPatch());
- patches.put(PatchColor.Green, PatchCoords.buildRandomPatch());
- patches.put(PatchColor.Blue, PatchCoords.buildRandomPatch());
+ patches.put(PatchColor.Red, PatchCoords.buildRandomPatch(order));
+ patches.put(PatchColor.Green, PatchCoords.buildRandomPatch(order));
+ patches.put(PatchColor.Blue, PatchCoords.buildRandomPatch(order));
} else {
- patches.put(PatchColor.Red, new PatchCoords());
- patches.put(PatchColor.Green, new PatchCoords());
- patches.put(PatchColor.Blue, new PatchCoords());
+ patches.put(PatchColor.Red, new PatchCoords(order));
+ patches.put(PatchColor.Green, new PatchCoords(order));
+ patches.put(PatchColor.Blue, new PatchCoords(order));
}
ResourceBundle rb = PatchAnimBundle.getBundle();
name = rb.getString(PatchAnimBundle.DEFAULTPATCHNAME);
@@ -62,11 +62,11 @@
}
return clonedPatch;
} catch (CloneNotSupportedException cnse) {
- return new CombinedPatch(true);
+ return new CombinedPatch(getPatch(PatchColor.Red).getOrder(), true);
}
}
public static CombinedPatch tween(CombinedPatch startPatch, CombinedPatch endPatch, double frac) {
- CombinedPatch tweenPatch = new CombinedPatch(false);
+ CombinedPatch tweenPatch = new CombinedPatch(startPatch.getPatch(PatchColor.Red).getOrder(), false);
{
PatchCoords sRedCoords = startPatch.getPatch(PatchColor.Red);
PatchCoords eRedCoords = endPatch.getPatch(PatchColor.Red);
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchCoords.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchCoords.java 2008-02-14 05:14:11 UTC (rev 184)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchCoords.java 2008-02-14 07:18:45 UTC (rev 185)
@@ -25,26 +25,27 @@
public class PatchCoords implements Serializable, Cloneable {
private static final long serialVersionUID = -4052789167154764908L;
- public static final int ORDER = 4;
-
+ private int order;
private Coordinate[][] coords;
- public static PatchCoords buildRandomPatch() {
- Coordinate[][] coords = new Coordinate[PatchCoords.ORDER][PatchCoords.ORDER];
+ public static PatchCoords buildRandomPatch(int patchOrder) {
+ Coordinate[][] coords = new Coordinate[patchOrder][patchOrder];
Random r = new Random();
- for (int u = 0; u < PatchCoords.ORDER; u++) {
- for (int v = 0; v < PatchCoords.ORDER; v++) {
- coords[u][v] = new Coordinate((u * 100.0) / (PatchCoords.ORDER - 1), (v * 100.0) / (PatchCoords.ORDER - 1), r.nextInt(400) - 50);
+ for (int u = 0; u < patchOrder; u++) {
+ for (int v = 0; v < patchOrder; v++) {
+ coords[u][v] = new Coordinate((u * 100.0) / (patchOrder - 1), (v * 100.0) / (patchOrder - 1), r.nextInt(400) - 50);
}
}
- return new PatchCoords(coords);
+ return new PatchCoords(patchOrder, coords);
}
- public PatchCoords() {
- coords = new Coordinate[ORDER][ORDER];
+ public PatchCoords(int patchOrder) {
+ order = patchOrder;
+ coords = new Coordinate[patchOrder][patchOrder];
}
- public PatchCoords(Coordinate[][] coordinates) {
+ public PatchCoords(int patchOrder, Coordinate[][] coordinates) {
+ order = patchOrder;
coords = coordinates;
}
@@ -52,22 +53,27 @@
public Object clone() {
try {
PatchCoords clonedCoords = (PatchCoords)super.clone();
- clonedCoords.coords = new Coordinate[ORDER][ORDER];
- for (int u = 0; u < PatchCoords.ORDER; u++) {
- for (int v = 0; v < PatchCoords.ORDER; v++) {
+ clonedCoords.coords = new Coordinate[order][order];
+ for (int u = 0; u < order; u++) {
+ for (int v = 0; v < order; v++) {
clonedCoords.coords[u][v] = (Coordinate)coords[u][v].clone();
}
}
return clonedCoords;
} catch (CloneNotSupportedException cnse) {
- return buildRandomPatch();
+ return buildRandomPatch(order);
}
}
+
+ public int getOrder() {
+ return order;
+ }
+
public static PatchCoords tween(PatchCoords startCoords, PatchCoords endCoords, double frac) {
- PatchCoords tweenCoords = new PatchCoords();
- for (int x = 0; x < ORDER; x++) {
- for (int y = 0; y < ORDER; y++) {
+ PatchCoords tweenCoords = new PatchCoords(startCoords.getOrder());
+ for (int x = 0; x < tweenCoords.order; x++) {
+ for (int y = 0; y < tweenCoords.order; y++) {
Coordinate startC = startCoords.getCoordinate(x,y);
Coordinate endC = endCoords.getCoordinate(x,y);
int tweenColor = (int)(startC.getColor() + (endC.getColor() - startC.getColor()) * frac);
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java 2008-02-14 05:14:11 UTC (rev 184)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java 2008-02-14 07:18:45 UTC (rev 185)
@@ -46,11 +46,12 @@
coords[0] = patch.getPatch(PatchColor.Red);
coords[1] = patch.getPatch(PatchColor.Green);
coords[2] = patch.getPatch(PatchColor.Blue);
+ int order = coords[0].getOrder();
double u;
double v;
- double[] uCoeffs = new double[PatchCoords.ORDER];
- double[] vCoeffs = new double[PatchCoords.ORDER];
+ double[] uCoeffs = new double[order];
+ double[] vCoeffs = new double[order];
double[] value = new double[3];
int[] iValue = new int[3];
@@ -67,8 +68,8 @@
value[0] = value[1] = value[2] = 0.0;
- for (int i = 0; i < PatchCoords.ORDER; i++) {
- for (int j = 0; j < PatchCoords.ORDER; j++) {
+ for (int j = 0; j < order; j++) {
+ for (int i = 0; i < order; i++) {
double coeff = uCoeffs[i] * vCoeffs[j];
for (int k = 0; k < 3; k++) {
value[k] += coords[k].getCoordinate(i, j).getColor() * coeff;
@@ -108,11 +109,12 @@
int pixel = 0;
PatchCoords coords = patch.getPatch(color);
+ int order = coords.getOrder();
double u;
double v;
- double[] uCoeffs = new double[PatchCoords.ORDER];
- double[] vCoeffs = new double[PatchCoords.ORDER];
+ double[] uCoeffs = new double[order];
+ double[] vCoeffs = new double[order];
int sampleSizeX = image.getWidth();
int sampleSizeY = image.getHeight();
@@ -126,8 +128,8 @@
buildCoefficients(u, uCoeffs);
double value = 0.0;
- for (int i = 0; i < PatchCoords.ORDER; i++) {
- for (int j = 0; j < PatchCoords.ORDER; j++) {
+ for (int j = 0; j < order; j++) {
+ for (int i = 0; i < order; i++) {
value += coords.getCoordinate(i, j).getColor() * uCoeffs[i] * vCoeffs[j];
}
}
@@ -178,16 +180,29 @@
}
private static void buildCoefficients(double t, double[] coeffs) {
- double t2 = t * t;
- double t3 = t2 * t;
+ double tt = 1.0;
+ for (int i = 0; i < coeffs.length; i++) {
+ coeffs[i] = tt;
+ tt = tt * t;
+ }
+
double oneMinusT = 1.0 - t;
- double oneMinusT2 = oneMinusT * oneMinusT;
- double oneMinusT3 = oneMinusT2 * oneMinusT;
+ double oneMinusTT = 1.0;
+ for (int i = coeffs.length - 1; i >= 0; i--) {
+ coeffs[i] *= oneMinusTT;
+ oneMinusTT = oneMinusTT * oneMinusT;
+ }
- coeffs[0] = oneMinusT3;
- coeffs[1] = 3.0 * t * oneMinusT2;
- coeffs[2] = 3.0 * t2 * oneMinusT;
- coeffs[3] = t3;
+ for (int i = 0; i < coeffs.length; i++) {
+ coeffs[i] *= NChooseI.nChooseI(coeffs.length-1, i);
+ }
}
+ static class NChooseI {
+ private static double[] factorial = { 1.0, 1.0, 2.0, 6.0, 24.0, 120.0, 720.0, 5040.0, 40320.0, 362880.0 };
+
+ public static double nChooseI(int n, int i) {
+ return factorial[n]/(factorial[i] * factorial[n-i]);
+ }
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-14 05:14:06
|
Revision: 184
http://patchanim.svn.sourceforge.net/patchanim/?rev=184&view=rev
Author: dbrosius
Date: 2008-02-13 21:14:11 -0800 (Wed, 13 Feb 2008)
Log Message:
-----------
more honoring of PatchCoords.ORDER
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java 2008-02-14 05:11:25 UTC (rev 183)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java 2008-02-14 05:14:11 UTC (rev 184)
@@ -210,8 +210,8 @@
int minU = 0;
int minV = 0;
- for (int u = 0; u < 4; u++) {
- for (int v = 0; v < 4; v++) {
+ for (int u = 0; u < PatchCoords.ORDER; u++) {
+ for (int v = 0; v < PatchCoords.ORDER; v++) {
Coordinate c = coords.getCoordinate(u, v);
double xSq = c.getX() - inputX;
xSq *= xSq;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-14 05:11:20
|
Revision: 183
http://patchanim.svn.sourceforge.net/patchanim/?rev=183&view=rev
Author: dbrosius
Date: 2008-02-13 21:11:25 -0800 (Wed, 13 Feb 2008)
Log Message:
-----------
honor PatchCoords.ORDER
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java 2008-02-14 05:06:32 UTC (rev 182)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java 2008-02-14 05:11:25 UTC (rev 183)
@@ -143,8 +143,8 @@
return;
g.setColor(Color.yellow);
- for (int u = 0; u < 4; u++) {
- for (int v = 0; v < 4; v++) {
+ for (int u = 0; u < PatchCoords.ORDER; u++) {
+ for (int v = 0; v < PatchCoords.ORDER; v++) {
Coordinate c = coords.getCoordinate(u, v);
if ((selectedXPt == u) && (selectedYPt == v)) {
g.fillOval((int)(((c.getX() * (bounds.width - 5)) / 100.0) + bounds.x),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-14 05:06:27
|
Revision: 182
http://patchanim.svn.sourceforge.net/patchanim/?rev=182&view=rev
Author: dbrosius
Date: 2008-02-13 21:06:32 -0800 (Wed, 13 Feb 2008)
Log Message:
-----------
select control text fields on focus
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java 2008-02-14 04:58:33 UTC (rev 181)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java 2008-02-14 05:06:32 UTC (rev 182)
@@ -23,6 +23,7 @@
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ResourceBundle;
@@ -163,10 +164,9 @@
}
});
- widthField.addFocusListener(new FocusAdapter() {
+ widthField.addFocusListener(new FocusListener() {
- @Override
- public void focusLost(FocusEvent arg0) {
+ public void focusLost(FocusEvent fe) {
try {
int oldWidth = document.getWidth();
int newWidth = Integer.parseInt(widthField.getText());
@@ -181,11 +181,15 @@
mediator.fireSettingsChanged();
}
}
+
+ public void focusGained(FocusEvent fe) {
+ widthField.setSelectionStart(0);
+ widthField.setSelectionEnd(Integer.MAX_VALUE);
+ }
});
- heightField.addFocusListener(new FocusAdapter() {
+ heightField.addFocusListener(new FocusListener() {
- @Override
public void focusLost(FocusEvent arg0) {
try {
int oldHeight = document.getHeight();
@@ -201,6 +205,11 @@
mediator.fireSettingsChanged();
}
}
+
+ public void focusGained(FocusEvent fe) {
+ heightField.setSelectionStart(0);
+ heightField.setSelectionEnd(Integer.MAX_VALUE);
+ }
});
tweenFramesField.addFocusListener(new FocusAdapter() {
@@ -245,6 +254,14 @@
}
});
+ tweenFramesField.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusGained(FocusEvent fe) {
+ tweenFramesField.setSelectionStart(0);
+ tweenFramesField.setSelectionEnd(Integer.MAX_VALUE);
+ }
+ });
+
testButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
JTestFrame tf = new JTestFrame();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-02-14 04:58:29
|
Revision: 181
http://patchanim.svn.sourceforge.net/patchanim/?rev=181&view=rev
Author: dbrosius
Date: 2008-02-13 20:58:33 -0800 (Wed, 13 Feb 2008)
Log Message:
-----------
add a custom JFrame icon
Modified Paths:
--------------
trunk/patchanim/build.xml
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java
Added Paths:
-----------
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/patchanimicon.jpg
Modified: trunk/patchanim/build.xml
===================================================================
--- trunk/patchanim/build.xml 2008-02-12 21:27:15 UTC (rev 180)
+++ trunk/patchanim/build.xml 2008-02-14 04:58:33 UTC (rev 181)
@@ -80,6 +80,7 @@
<include name="**/*.gif"/>
<include name="**/*.xsd"/>
<include name="**/*.xsl"/>
+ <include name="**/*.jpg"/>
</fileset>
</copy>
<echo message="${patchanim.version}" file="${classes.dir}/com/mebigfatguy/patchanim/io/Version.txt"/>
@@ -106,6 +107,7 @@
<include name="**/*.xsd"/>
<include name="**/*.xsl"/>
<include name="**/*.txt"/>
+ <include name="**/*.jpg"/>
</fileset>
<fileset dir="${basedir}">
<include name="license.txt"/>
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-02-12 21:27:15 UTC (rev 180)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-02-14 04:58:33 UTC (rev 181)
@@ -29,6 +29,7 @@
import java.io.IOException;
import java.util.ResourceBundle;
+import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JMenu;
@@ -52,6 +53,7 @@
public class JPatchAnimFrame extends JFrame {
private static final long serialVersionUID = -4610407923936772733L;
+ private static final String ICON_URL = "/com/mebigfatguy/patchanim/gui/patchanimicon.jpg";
private JMenuItem newItem;
private JMenuItem openItem;
@@ -87,6 +89,8 @@
cp.add(patchPanel, BorderLayout.CENTER);
setTitle(rb.getString(PatchAnimBundle.TITLE));
+
+ setIconImage(new ImageIcon(JPatchAnimFrame.class.getResource(ICON_URL)).getImage());
pack();
}
Added: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/patchanimicon.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/patchanimicon.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|