Thread: [Patchanim-commit] SF.net SVN: patchanim:[252] trunk/patchanim/src/com/mebigfatguy/patchanim
Brought to you by:
dbrosius
From: <dbr...@us...> - 2008-12-25 18:12:35
|
Revision: 252 http://patchanim.svn.sourceforge.net/patchanim/?rev=252&view=rev Author: dbrosius Date: 2008-12-25 18:12:33 +0000 (Thu, 25 Dec 2008) Log Message: ----------- add TweenStyle setting (not impled yet) Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.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 Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java 2008-12-25 18:00:20 UTC (rev 251) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java 2008-12-25 18:12:33 UTC (rev 252) @@ -32,14 +32,15 @@ private static final long serialVersionUID = -7412254429829665944L; private boolean dirty; - private int order; - private boolean useAlpha; + private final int order; + private final boolean useAlpha; private List<CombinedPatch> patches; private int width; private int height; private AnimationType animationType; private OutOfBoundsColor outOfBoundsColor; private int tweenCount; + private TweenStyle tweenStyle; /** * constructs a new document for the New menu item @@ -55,6 +56,7 @@ animationType = AnimationType.Wave; outOfBoundsColor = OutOfBoundsColor.Clip; tweenCount = 10; + tweenStyle = TweenStyle.Linear; } /** @@ -184,4 +186,20 @@ public void setTweenCount(int tweenCount) { this.tweenCount = tweenCount; } + + /** + * gets the algorithm used to tween between one patch and another + * @return the tween algorithm + */ + public TweenStyle getTweenStyle() { + return tweenStyle; + } + + /** + * sets the algorithm used to tween between one patch and another + * @param tweenStyle the tween algorithm + */ + public void setTweenStyle(TweenStyle tweenStyle) { + this.tweenStyle = tweenStyle; + } } Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java 2008-12-25 18:00:20 UTC (rev 251) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java 2008-12-25 18:12:33 UTC (rev 252) @@ -33,7 +33,7 @@ Linear, Radial; - private static final String TWEEN = "tween."; + private static final String TWEEN = "tweenstyle."; /** * returns the localized value of the enum * @return the localized display value Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java 2008-12-25 18:00:20 UTC (rev 251) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java 2008-12-25 18:12:33 UTC (rev 252) @@ -42,6 +42,7 @@ import com.mebigfatguy.patchanim.AnimationType; import com.mebigfatguy.patchanim.OutOfBoundsColor; import com.mebigfatguy.patchanim.PatchAnimDocument; +import com.mebigfatguy.patchanim.TweenStyle; import com.mebigfatguy.patchanim.gui.events.DocumentChangedEvent; import com.mebigfatguy.patchanim.gui.events.DocumentChangedListener; import com.mebigfatguy.patchanim.main.PatchAnimBundle; @@ -56,6 +57,7 @@ private JComboBox animationCB; private JComboBox outOfBoundsColorCB; private JTextField tweenFramesField; + private JComboBox tweenStyleCB; private JButton testButton; public JPatchControlPanel() { @@ -73,6 +75,7 @@ JLabel animationLabel; JLabel outOfBoundsLabel; JLabel tweenFramesLabel; + JLabel tweenStyleLabel; { widthLabel = new JLabel(rb.getString(PatchAnimBundle.WIDTH)); @@ -132,13 +135,23 @@ add(p); } add(Box.createVerticalStrut(5)); + { + tweenStyleLabel = new JLabel(rb.getString(PatchAnimBundle.TWEENSTYLE)); + tweenStyleCB = new JComboBox(new Object[] { TweenStyle.Linear, + TweenStyle.Radial }); + tweenStyleCB.setToolTipText(rb.getString(PatchAnimBundle.TWEENSTYLE_TT)); + outOfBoundsLabel.setLabelFor(tweenStyleCB); + JPanel p = Utils.createFormPanel(tweenStyleLabel, tweenStyleCB); + Utils.limitPanelHeight(p, tweenStyleCB); + add(p); + } testButton = new JButton(rb.getString(PatchAnimBundle.TEST)); testButton.setToolTipText(rb.getString(PatchAnimBundle.TEST_TT)); add(testButton); - Utils.sizeUniformly(Utils.Sizing.Both, widthLabel, heightLabel, animationLabel, outOfBoundsLabel, tweenFramesLabel); - Utils.sizeUniformly(Utils.Sizing.Width, new JComponent[] { widthField, heightField, animationCB, outOfBoundsColorCB, tweenFramesField }); + Utils.sizeUniformly(Utils.Sizing.Both, widthLabel, heightLabel, animationLabel, outOfBoundsLabel, tweenFramesLabel, tweenStyleLabel); + Utils.sizeUniformly(Utils.Sizing.Width, new JComponent[] { widthField, heightField, animationCB, outOfBoundsColorCB, tweenFramesField, tweenStyleCB }); add(Box.createVerticalGlue()); @@ -160,6 +173,7 @@ animationCB.setSelectedIndex(document.getAnimationType().ordinal()); outOfBoundsColorCB.setSelectedIndex(document.getOutOfBoundsColor().ordinal()); tweenFramesField.setText(String.valueOf(document.getTweenCount())); + tweenStyleCB.setSelectedIndex(document.getTweenStyle().ordinal()); } }); } @@ -263,6 +277,17 @@ } }); + tweenStyleCB.addItemListener(new ItemListener() { + + public void itemStateChanged(ItemEvent ie) { + if (ie.getStateChange() == ItemEvent.SELECTED) { + document.setTweenStyle((TweenStyle)ie.getItem()); + PatchPanelMediator mediator = PatchPanelMediator.getMediator(); + mediator.fireSettingsChanged(); + } + } + }); + testButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { JTestFrame tf = new JTestFrame(); Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd 2008-12-25 18:00:20 UTC (rev 251) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd 2008-12-25 18:12:33 UTC (rev 252) @@ -34,6 +34,7 @@ <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"/> + <xsd:attribute name="tweenStyle" type="xsd:TweenStyleClass" use="required"/> </xsd:complexType> <xsd:simpleType name="AnimationTypeClass"> <xsd:restriction base="xsd:string"> @@ -57,6 +58,12 @@ <xsd:enumeration value="Alpha"/> </xsd:restriction> </xsd:simpleType> + <xsd:simpleType name="TweenStyleClass"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="Linear"/> + <xsd:enumeration value="Radial"/> + </xsd:restriction> + </xsd:simpleType> <xsd:complexType name="CoordinateClass"> <xsd:attribute name="color" type="xsd:double" use="required"/> <xsd:attribute name="x" type="xsd:double" use="required"/> Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsl =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsl 2008-12-25 18:00:20 UTC (rev 251) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsl 2008-12-25 18:12:33 UTC (rev 252) @@ -58,6 +58,9 @@ <xsl:attribute name="tweenCount"> <xsl:value-of select="pae:getTweenCount($ext)"/> </xsl:attribute> + <xsl:attribute name="tweenStyle"> + <xsl:value-of select="pae:getTweenStyle($ext)"/> + </xsl:attribute> </Settings> <Patches> <xsl:for-each select="pae:getPatches($ext)"> Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java 2008-12-25 18:00:20 UTC (rev 251) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java 2008-12-25 18:12:33 UTC (rev 252) @@ -37,8 +37,8 @@ public class PatchAnimExtension { private static final String VERSION_URL = "/com/mebigfatguy/patchanim/io/Version.txt"; - private PatchAnimDocument paDoc; - private Document d; + private final PatchAnimDocument paDoc; + private final Document d; public PatchAnimExtension(PatchAnimDocument doc) throws ParserConfigurationException { paDoc = doc; @@ -82,6 +82,10 @@ public String getTweenCount(@SuppressWarnings("unused") ExpressionContext context) { return String.valueOf(paDoc.getTweenCount()); } + + public String getTweenStyle(@SuppressWarnings("unused") ExpressionContext context) { + return String.valueOf(paDoc.getTweenStyle()); + } public String useAlpha(@SuppressWarnings("unused") ExpressionContext context) { return String.valueOf(paDoc.useAlpha()); Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2008-12-25 18:00:20 UTC (rev 251) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2008-12-25 18:12:33 UTC (rev 252) @@ -46,6 +46,7 @@ import com.mebigfatguy.patchanim.OutOfBoundsColor; import com.mebigfatguy.patchanim.PatchAnimDocument; import com.mebigfatguy.patchanim.PatchColor; +import com.mebigfatguy.patchanim.TweenStyle; import com.mebigfatguy.patchanim.surface.CombinedPatch; import com.mebigfatguy.patchanim.surface.Coordinate; import com.mebigfatguy.patchanim.surface.PatchCoords; @@ -121,6 +122,7 @@ private static final String ANIMATIONTYPE = "animationType"; private static final String OUTOFBOUNDSCOLOR = "outOfBoundsColor"; private static final String TWEENCOUNT = "tweenCount"; + private static final String TWEENSTYLE = "tweenStyle"; private static final String COMBINEDPATCH = "CombinedPatch"; private static final String PATCH = "Patch"; private static final String COLOR = "color"; @@ -147,6 +149,7 @@ 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))); + doc.setTweenStyle(TweenStyle.valueOf(TweenStyle.class, atts.getValue(TWEENSTYLE))); } else if (COMBINEDPATCH.equals(localName)) { cPatch = new CombinedPatch(doc.getOrder(), false); } else if (PATCH.equals(localName)) { Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-12-25 18:00:20 UTC (rev 251) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-12-25 18:12:33 UTC (rev 252) @@ -70,6 +70,8 @@ public static final String OOBWAVE = "patchanim.oob.wave"; public static final String TWEENFRAMES = "patchanim.tween"; public static final String TWEENFRAMES_TT = "patchanim.tooltip.tween"; + public static final String TWEENSTYLE = "patchanim.tweenstyle"; + public static final String TWEENSTYLE_TT = "patchanim.tooltip.tweenstyle"; public static final String TEST = "patchanim.test"; public static final String TEST_TT = "patchanim.tooltip.test"; public static final String STOP = "patchanim.stop"; Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-12-25 18:00:20 UTC (rev 251) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-12-25 18:12:33 UTC (rev 252) @@ -63,6 +63,10 @@ patchanim.oob.wave = Wave patchanim.tween = In-between frames patchanim.tooltip.tween = How many frames are generated as transitions from one patch to the next +patchanim.tweenstyle = Tween Style +patchanim.tooltip.tweenstyle = The algorithm used to transition from one patch to another +patchanim.tweenstyle.linear = Linear +patchanim.tweenstyle.radial = Radial patchanim.test = Test patchanim.tooltip.test = Test the animation using the export settings patchanim.stop = Stop This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-12-25 18:52:31
|
Revision: 257 http://patchanim.svn.sourceforge.net/patchanim/?rev=257&view=rev Author: dbrosius Date: 2008-12-25 18:52:27 +0000 (Thu, 25 Dec 2008) Log Message: ----------- add reset grid menu item Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java 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 trunk/patchanim/src/com/mebigfatguy/patchanim/surface/Coordinate.java trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchCoords.java Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java 2008-12-25 18:40:04 UTC (rev 256) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java 2008-12-25 18:52:27 UTC (rev 257) @@ -196,7 +196,7 @@ if ((xDeltaSq + yDeltaSq) > MINDRAGDISTANCESQ) { c.setX(inputX); - c.sety(inputY); + c.setY(inputY); return true; } Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java 2008-12-25 18:40:04 UTC (rev 256) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java 2008-12-25 18:52:27 UTC (rev 257) @@ -61,13 +61,13 @@ private static final long serialVersionUID = 8057501623261814175L; private static final int SAMPLE_SIZE = 200; - private PatchColor color; + private final PatchColor color; private Color rgb; private OutOfBoundsColor oob; private transient BufferedImage image; private PatchDecorator decorator; private transient Thread redrawThread = null; - private Object redrawLock = new Object(); + private final Object redrawLock = new Object(); private boolean redrawing = false; private boolean dragging = false; @@ -385,6 +385,18 @@ } menu.add(copy); + + JMenuItem resetGrid = new JMenuItem(rb.getString(PatchAnimBundle.RESETGRID)); + resetGrid.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + PatchPanelMediator mediator = PatchPanelMediator.getMediator(); + PatchCoords coords = mediator.getActivePatch().getPatch(color); + coords.resetSpatialCoordinates(); + redraw(); + } + }); + menu.add(resetGrid); + menu.show(JPatchSamplePanel.this, me.getX(), me.getY()); } @@ -500,11 +512,11 @@ Coordinate c = coords.getCoordinate(i, j); switch (direction) { case Outward: - color = (double)(int)((255.0 * Math.abs(i - midOrder) * Math.abs(j - midOrder)) / midOrderSq); + color = (int)((255.0 * Math.abs(i - midOrder) * Math.abs(j - midOrder)) / midOrderSq); break; case Inward: - color = (double)(int)(255.0 - (255.0 * (Math.abs(i - midOrder) * Math.abs(j - midOrder))) / midOrderSq); + color = (int)(255.0 - (255.0 * (Math.abs(i - midOrder) * Math.abs(j - midOrder))) / midOrderSq); break; } Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-12-25 18:40:04 UTC (rev 256) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-12-25 18:52:27 UTC (rev 257) @@ -106,6 +106,7 @@ public static final String REDPATCH = "patchanim.redpatch"; public static final String GREENPATCH = "patchanim.greenpatch"; public static final String BLUEPATCH = "patchanim.bluepatch"; + public static final String RESETGRID = "patchanim.resetgrid"; public static final String ASKSAVE = "patchanim.asksave"; public static final String LOADFAILED = "patchanim.err.loadfailed"; public static final String SAVEFAILED = "patchanim.err.savefailed"; Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-12-25 18:40:04 UTC (rev 256) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-12-25 18:52:27 UTC (rev 257) @@ -101,6 +101,7 @@ patchanim.redpatch = Red Patch patchanim.greenpatch = Green Patch patchanim.bluepatch = Blue Patch +patchanim.resetgrid = Reset Grid patchanim.asksave = Do you want to save your changes? patchanim.err.savefailed = Failed saving Patch Animation File patchanim.err.loadfailed = Failed loading Patch Animation File Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/Coordinate.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/surface/Coordinate.java 2008-12-25 18:40:04 UTC (rev 256) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/surface/Coordinate.java 2008-12-25 18:52:27 UTC (rev 257) @@ -53,7 +53,7 @@ return y; } - public void sety(double yPos) { + public void setY(double yPos) { y = yPos; } Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchCoords.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchCoords.java 2008-12-25 18:40:04 UTC (rev 256) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchCoords.java 2008-12-25 18:52:27 UTC (rev 257) @@ -125,7 +125,17 @@ public void setCoordinate(int i, int j, Coordinate coordinate) { coords[i][j] = coordinate; } + + public void resetSpatialCoordinates() { + for (int u = 0; u < order; u++) { + for (int v = 0; v < order; v++) { + coords[u][v].setX((u * 100.0) / (order - 1)); + coords[u][v].setY((v * 100.0) / (order - 1)); + } + } + } + @Override public String toString() { return Arrays.toString(coords); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-12-25 23:39:07
|
Revision: 259 http://patchanim.svn.sourceforge.net/patchanim/?rev=259&view=rev Author: dbrosius Date: 2008-12-25 23:38:58 +0000 (Thu, 25 Dec 2008) Log Message: ----------- bummer, radial ain't gonna work, so there's no point in moving ctrl points in x,y 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-12-25 20:20:43 UTC (rev 258) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java 2008-12-25 23:38:58 UTC (rev 259) @@ -28,7 +28,6 @@ import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.awt.event.MouseMotionAdapter; import java.awt.image.BufferedImage; import java.util.ResourceBundle; @@ -122,17 +121,17 @@ } }); - addMouseMotionListener(new MouseMotionAdapter() { - @Override - public void mouseDragged(MouseEvent me) { - if ((decorator != null) && dragging) - if (decorator.drag(me.getPoint(), JPatchSamplePanel.this.getBounds())) { - PatchPanelMediator mediator = PatchPanelMediator.getMediator(); - CombinedPatch currentPatch = mediator.getActivePatch(); - recalcImage(color, currentPatch); - } - } - }); +// addMouseMotionListener(new MouseMotionAdapter() { +// @Override +// public void mouseDragged(MouseEvent me) { +// if ((decorator != null) && dragging) +// if (decorator.drag(me.getPoint(), JPatchSamplePanel.this.getBounds())) { +// PatchPanelMediator mediator = PatchPanelMediator.getMediator(); +// CombinedPatch currentPatch = mediator.getActivePatch(); +// recalcImage(color, currentPatch); +// } +// } +// }); PatchPanelMediator mediator = PatchPanelMediator.getMediator(); mediator.addActivePatchChangedListener(new ActivePatchChangedListener() { @@ -386,17 +385,6 @@ menu.add(copy); - JMenuItem resetGrid = new JMenuItem(rb.getString(PatchAnimBundle.RESETGRID)); - resetGrid.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - PatchPanelMediator mediator = PatchPanelMediator.getMediator(); - PatchCoords coords = mediator.getActivePatch().getPatch(color); - coords.resetSpatialCoordinates(); - redraw(); - } - }); - menu.add(resetGrid); - menu.show(JPatchSamplePanel.this, me.getX(), me.getY()); } Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-12-25 20:20:43 UTC (rev 258) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-12-25 23:38:58 UTC (rev 259) @@ -106,7 +106,6 @@ public static final String REDPATCH = "patchanim.redpatch"; public static final String GREENPATCH = "patchanim.greenpatch"; public static final String BLUEPATCH = "patchanim.bluepatch"; - public static final String RESETGRID = "patchanim.resetgrid"; public static final String ASKSAVE = "patchanim.asksave"; public static final String LOADFAILED = "patchanim.err.loadfailed"; public static final String SAVEFAILED = "patchanim.err.savefailed"; Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-12-25 20:20:43 UTC (rev 258) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-12-25 23:38:58 UTC (rev 259) @@ -101,7 +101,6 @@ patchanim.redpatch = Red Patch patchanim.greenpatch = Green Patch patchanim.bluepatch = Blue Patch -patchanim.resetgrid = Reset Grid patchanim.asksave = Do you want to save your changes? patchanim.err.savefailed = Failed saving Patch Animation File patchanim.err.loadfailed = Failed loading Patch Animation File This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-12-26 00:03:12
|
Revision: 260 http://patchanim.svn.sourceforge.net/patchanim/?rev=260&view=rev Author: dbrosius Date: 2008-12-26 00:03:08 +0000 (Fri, 26 Dec 2008) Log Message: ----------- switch TweenStyle to a set of transformation functions on the 0->1 tween fraction Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchCoords.java Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java 2008-12-25 23:38:58 UTC (rev 259) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java 2008-12-26 00:03:08 UTC (rev 260) @@ -18,6 +18,7 @@ */ package com.mebigfatguy.patchanim; +import java.awt.Point; import java.util.ResourceBundle; import com.mebigfatguy.patchanim.main.PatchAnimBundle; @@ -25,15 +26,34 @@ /** * denotes the algorithm to use to tween two patches * <ul> - * <li><b>Linear</b> Control points are tweened linearly</li> - * <li><b>Radial</b> Control points are tweened radially</li> + * <li><b>Linear</b> Control points are tweened linearly from start to finish</li> + * <li><b>Accelerating</b> Control points are tweened accelerating from start to finish</li> + * <li><b>Decelerating</b> Control points are tweened decelerating from start to finish</li> + * <li><b>EaseInEaseOut</b> Control points are tweened eased in from start, then eased out to finish</li> + * <li><b>Accelerating</b> Control points are tweened accelerating in from start and then accelerated out to finish</li> + * <li><b>Accelerating</b> Control points are tweened waved from start to finish</li> * </ul> */ public enum TweenStyle { - Linear, - Radial; + Linear(new Point(0, 0), new Point(0, 0), new Point(100, 100), new Point(100, 100)), + Accelerating(new Point(0, 0), new Point(100, 0), new Point(100, 100), new Point(100, 100)), + Decelerating(new Point(0, 0), new Point(0, 100), new Point(100, 100), new Point(100, 100)), + EaseInEaseOut(new Point(0, 0), new Point(50, 0), new Point(50, 100), new Point(100, 100)), + AccelerateInAccelerateOut(new Point(0, 0), new Point(0, 50), new Point(100, 50), new Point(100, 100)), + Wave(new Point(0, 0), new Point(0, 200), new Point(100, -200), new Point(100, 100)); private static final String TWEEN = "tweenstyle."; + + private Point[] points; + + private TweenStyle(Point... pts) { + points = pts; + } + + public double transform(double frac) { + return frac; + } + /** * returns the localized value of the enum * @return the localized display value Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java 2008-12-25 23:38:58 UTC (rev 259) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java 2008-12-26 00:03:08 UTC (rev 260) @@ -26,6 +26,7 @@ import java.awt.event.FocusListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import java.util.EnumSet; import java.util.ResourceBundle; import javax.swing.BorderFactory; @@ -137,8 +138,8 @@ add(Box.createVerticalStrut(5)); { tweenStyleLabel = new JLabel(rb.getString(PatchAnimBundle.TWEENSTYLE)); - tweenStyleCB = new JComboBox(new Object[] { TweenStyle.Linear, - TweenStyle.Radial }); + EnumSet<TweenStyle> ts = EnumSet.<TweenStyle>allOf(TweenStyle.class); + tweenStyleCB = new JComboBox(ts.toArray(new TweenStyle[ts.size()])); tweenStyleCB.setToolTipText(rb.getString(PatchAnimBundle.TWEENSTYLE_TT)); outOfBoundsLabel.setLabelFor(tweenStyleCB); JPanel p = Utils.createFormPanel(tweenStyleLabel, tweenStyleCB); Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-12-25 23:38:58 UTC (rev 259) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-12-26 00:03:08 UTC (rev 260) @@ -66,7 +66,11 @@ patchanim.tweenstyle = Tween Style patchanim.tooltip.tweenstyle = The algorithm used to transition from one patch to another patchanim.tweenstyle.linear = Linear -patchanim.tweenstyle.radial = Radial +patchanim.tweenstyle.accelerating = Accelerating +patchanim.tweenstyle.decelerating = Decelerating +patchanim.tweenstyle.easeineaseout = Ease In/Ease Out +patchanim.tweenstyle.accelerateinaccelerateout = Accelerate In/Accelerate Out +patchanim.tweenstyle.wave = Wave patchanim.test = Test patchanim.tooltip.test = Test the animation using the export settings patchanim.stop = Stop Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchCoords.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchCoords.java 2008-12-25 23:38:58 UTC (rev 259) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchCoords.java 2008-12-26 00:03:08 UTC (rev 260) @@ -84,38 +84,15 @@ public static PatchCoords tween(PatchCoords startCoords, PatchCoords endCoords, TweenStyle tweenStyle, double frac) { PatchCoords tweenCoords = new PatchCoords(startCoords.getOrder()); - switch (tweenStyle) { - case Linear: - 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); - double startX = startC.getX(); - double startY = startC.getY(); - double startColor = startC.getColor(); - double tweenX = (startX + (endC.getX() - startX) * frac); - double tweenY = (startY + (endC.getY() - startY) * frac); - int tweenColor = (int)(startColor + (endC.getColor() - startColor) * frac); - Coordinate tweenC = new Coordinate(tweenX, tweenY, tweenColor); - tweenCoords.setCoordinate(x, y, tweenC); - } - } - break; - - case Radial: - /* this is completely bogus right now, just to fool 'em, till we fix stuff elsewhere */ - 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); - double[] startVector = new double[] { startC.getX(), startC.getY(), startC.getColor() }; - double[] endVector = new double[] { endC.getX(), endC.getY(), endC.getColor() }; - double ran = Math.random(); - Coordinate tweenC = new Coordinate(startVector[0], endVector[1], startVector[2] * ran + endVector[2] * (1 - ran)); - tweenCoords.setCoordinate(x, y, tweenC); - } - } - break; + 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); + double startColor = startC.getColor(); + int tweenColor = (int)(startColor + (endC.getColor() - startColor) * tweenStyle.transform(frac)); + Coordinate tweenC = new Coordinate(startC.getX(), startC.getY(), tweenColor); + tweenCoords.setCoordinate(x, y, tweenC); + } } return tweenCoords; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-12-26 01:52:55
|
Revision: 262 http://patchanim.svn.sourceforge.net/patchanim/?rev=262&view=rev Author: dbrosius Date: 2008-12-26 01:52:53 +0000 (Fri, 26 Dec 2008) Log Message: ----------- put in tween algos Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java 2008-12-26 00:14:24 UTC (rev 261) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java 2008-12-26 01:52:53 UTC (rev 262) @@ -22,6 +22,7 @@ import java.util.ResourceBundle; import com.mebigfatguy.patchanim.main.PatchAnimBundle; +import com.mebigfatguy.patchanim.surface.PatchGenerator; /** * denotes the algorithm to use to tween two patches @@ -45,13 +46,20 @@ private static final String TWEEN = "tweenstyle."; private Point[] points; + private double[] coeffs; private TweenStyle(Point... pts) { points = pts; + coeffs = new double[4]; } public double transform(double frac) { - return frac; + PatchGenerator.buildCoefficients(frac, coeffs); + double out = 0.0; + for (int i = 0; i < 4; i++) { + out += coeffs[i] * (points[i].y / 100.0); + } + return out; } /** Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java 2008-12-26 00:14:24 UTC (rev 261) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java 2008-12-26 01:52:53 UTC (rev 262) @@ -199,7 +199,7 @@ return image; } - private static void buildCoefficients(double t, double[] coeffs) { + public static void buildCoefficients(double t, double[] coeffs) { double tt = 1.0; for (int i = 0; i < coeffs.length; i++) { coeffs[i] = tt; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-12-26 05:32:41
|
Revision: 264 http://patchanim.svn.sourceforge.net/patchanim/?rev=264&view=rev Author: dbrosius Date: 2008-12-26 05:32:38 +0000 (Fri, 26 Dec 2008) Log Message: ----------- fix comment Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/AnimationType.java trunk/patchanim/src/com/mebigfatguy/patchanim/BlendDirection.java trunk/patchanim/src/com/mebigfatguy/patchanim/ExportType.java trunk/patchanim/src/com/mebigfatguy/patchanim/OutOfBoundsColor.java trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java trunk/patchanim/src/com/mebigfatguy/patchanim/PatchColor.java trunk/patchanim/src/com/mebigfatguy/patchanim/ShiftDirection.java trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java trunk/patchanim/src/com/mebigfatguy/patchanim/gui/DoubleDocument.java trunk/patchanim/src/com/mebigfatguy/patchanim/gui/ExportFrame.java trunk/patchanim/src/com/mebigfatguy/patchanim/gui/IntegerDocument.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/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/JPatchSamplePanel.java trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java trunk/patchanim/src/com/mebigfatguy/patchanim/gui/NewDocumentDialog.java trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchAnimFileFilter.java trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchDecorator.java trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchListModel.java trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchPanelMediator.java trunk/patchanim/src/com/mebigfatguy/patchanim/gui/SourcePatchesPanel.java trunk/patchanim/src/com/mebigfatguy/patchanim/gui/Utils.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/Coordinate.java trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchAnimator.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/AnimationType.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/AnimationType.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/AnimationType.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/BlendDirection.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/BlendDirection.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/BlendDirection.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/ExportType.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/ExportType.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/ExportType.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/OutOfBoundsColor.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/OutOfBoundsColor.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/OutOfBoundsColor.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/PatchColor.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/PatchColor.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/PatchColor.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/ShiftDirection.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/ShiftDirection.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/ShiftDirection.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or @@ -57,7 +57,7 @@ PatchGenerator.buildCoefficients(frac, coeffs); double out = 0.0; for (int i = 0; i < 4; i++) { - out += coeffs[i] * (points[i].y / 100.0); + out += coeffs[i] * points[i].y / 100; } return out; } Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/DoubleDocument.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/DoubleDocument.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/DoubleDocument.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/ExportFrame.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/ExportFrame.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/ExportFrame.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/IntegerDocument.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/IntegerDocument.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/IntegerDocument.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimPanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimPanel.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimPanel.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/NewDocumentDialog.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/NewDocumentDialog.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/NewDocumentDialog.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchAnimFileFilter.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchAnimFileFilter.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchAnimFileFilter.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchDecorator.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchDecorator.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchDecorator.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchListModel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchListModel.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchListModel.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchPanelMediator.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchPanelMediator.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchPanelMediator.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/SourcePatchesPanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/SourcePatchesPanel.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/SourcePatchesPanel.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/Utils.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/Utils.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/Utils.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd 2008-12-26 05:32:38 UTC (rev 264) @@ -1,6 +1,6 @@ <!-- /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsl =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsl 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsl 2008-12-26 05:32:38 UTC (rev 264) @@ -1,6 +1,6 @@ <!-- /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/CombinedPatch.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/surface/CombinedPatch.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/surface/CombinedPatch.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/Coordinate.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/surface/Coordinate.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/surface/Coordinate.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchAnimator.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchAnimator.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchAnimator.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchCoords.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchCoords.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchCoords.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java 2008-12-26 05:22:15 UTC (rev 263) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java 2008-12-26 05:32:38 UTC (rev 264) @@ -1,5 +1,5 @@ /* - * patchanim - A bezier surface patch color blend gif builder + * patchanim - A bezier surface patch color blend animation builder * Copyright (C) 2008 Dave Brosius * * This library is free software; you can redistribute it and/or This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-12-28 07:46:04
|
Revision: 274 http://patchanim.svn.sourceforge.net/patchanim/?rev=274&view=rev Author: dbrosius Date: 2008-12-28 07:46:02 +0000 (Sun, 28 Dec 2008) Log Message: ----------- fix problem where user deletes patch while test animating. Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.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-12-28 07:01:27 UTC (rev 273) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java 2008-12-28 07:46:02 UTC (rev 274) @@ -61,14 +61,19 @@ animThread = new Thread(new Runnable() { public void run() { - try { - PatchAnimator animator = new PatchAnimator(document); - animator.addPatchCompletionListener(JTestFrame.this); - AnimationType type = document.getAnimationType(); - while (type != AnimationType.None) + AnimationType type = document.getAnimationType(); + do { + try { + PatchAnimator animator = new PatchAnimator(document); + animator.addPatchCompletionListener(JTestFrame.this); animator.animatePatches(); - } catch (InterruptedException ie) { - } + animator.removePatchCompletionListener(JTestFrame.this); + } catch (InterruptedException ie) { + break; + } catch (Exception e) { + //Could get OutOfBoundsException if user deletes patches mid animation + } + } while (type != AnimationType.None); } }); animThread.start(); Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchAnimator.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchAnimator.java 2008-12-28 07:01:27 UTC (rev 273) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchAnimator.java 2008-12-28 07:46:02 UTC (rev 274) @@ -40,9 +40,17 @@ } public void addPatchCompletionListener(PatchCompletionListener listener) { - pcListeners.add(listener); + synchronized(pcListeners) { + pcListeners.add(listener); + } } + public void removePatchCompletionListener(PatchCompletionListener listener) { + synchronized(pcListeners) { + pcListeners.remove(listener); + } + } + public void animatePatches() throws InterruptedException { BufferedImage image = PatchGenerator.buildImage(null, document.useAlpha(), document.getWidth(), document.getHeight()); List<CombinedPatch> patches = document.getPatches(); @@ -105,7 +113,12 @@ private void firePatchCompleted(BufferedImage image) throws InterruptedException { PatchCompletionEvent pce = new PatchCompletionEvent(this, image); - for (PatchCompletionListener listener : pcListeners) { + Set<PatchCompletionListener> listeners; + synchronized(pcListeners) { + listeners = new HashSet<PatchCompletionListener>(pcListeners); + } + + for (PatchCompletionListener listener : listeners) { listener.patchCompleted(pce); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-01-04 22:27:22
|
Revision: 280 http://patchanim.svn.sourceforge.net/patchanim/?rev=280&view=rev Author: dbrosius Date: 2009-01-04 22:27:17 +0000 (Sun, 04 Jan 2009) Log Message: ----------- add set all border points menu option 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 2009-01-02 06:02:58 UTC (rev 279) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java 2009-01-04 22:27:17 UTC (rev 280) @@ -68,7 +68,7 @@ private transient Thread redrawThread = null; private final Object redrawLock = new Object(); private boolean redrawing = false; - private boolean dragging = false; + private boolean dragging = false; public JPatchSamplePanel(PatchColor c) { color = c; @@ -108,16 +108,16 @@ public void mousePressed(MouseEvent me) { if ((color != PatchColor.Combined) && me.isPopupTrigger()) showPatchContentMenu(me); - else if (decorator != null) { - dragging = decorator.press(me.getPoint(), JPatchSamplePanel.this.getBounds()); - } + else if (decorator != null) { + dragging = decorator.press(me.getPoint(), JPatchSamplePanel.this.getBounds()); + } } @Override public void mouseReleased(MouseEvent me) { if ((color != PatchColor.Combined) && me.isPopupTrigger()) showPatchContentMenu(me); - dragging = false; + dragging = false; } }); @@ -214,34 +214,70 @@ JPopupMenu menu = new JPopupMenu(); JMenu setAllItem = new JMenu(rb.getString(PatchAnimBundle.SETALLPOINTS)); menu.add(setAllItem); - JMenuItem blackItem = new JMenuItem(rb.getString(PatchAnimBundle.BLACK)); - blackItem.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent ae) { - setAllPts(0.0); - } - }); - setAllItem.add(blackItem); - JMenuItem fullColorItem = new JMenuItem(rb.getString(PatchAnimBundle.FULLCOLOR)); - fullColorItem.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent ae) { - setAllPts(255.0); - } - }); + { + JMenuItem blackItem = new JMenuItem(rb.getString(PatchAnimBundle.BLACK)); + blackItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + setAllPts(0.0); + } + }); + setAllItem.add(blackItem); + + JMenuItem fullColorItem = new JMenuItem(rb.getString(PatchAnimBundle.FULLCOLOR)); + fullColorItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + setAllPts(255.0); + } + }); + setAllItem.add(fullColorItem); + + JMenuItem valueItem = new JMenuItem(rb.getString(PatchAnimBundle.VALUE)); + valueItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + String value = JOptionPane.showInputDialog(JPatchSamplePanel.this, rb.getString(PatchAnimBundle.VALUE), "128"); + try { + if (value != null) + setAllPts(Double.parseDouble(value)); + } catch (NumberFormatException nfe) { + } + } + }); + setAllItem.add(valueItem); + } - setAllItem.add(fullColorItem); - JMenuItem valueItem = new JMenuItem(rb.getString(PatchAnimBundle.VALUE)); - valueItem.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent ae) { - String value = JOptionPane.showInputDialog(JPatchSamplePanel.this, rb.getString(PatchAnimBundle.VALUE), "128"); - try { - if (value != null) - setAllPts(Double.parseDouble(value)); - } catch (NumberFormatException nfe) { + JMenu borderItem = new JMenu(rb.getString(PatchAnimBundle.SETBORDERPOINTS)); + menu.add(borderItem); + { + JMenuItem blackItem = new JMenuItem(rb.getString(PatchAnimBundle.BLACK)); + blackItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + setAllBorderPts(0.0); } - } - }); + }); + borderItem.add(blackItem); + + JMenuItem fullColorItem = new JMenuItem(rb.getString(PatchAnimBundle.FULLCOLOR)); + fullColorItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + setAllBorderPts(255.0); + } + }); + borderItem.add(fullColorItem); + + JMenuItem valueItem = new JMenuItem(rb.getString(PatchAnimBundle.VALUE)); + valueItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + String value = JOptionPane.showInputDialog(JPatchSamplePanel.this, rb.getString(PatchAnimBundle.VALUE), "128"); + try { + if (value != null) + setAllBorderPts(Double.parseDouble(value)); + } catch (NumberFormatException nfe) { + } + } + }); + borderItem.add(valueItem); + } - setAllItem.add(valueItem); JMenuItem lightenPatch = new JMenuItem(rb.getString(PatchAnimBundle.LIGHTENPATCH)); lightenPatch.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { @@ -471,6 +507,28 @@ mediator.setNewActivePatch(patch); } + private void setAllBorderPts(double d) { + PatchPanelMediator mediator = PatchPanelMediator.getMediator(); + CombinedPatch patch = mediator.getActivePatch(); + PatchCoords coords = patch.getPatch(color); + int order = coords.getOrder(); + for (int k = 0; k < order; k++) { + Coordinate c = coords.getCoordinate(k, 0); + c.setColor(d); + coords.setCoordinate(k, 0, c); + c = coords.getCoordinate(0, k); + c.setColor(d); + coords.setCoordinate(0, k, c); + c = coords.getCoordinate(k, order-1); + c.setColor(d); + coords.setCoordinate(k, order-1, c); + c = coords.getCoordinate(order-1, k); + c.setColor(d); + coords.setCoordinate(order-1, k, c); + } + mediator.setNewActivePatch(patch); + } + private void linearGradient(BlendDirection direction) { 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 2009-01-02 06:02:58 UTC (rev 279) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2009-01-04 22:27:17 UTC (rev 280) @@ -83,6 +83,7 @@ public static final String CLONE = "patchanim.clone"; public static final String COLOR = "patchanim.color"; public static final String SETALLPOINTS = "patchanim.setallpoints"; + public static final String SETBORDERPOINTS = "patchanim.setborderpoints"; public static final String BLACK = "patchanim.black"; public static final String FULLCOLOR="patchanim.fullcolor"; public static final String VALUE="patchanim.value"; Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2009-01-02 06:02:58 UTC (rev 279) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2009-01-04 22:27:17 UTC (rev 280) @@ -82,6 +82,7 @@ patchanim.clone = Clone patchanim.color = Color patchanim.setallpoints = Set all control points to... +patchanim.setborderpoints = Set border points to... patchanim.black = Black patchanim.fullcolor = Full Color patchanim.value = Value... This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-06-10 03:22:50
|
Revision: 303 http://patchanim.svn.sourceforge.net/patchanim/?rev=303&view=rev Author: dbrosius Date: 2010-06-10 03:22:41 +0000 (Thu, 10 Jun 2010) Log Message: ----------- warnings Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/ExportFrame.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 trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchExporter.java Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/ExportFrame.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/ExportFrame.java 2010-06-09 06:05:26 UTC (rev 302) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/ExportFrame.java 2010-06-10 03:22:41 UTC (rev 303) @@ -25,6 +25,7 @@ import javax.swing.BorderFactory; import javax.swing.JDialog; import javax.swing.JProgressBar; +import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import com.mebigfatguy.patchanim.gui.events.ExportEvent; @@ -52,7 +53,7 @@ ResourceBundle rb = PatchAnimBundle.getBundle(); Container cp = getContentPane(); cp.setLayout(new BorderLayout(4, 4)); - bar = new JProgressBar(JProgressBar.HORIZONTAL, 0, 100); + bar = new JProgressBar(SwingConstants.HORIZONTAL, 0, 100); bar.setBorder(BorderFactory.createEmptyBorder(10, 50, 10, 50)); cp.add(bar, BorderLayout.CENTER); pack(); Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java 2010-06-09 06:05:26 UTC (rev 302) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java 2010-06-10 03:22:41 UTC (rev 303) @@ -189,13 +189,13 @@ int newWidth = Integer.parseInt(widthField.getText()); if (oldWidth != newWidth) { document.setWidth(newWidth); - PatchPanelMediator mediator = PatchPanelMediator.getMediator(); - mediator.fireSettingsChanged(); + PatchPanelMediator ppMediator = PatchPanelMediator.getMediator(); + ppMediator.fireSettingsChanged(); } } catch (NumberFormatException nfe) { document.setWidth(100); - PatchPanelMediator mediator = PatchPanelMediator.getMediator(); - mediator.fireSettingsChanged(); + PatchPanelMediator ppMediator = PatchPanelMediator.getMediator(); + ppMediator.fireSettingsChanged(); } } @@ -213,13 +213,13 @@ int newHeight = Integer.parseInt(heightField.getText()); if (oldHeight != newHeight) { document.setHeight(newHeight); - PatchPanelMediator mediator = PatchPanelMediator.getMediator(); - mediator.fireSettingsChanged(); + PatchPanelMediator ppMediator = PatchPanelMediator.getMediator(); + ppMediator.fireSettingsChanged(); } } catch (NumberFormatException nfe) { document.setHeight(100); - PatchPanelMediator mediator = PatchPanelMediator.getMediator(); - mediator.fireSettingsChanged(); + PatchPanelMediator ppMediator = PatchPanelMediator.getMediator(); + ppMediator.fireSettingsChanged(); } } @@ -238,13 +238,13 @@ int newTween = Integer.parseInt(tweenFramesField.getText()); if (oldTween != newTween) { document.setTweenCount(newTween); - PatchPanelMediator mediator = PatchPanelMediator.getMediator(); - mediator.fireSettingsChanged(); + PatchPanelMediator ppMediator = PatchPanelMediator.getMediator(); + ppMediator.fireSettingsChanged(); } } catch (NumberFormatException nfe) { document.setTweenCount(10); - PatchPanelMediator mediator = PatchPanelMediator.getMediator(); - mediator.fireSettingsChanged(); + PatchPanelMediator ppMediator = PatchPanelMediator.getMediator(); + ppMediator.fireSettingsChanged(); } } }); @@ -254,8 +254,8 @@ public void itemStateChanged(ItemEvent ie) { if (ie.getStateChange() == ItemEvent.SELECTED) { document.setAnimationType((AnimationType)ie.getItem()); - PatchPanelMediator mediator = PatchPanelMediator.getMediator(); - mediator.fireSettingsChanged(); + PatchPanelMediator ppMediator = PatchPanelMediator.getMediator(); + ppMediator.fireSettingsChanged(); } } }); @@ -265,8 +265,8 @@ public void itemStateChanged(ItemEvent ie) { if (ie.getStateChange() == ItemEvent.SELECTED) { document.setOutOfBoundsColor((OutOfBoundsColor)ie.getItem()); - PatchPanelMediator mediator = PatchPanelMediator.getMediator(); - mediator.fireSettingsChanged(); + PatchPanelMediator ppMediator = PatchPanelMediator.getMediator(); + ppMediator.fireSettingsChanged(); } } }); @@ -284,8 +284,8 @@ public void itemStateChanged(ItemEvent ie) { if (ie.getStateChange() == ItemEvent.SELECTED) { document.setTweenStyle((TweenStyle)ie.getItem()); - PatchPanelMediator mediator = PatchPanelMediator.getMediator(); - mediator.fireSettingsChanged(); + PatchPanelMediator ppMediator = PatchPanelMediator.getMediator(); + ppMediator.fireSettingsChanged(); } } }); Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java 2010-06-09 06:05:26 UTC (rev 302) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java 2010-06-10 03:22:41 UTC (rev 303) @@ -133,8 +133,8 @@ else selIndex++; - PatchPanelMediator mediator = PatchPanelMediator.getMediator(); - CombinedPatch newPatch = new CombinedPatch(mediator.getDocument().getOrder(), true); + PatchPanelMediator ppMediator = PatchPanelMediator.getMediator(); + CombinedPatch newPatch = new CombinedPatch(ppMediator.getDocument().getOrder(), true); patchListModel.add(selIndex, newPatch); patchList.setSelectedIndex(selIndex); removeButton.setEnabled(patchListModel.getSize() > 1); @@ -151,8 +151,8 @@ selIndex--; } patchList.setSelectedIndex(selIndex); - PatchPanelMediator mediator = PatchPanelMediator.getMediator(); - mediator.setNewActivePatch((CombinedPatch)patchListModel.getElementAt(selIndex)); + PatchPanelMediator ppMediator = PatchPanelMediator.getMediator(); + ppMediator.setNewActivePatch((CombinedPatch)patchListModel.getElementAt(selIndex)); removeButton.setEnabled(patchListModel.getSize() > 1); enabledMovementCtrls(); } @@ -194,8 +194,8 @@ int selIndex = patchList.getSelectedIndex(); if (selIndex >= 0) { CombinedPatch newPatch = (CombinedPatch)patchListModel.getElementAt(selIndex); - PatchPanelMediator mediator = PatchPanelMediator.getMediator(); - mediator.setNewActivePatch(newPatch); + PatchPanelMediator ppMediator = PatchPanelMediator.getMediator(); + ppMediator.setNewActivePatch(newPatch); enabledMovementCtrls(); } } Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/Utils.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/Utils.java 2010-06-09 06:05:26 UTC (rev 302) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/Utils.java 2010-06-10 03:22:41 UTC (rev 303) @@ -26,7 +26,7 @@ import javax.swing.JPanel; public class Utils { - public enum Sizing {Width, Height, Both}; + public enum Sizing {Width, Height, Both} private Utils() {} Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java 2010-06-09 06:05:26 UTC (rev 302) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java 2010-06-10 03:22:41 UTC (rev 303) @@ -47,7 +47,7 @@ d = db.newDocument(); } - public String getVersion(ExpressionContext context) { + public String getVersion(@SuppressWarnings("unused") ExpressionContext context) { BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader(PatchAnimExtension.class.getResourceAsStream(VERSION_URL))); @@ -59,39 +59,39 @@ } } - public String getOrder(ExpressionContext context) { + public String getOrder(@SuppressWarnings("unused") ExpressionContext context) { return String.valueOf(paDoc.getOrder()); } - public String getWidth(ExpressionContext context) { + public String getWidth(@SuppressWarnings("unused") ExpressionContext context) { return String.valueOf(paDoc.getWidth()); } - public String getHeight(ExpressionContext context) { + public String getHeight(@SuppressWarnings("unused") ExpressionContext context) { return String.valueOf(paDoc.getHeight()); } - public String getAnimationType(ExpressionContext context) { + public String getAnimationType(@SuppressWarnings("unused") ExpressionContext context) { return paDoc.getAnimationType().name(); } - public String getOutOfBoundsColor(ExpressionContext context) { + public String getOutOfBoundsColor(@SuppressWarnings("unused") ExpressionContext context) { return paDoc.getOutOfBoundsColor().name(); } - public String getTweenCount(ExpressionContext context) { + public String getTweenCount(@SuppressWarnings("unused") ExpressionContext context) { return String.valueOf(paDoc.getTweenCount()); } - public String getTweenStyle(ExpressionContext context) { + public String getTweenStyle(@SuppressWarnings("unused") ExpressionContext context) { return String.valueOf(paDoc.getTweenStyle()); } - public String useAlpha(ExpressionContext context) { + public String useAlpha(@SuppressWarnings("unused") ExpressionContext context) { return String.valueOf(paDoc.useAlpha()); } - public NodeList getPatches(ExpressionContext context) { + public NodeList getPatches(@SuppressWarnings("unused") ExpressionContext context) { return new NodeList() { public int getLength() { @@ -104,12 +104,12 @@ }; } - public String getPatchName(ExpressionContext context, Node patchIndexNode) { + public String getPatchName(@SuppressWarnings("unused") ExpressionContext context, Node patchIndexNode) { int patchIndex = Integer.parseInt(patchIndexNode.getNodeValue()); return paDoc.getPatches().get(patchIndex).getName(); } - public NodeList getCoordinates(ExpressionContext context) { + public NodeList getCoordinates(@SuppressWarnings("unused") ExpressionContext context) { return new NodeList() { public int getLength() { @@ -123,20 +123,20 @@ }; } - public String getX(ExpressionContext context, String color, Node patchIndexNode, Node coordIndexNode) { + public String getX(@SuppressWarnings("unused") ExpressionContext context, String color, Node patchIndexNode, Node coordIndexNode) { return String.valueOf(getCoordinate(color, patchIndexNode, coordIndexNode).getX()); } - public String getY(ExpressionContext context, String color, Node patchIndexNode, Node coordIndexNode) { + public String getY(@SuppressWarnings("unused") ExpressionContext context, String color, Node patchIndexNode, Node coordIndexNode) { return String.valueOf(getCoordinate(color, patchIndexNode, coordIndexNode).getY()); } - public String getColor(ExpressionContext context, String color, Node patchIndexNode, Node coordIndexNode) { + 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); + PatchColor patchColor = Enum.<PatchColor>valueOf(PatchColor.class, color); int patchIndex = Integer.parseInt(patchIndexNode.getNodeValue()); int coordIndex = Integer.parseInt(coordIndexNode.getNodeValue()); int order = paDoc.getOrder(); Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2010-06-09 06:05:26 UTC (rev 302) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2010-06-10 03:22:41 UTC (rev 303) @@ -146,15 +146,15 @@ 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.setAnimationType(Enum.<AnimationType>valueOf(AnimationType.class, atts.getValue(ANIMATIONTYPE))); + doc.setOutOfBoundsColor(Enum.<OutOfBoundsColor>valueOf(OutOfBoundsColor.class, atts.getValue(OUTOFBOUNDSCOLOR))); doc.setTweenCount(Integer.parseInt(atts.getValue(TWEENCOUNT))); - doc.setTweenStyle(TweenStyle.valueOf(TweenStyle.class, atts.getValue(TWEENSTYLE))); + doc.setTweenStyle(Enum.<TweenStyle>valueOf(TweenStyle.class, atts.getValue(TWEENSTYLE))); } 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)); + patchColor = Enum.<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)), Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchExporter.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchExporter.java 2010-06-09 06:05:26 UTC (rev 302) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchExporter.java 2010-06-10 03:22:41 UTC (rev 303) @@ -137,31 +137,31 @@ } } - private void writeSingleFile(BufferedImage image, int index, File dir, String baseName, ExportType type) throws IOException { + private void writeSingleFile(BufferedImage image, int index, File dir, String bsName, ExportType exportType) throws IOException { NumberFormat nf = NumberFormat.getIntegerInstance(); nf.setMinimumIntegerDigits(5); nf.setGroupingUsed(false); - String name = baseName + "_" + nf.format(index) + "." + type.getExtension(); + String name = bsName + "_" + nf.format(index) + "." + exportType.getExtension(); File imageFile = new File(dir, name); - if (type == ExportType.Gifs) { + if (exportType == ExportType.Gifs) { AnimatedGifEncoder encoder = new AnimatedGifEncoder(); encoder.start(imageFile.getPath()); encoder.addFrame(image); encoder.finish(); - } else if (type == ExportType.AnimatedGif) { + } else if (exportType == ExportType.AnimatedGif) { agEncoder.addFrame(image); agEncoder.setDelay(100); - } else if (type == ExportType.AnimatedPng) { + } else if (exportType == ExportType.AnimatedPng) { apngEncoder.setDelay(100); apngEncoder.addFrame(image); - } else if (type == ExportType.AnimatedMng) { + } else if (exportType == ExportType.AnimatedMng) { mngEncoder.setDelay(100); mngEncoder.addFrame(image); } else - ImageIO.write(image, type.getExtension(), imageFile); + ImageIO.write(image, exportType.getExtension(), imageFile); fireExportEvent(index); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |