patchanim-commit Mailing List for patchanim (Page 11)
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-01-29 06:07:48
|
Revision: 55 http://patchanim.svn.sourceforge.net/patchanim/?rev=55&view=rev Author: dbrosius Date: 2008-01-28 22:07:53 -0800 (Mon, 28 Jan 2008) Log Message: ----------- grammar Modified Paths: -------------- trunk/patchanim/htdocs/index.html Modified: trunk/patchanim/htdocs/index.html =================================================================== --- trunk/patchanim/htdocs/index.html 2008-01-29 05:58:27 UTC (rev 54) +++ trunk/patchanim/htdocs/index.html 2008-01-29 06:07:53 UTC (rev 55) @@ -33,7 +33,7 @@ <p>Now this tool uses Cubic Bezier <b>patches</b>, not curves. A 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, but is - good enough to understand what this application is doing. Again, though, the z value in + good enough to understand what this application is doing). Again, though, the z value in this application is mapped to a color, where values of 0 are mapped to black, and values of 255 are mapped to full color (in this case red). In the color blend samples, then, you can imagine that you are looking straight down on the patch from above. In this application, you can only move the control points This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-01-29 05:58:30
|
Revision: 54 http://patchanim.svn.sourceforge.net/patchanim/?rev=54&view=rev Author: dbrosius Date: 2008-01-28 21:58:27 -0800 (Mon, 28 Jan 2008) Log Message: ----------- update docs Modified Paths: -------------- trunk/patchanim/htdocs/index.html Modified: trunk/patchanim/htdocs/index.html =================================================================== --- trunk/patchanim/htdocs/index.html 2008-01-29 05:55:02 UTC (rev 53) +++ trunk/patchanim/htdocs/index.html 2008-01-29 05:58:27 UTC (rev 54) @@ -31,8 +31,9 @@ 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 - consisting of 16 control points. You can think of a patch as bezier curves running in parallel along the - x axis, and a cross cutting set of curves running along the y axis. Again, though, the z value in + 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, but is + good enough to understand what this application is doing. Again, though, the z value in this application is mapped to a color, where values of 0 are mapped to black, and values of 255 are mapped to full color (in this case red). In the color blend samples, then, you can imagine that you are looking straight down on the patch from above. In this application, you can only move the control points @@ -44,7 +45,7 @@ very easy to generate in-between images from two separate blend descriptions.</p> - <p><b>Jan 28, 2008 - This tool is not finished at this time, although the patch animations work</b><br/> + <p><b>Jan 29, 2008 - This tool is not finished at this time, although the patch animations work</b><br/> Still to be done: <ul> <li>Export to GIF, MPEG, etc</li> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-01-29 05:54:57
|
Revision: 53 http://patchanim.svn.sourceforge.net/patchanim/?rev=53&view=rev Author: dbrosius Date: 2008-01-28 21:55:02 -0800 (Mon, 28 Jan 2008) Log Message: ----------- add export to list of jpgs or pngs 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-01-28 07:50:54 UTC (rev 52) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-01-29 05:55:02 UTC (rev 53) @@ -24,10 +24,14 @@ import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; +import java.text.NumberFormat; +import java.util.List; import java.util.ResourceBundle; +import javax.imageio.ImageIO; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JMenu; @@ -36,9 +40,14 @@ import javax.swing.JOptionPane; import javax.swing.filechooser.FileFilter; +import com.mebigfatguy.patchanim.AnimationType; +import com.mebigfatguy.patchanim.ExportType; +import com.mebigfatguy.patchanim.OutOfBoundsColor; import com.mebigfatguy.patchanim.PatchAnimDocument; import com.mebigfatguy.patchanim.io.PatchAnimIO; import com.mebigfatguy.patchanim.main.PatchAnimBundle; +import com.mebigfatguy.patchanim.surface.CombinedPatch; +import com.mebigfatguy.patchanim.surface.PatchGenerator; public class JPatchAnimFrame extends JFrame { @@ -46,9 +55,11 @@ private JMenuItem newItem; private JMenuItem openItem; - private JMenuItem closeItem; private JMenuItem saveItem; private JMenuItem saveAsItem; + private JMenu exportMenu; + private JMenuItem exportJpgsItem; + private JMenuItem exportPngsItem; private JMenuItem quitItem; private PatchAnimDocument document; private File documentLocation; @@ -91,6 +102,13 @@ saveAsItem = new JMenuItem(rb.getString(PatchAnimBundle.SAVEAS)); fileMenu.add(saveAsItem); fileMenu.addSeparator(); + exportMenu = new JMenu(rb.getString(PatchAnimBundle.EXPORT)); + exportJpgsItem = new JMenuItem(rb.getString(PatchAnimBundle.JPGSERIES)); + exportPngsItem = new JMenuItem(rb.getString(PatchAnimBundle.PNGSERIES)); + exportMenu.add(exportJpgsItem); + exportMenu.add(exportPngsItem); + fileMenu.add(exportMenu); + fileMenu.addSeparator(); quitItem = new JMenuItem(rb.getString(PatchAnimBundle.QUIT)); fileMenu.add(quitItem); @@ -183,6 +201,26 @@ } }); + exportJpgsItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + try { + exportFiles(ExportType.JPegs); + } catch (IOException ioe) { + JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.EXPORTFAILED); + } + } + }); + + exportPngsItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + try { + exportFiles(ExportType.Pngs); + } catch (IOException ioe) { + JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.EXPORTFAILED); + } + } + }); + quitItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { try { @@ -286,4 +324,67 @@ ResourceBundle rb = PatchAnimBundle.getBundle(); return JOptionPane.showConfirmDialog(JPatchAnimFrame.this, rb.getString(PatchAnimBundle.ASKSAVE), rb.getString(PatchAnimBundle.TITLE), JOptionPane.YES_NO_CANCEL_OPTION); } + + private void exportFiles(ExportType type) throws IOException { + JFileChooser chooser = new JFileChooser(); + chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); + File defLocation; + if (documentLocation == null) + defLocation = new File(System.getProperty("user.dir")); + else + defLocation = documentLocation.getParentFile(); + + chooser.setCurrentDirectory(defLocation); + int option = chooser.showSaveDialog(JPatchAnimFrame.this); + if (option != JFileChooser.APPROVE_OPTION) + return; + + File dir = chooser.getSelectedFile(); + dir.mkdir(); + String baseName = dir.getName(); + + 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(); + + 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); + PatchGenerator.recalcCombinedImage(tweenPatch, image, oob); + writeSingleFile(image, imageIndex++, dir, 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--) { + CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)tweenCount); + PatchGenerator.recalcCombinedImage(tweenPatch, image, oob); + writeSingleFile(image, imageIndex++, dir, baseName, type); + } + } + } + } + + private void writeSingleFile(BufferedImage image, int index, File dir, String baseName, ExportType type) throws IOException { + NumberFormat nf = NumberFormat.getIntegerInstance(); + nf.setMinimumIntegerDigits(6); + String name = baseName + "_" + nf.format(index) + "." + type.getExtension(); + + File imageFile = new File(dir, name); + ImageIO.write(image, type.getExtension(), imageFile); + } } + Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-01-28 07:50:54 UTC (rev 52) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-01-29 05:55:02 UTC (rev 53) @@ -29,6 +29,9 @@ public static final String OPEN = "patchanim.open"; public static final String SAVE = "patchanim.save"; public static final String SAVEAS = "patchanim.saveas"; + public static final String EXPORT = "patchanim.export"; + public static final String JPGSERIES = "patchanim.jpgs"; + public static final String PNGSERIES = "patchanim.pngs"; public static final String QUIT = "patchanim.quit"; public static final String CONTROLS = "patchanim.control"; public static final String WIDTH = "patchanim.width"; @@ -53,6 +56,7 @@ public static final String ASKSAVE = "patchanim.asksave"; public static final String LOADFAILED = "patchanim.err.loadfailed"; public static final String SAVEFAILED = "patchanim.err.savefailed"; + public static final String EXPORTFAILED = "patchanim.err.exportfailed"; private static ResourceBundle rb = ResourceBundle.getBundle("com/mebigfatguy/patchanim/resources"); Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-01-28 07:50:54 UTC (rev 52) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-01-29 05:55:02 UTC (rev 53) @@ -22,6 +22,9 @@ patchanim.open = Open... patchanim.save = Save patchanim.saveas = Save As... +patchanim.export = Export As... +patchanim.jpgs = a series of JPGs +patchanim.pngs = a series of PNGs patchanim.quit = Quit patchanim.control = Controls patchanim.width = Width @@ -46,3 +49,4 @@ 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 +patchanim.err.exportfailed = Failed exporting PatchAnimations This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-01-28 07:50:48
|
Revision: 52 http://patchanim.svn.sourceforge.net/patchanim/?rev=52&view=rev Author: dbrosius Date: 2008-01-27 23:50:54 -0800 (Sun, 27 Jan 2008) Log Message: ----------- update progress Modified Paths: -------------- trunk/patchanim/htdocs/index.html Modified: trunk/patchanim/htdocs/index.html =================================================================== --- trunk/patchanim/htdocs/index.html 2008-01-28 07:48:31 UTC (rev 51) +++ trunk/patchanim/htdocs/index.html 2008-01-28 07:50:54 UTC (rev 52) @@ -24,11 +24,11 @@ <p>A Cubic Bezier <b>curve</b> is a curve defined by 4 control points. The curve goes thru both end points, and the curve is influenced by the two middle points. In fact the slope of the curve at the first point is equal to - the slope of the line from the first to the second point. Similarly the slope at the end point is equal to the slope - of the line from the third to the fourth point. Rather than calculating a point on a curve, this application uses the - shape of the curve to determine a color. In the following diagram, the y axis denotes 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> + the slope of the line from the first to the second point. Similarly the slope of the curve at the end point is + equal to the slope of the line from the third to the fourth point. Rather than calculating a point on a curve, + this application uses the shape of the curve to determine a color. In the following diagram, the y axis denotes + 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 consisting of 16 control points. You can think of a patch as bezier curves running in parallel along the @@ -40,11 +40,11 @@ <p>To accomplish creating the desired effect, three such patches are available, one for red, green and blue. Each patch only controls one primary color, and then the values from each patch is put together - to generate one full color blend. Since the description of the blend is very succinct (just 16 points), It is + 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>Jan 27, 2008 - This tool is not finished at this time, although the patch animations work</b><br/> + <p><b>Jan 28, 2008 - This tool is not finished at this time, although the patch animations work</b><br/> Still to be done: <ul> <li>Export to GIF, MPEG, etc</li> @@ -52,7 +52,6 @@ <li>Performance Improvements</li> <li>Patch Library</li> <li>Color Swatch for editing values</li> - <li>Bulk editing of control point values</li> <li>Patch Name editing</li> <li>Patch reordering</li> <li>Patch cloneing</li> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-01-28 07:48:25
|
Revision: 51 http://patchanim.svn.sourceforge.net/patchanim/?rev=51&view=rev Author: dbrosius Date: 2008-01-27 23:48:31 -0800 (Sun, 27 Jan 2008) Log Message: ----------- add context menu to patches to bulk set all ctrl points to either black, fullcolor or custom value 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-01-28 02:45:47 UTC (rev 50) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java 2008-01-28 07:48:31 UTC (rev 51) @@ -23,18 +23,28 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; +import java.util.ResourceBundle; import javax.swing.BorderFactory; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; import javax.swing.JPanel; +import javax.swing.JPopupMenu; import javax.swing.SwingUtilities; import com.mebigfatguy.patchanim.OutOfBoundsColor; import com.mebigfatguy.patchanim.PatchAnimDocument; import com.mebigfatguy.patchanim.PatchColor; +import com.mebigfatguy.patchanim.main.PatchAnimBundle; import com.mebigfatguy.patchanim.surface.CombinedPatch; +import com.mebigfatguy.patchanim.surface.Coordinate; +import com.mebigfatguy.patchanim.surface.PatchCoords; import com.mebigfatguy.patchanim.surface.PatchGenerator; public class JPatchSamplePanel extends JPanel { @@ -81,10 +91,21 @@ addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent me) { - if (decorator != null) { + if (decorator != null) decorator.click(me.getPoint(), JPatchSamplePanel.this.getBounds()); - } } + + @Override + public void mousePressed(MouseEvent me) { + if ((color != PatchColor.Combined) && me.isPopupTrigger()) + showPatchContentMenu(me); + } + + @Override + public void mouseReleased(MouseEvent me) { + if ((color != PatchColor.Combined) && me.isPopupTrigger()) + showPatchContentMenu(me); + } }); PatchPanelMediator mediator = PatchPanelMediator.getMediator(); @@ -142,6 +163,54 @@ } } + private void showPatchContentMenu(MouseEvent me) { + final ResourceBundle rb = PatchAnimBundle.getBundle(); + 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); + } + }); + + 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 { + setAllPts(Double.parseDouble(value)); + } catch (NumberFormatException nfe) { + } + } + }); + setAllItem.add(valueItem); + menu.show(JPatchSamplePanel.this, me.getX(), me.getY()); + } + + private void setAllPts(double d) { + 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++) { + Coordinate c = coords.getCoordinate(i, j); + c.setColor(d); + coords.setCoordinate(i, j, c); + } + } + mediator.setNewActivePatch(patch); + } + @Override public void paintComponent(Graphics g) { Rectangle bounds = getBounds(); Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-01-28 02:45:47 UTC (rev 50) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-01-28 07:48:31 UTC (rev 51) @@ -46,6 +46,10 @@ public static final String ADD = "patchanim.add"; public static final String REMOVE = "patchanim.remove"; public static final String COLOR = "patchanim.color"; + public static final String SETALLPOINTS = "patchanim.setallpoints"; + public static final String BLACK = "patchanim.black"; + public static final String FULLCOLOR="patchanim.fullcolor"; + public static final String VALUE="patchanim.value"; 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-01-28 02:45:47 UTC (rev 50) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-01-28 07:48:31 UTC (rev 51) @@ -39,6 +39,10 @@ patchanim.add = Add patchanim.remove = Remove patchanim.color = Color +patchanim.setallpoints = Set all control points to... +patchanim.black = Black +patchanim.fullcolor = Full Color +patchanim.value = Value... 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-01-28 02:45:41
|
Revision: 50 http://patchanim.svn.sourceforge.net/patchanim/?rev=50&view=rev Author: dbrosius Date: 2008-01-27 18:45:47 -0800 (Sun, 27 Jan 2008) Log Message: ----------- add webstart at the top of the page Modified Paths: -------------- trunk/patchanim/htdocs/index.html Modified: trunk/patchanim/htdocs/index.html =================================================================== --- trunk/patchanim/htdocs/index.html 2008-01-28 02:42:44 UTC (rev 49) +++ trunk/patchanim/htdocs/index.html 2008-01-28 02:45:47 UTC (rev 50) @@ -11,6 +11,8 @@ <a href="http://www.sourceforge.net/projects/patchanim">Project Page</a> <img src="vbar.gif" height="12"/> <a href="javadoc/index.html">JavaDoc</a> + <img src="vbar.gif" height="12"/> + <a href="http://patchanim.sourceforge.net/jnlp/patchanim.jnlp">Web Start</a> <hr/> <p>Thanks for your interest in PatchAnim.</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-01-28 02:42:38
|
Revision: 49 http://patchanim.svn.sourceforge.net/patchanim/?rev=49&view=rev Author: dbrosius Date: 2008-01-27 18:42:44 -0800 (Sun, 27 Jan 2008) Log Message: ----------- better doc Modified Paths: -------------- trunk/patchanim/htdocs/index.html Modified: trunk/patchanim/htdocs/index.html =================================================================== --- trunk/patchanim/htdocs/index.html 2008-01-28 02:39:53 UTC (rev 48) +++ trunk/patchanim/htdocs/index.html 2008-01-28 02:42:44 UTC (rev 49) @@ -36,10 +36,10 @@ you are looking straight down on the patch from above. In this application, you can only move the control points in the z direction (into the screen or out of the screen), the x and y positions are fixed.</p> - <p>To accomplish creating the desired effect, three such patches are available, one for red, green and blue - respectively. Each patch only controls one primary color, and then the values from each patch is put together + <p>To accomplish creating the desired effect, three such patches are available, one for red, green and blue. + Each patch only controls one primary color, and then the values from each patch is put together to generate one full color blend. Since the description of the blend is very succinct (just 16 points), It is - very easy to generate in-between images from two separate blend description.</p> + very easy to generate in-between images from two separate blend descriptions.</p> <p><b>Jan 27, 2008 - This tool is not finished at this time, although the patch animations work</b><br/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-01-28 02:39:48
|
Revision: 48 http://patchanim.svn.sourceforge.net/patchanim/?rev=48&view=rev Author: dbrosius Date: 2008-01-27 18:39:53 -0800 (Sun, 27 Jan 2008) Log Message: ----------- better doc Modified Paths: -------------- trunk/patchanim/htdocs/index.html Modified: trunk/patchanim/htdocs/index.html =================================================================== --- trunk/patchanim/htdocs/index.html 2008-01-28 02:29:48 UTC (rev 47) +++ trunk/patchanim/htdocs/index.html 2008-01-28 02:39:53 UTC (rev 48) @@ -14,11 +14,11 @@ <hr/> <p>Thanks for your interest in PatchAnim.</p> - <p>This tool generates a series of bitmaps that are color blends calculated from bezier surface patch values, where - the z coordinate of the patch corresponds to the color intensity that is rendered at that u,v parameter. - There are three patches available to tailor, one for red, green and blue. These three patches are - combined into one blend. A series of these patches can be created, and then the software creates a tween - between them to get a nicely continuous animated blend.</p> + + <p>This tool creates a sequence of color blends using + <a href="http://en.wikipedia.org/wiki/B%C3%A9zier_surface">Bezier Patches</a>. This sequence of blends is tweened and + animated giving smooth transitions from one blend to another. Blend animations can be outputted to animated gifs, mpegs + or a series of bitmaps.</p> <p>A Cubic Bezier <b>curve</b> is a curve defined by 4 control points. The curve goes thru both end points, and the curve is influenced by the two middle points. In fact the slope of the curve at the first point is equal to @@ -35,6 +35,12 @@ are mapped to full color (in this case red). In the color blend samples, then, you can imagine that you are looking straight down on the patch from above. In this application, you can only move the control points in the z direction (into the screen or out of the screen), the x and y positions are fixed.</p> + + <p>To accomplish creating the desired effect, three such patches are available, one for red, green and blue + respectively. Each patch only controls one primary color, and then the values from each patch is put together + to generate one full color blend. Since the description of the blend is very succinct (just 16 points), It is + very easy to generate in-between images from two separate blend description.</p> + <p><b>Jan 27, 2008 - This tool is not finished at this time, although the patch animations work</b><br/> Still to be done: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-01-28 02:29:43
|
Revision: 47 http://patchanim.svn.sourceforge.net/patchanim/?rev=47&view=rev Author: dbrosius Date: 2008-01-27 18:29:48 -0800 (Sun, 27 Jan 2008) Log Message: ----------- better doc Modified Paths: -------------- trunk/patchanim/htdocs/index.html Modified: trunk/patchanim/htdocs/index.html =================================================================== --- trunk/patchanim/htdocs/index.html 2008-01-28 02:23:07 UTC (rev 46) +++ trunk/patchanim/htdocs/index.html 2008-01-28 02:29:48 UTC (rev 47) @@ -21,7 +21,7 @@ between them to get a nicely continuous animated blend.</p> <p>A Cubic Bezier <b>curve</b> is a curve defined by 4 control points. The curve goes thru both end points, and - the curve is influenced by the two middle points. In fact that slope of the curve at the first point is equal to + the curve is influenced by the two middle points. In fact the slope of the curve at the first point is equal to the slope of the line from the first to the second point. Similarly the slope at the end point is equal to the slope of the line from the third to the fourth point. Rather than calculating a point on a curve, this application uses the shape of the curve to determine a color. In the following diagram, the y axis denotes a color from black to a full @@ -30,11 +30,11 @@ <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 consisting of 16 control points. You can think of a patch as bezier curves running in parallel along the - x axis, and a cross cutting setting of curves running along the y axis. Again, though, the z value, in - this application is mapped to a color, where patch values of 0 are mapped to black, and values of 255 + x axis, and a cross cutting set of curves running along the y axis. Again, though, the z value in + this application is mapped to a color, where values of 0 are mapped to black, and values of 255 are mapped to full color (in this case red). In the color blend samples, then, you can imagine that you are looking straight down on the patch from above. In this application, you can only move the control points - up or down, the x and y positions are fixed.</p> + in the z direction (into the screen or out of the screen), the x and y positions are fixed.</p> <p><b>Jan 27, 2008 - This tool is not finished at this time, although the patch animations work</b><br/> Still to be done: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-01-28 02:23:03
|
Revision: 46 http://patchanim.svn.sourceforge.net/patchanim/?rev=46&view=rev Author: dbrosius Date: 2008-01-27 18:23:07 -0800 (Sun, 27 Jan 2008) Log Message: ----------- better wording Modified Paths: -------------- trunk/patchanim/htdocs/index.html Modified: trunk/patchanim/htdocs/index.html =================================================================== --- trunk/patchanim/htdocs/index.html 2008-01-28 02:19:44 UTC (rev 45) +++ trunk/patchanim/htdocs/index.html 2008-01-28 02:23:07 UTC (rev 46) @@ -28,11 +28,13 @@ 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>, a 3D surface patch consisting of 16 control points. You can think - of a patch as bezier curves running in parallel along the x axis, and a cross cutting setting of curves running along - the y axis. Again, though, the z value, in this application is mapped to a color, where patch values of 0 are mapped - to black, and values of 255 are mapped to full color (in this case red). In the color blend samples, then, you can - imagine that you are looking straight down on the patch from above.</p> + <p>Now this tool uses Cubic Bezier <b>patches</b>, not curves. A Bezier patch is a description of a 3D surface + consisting of 16 control points. You can think of a patch as bezier curves running in parallel along the + x axis, and a cross cutting setting of curves running along the y axis. Again, though, the z value, in + this application is mapped to a color, where patch values of 0 are mapped to black, and values of 255 + are mapped to full color (in this case red). In the color blend samples, then, you can imagine that + you are looking straight down on the patch from above. In this application, you can only move the control points + up or down, the x and y positions are fixed.</p> <p><b>Jan 27, 2008 - This tool is not finished at this time, although the patch animations work</b><br/> Still to be done: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-01-28 02:19:40
|
Revision: 45 http://patchanim.svn.sourceforge.net/patchanim/?rev=45&view=rev Author: dbrosius Date: 2008-01-27 18:19:44 -0800 (Sun, 27 Jan 2008) Log Message: ----------- document bezier use Modified Paths: -------------- trunk/patchanim/htdocs/index.html Added Paths: ----------- trunk/patchanim/htdocs/bezier.jpg Added: trunk/patchanim/htdocs/bezier.jpg =================================================================== (Binary files differ) Property changes on: trunk/patchanim/htdocs/bezier.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/patchanim/htdocs/index.html =================================================================== --- trunk/patchanim/htdocs/index.html 2008-01-28 01:47:53 UTC (rev 44) +++ trunk/patchanim/htdocs/index.html 2008-01-28 02:19:44 UTC (rev 45) @@ -19,6 +19,21 @@ There are three patches available to tailor, one for red, green and blue. These three patches are combined into one blend. A series of these patches can be created, and then the software creates a tween between them to get a nicely continuous animated blend.</p> + + <p>A Cubic Bezier <b>curve</b> is a curve defined by 4 control points. The curve goes thru both end points, and + the curve is influenced by the two middle points. In fact that slope of the curve at the first point is equal to + the slope of the line from the first to the second point. Similarly the slope at the end point is equal to the slope + of the line from the third to the fourth point. Rather than calculating a point on a curve, this application uses the + shape of the curve to determine a color. In the following diagram, the y axis denotes 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>, a 3D surface patch consisting of 16 control points. You can think + of a patch as bezier curves running in parallel along the x axis, and a cross cutting setting of curves running along + the y axis. Again, though, the z value, in this application is mapped to a color, where patch values of 0 are mapped + to black, and values of 255 are mapped to full color (in this case red). In the color blend samples, then, you can + imagine that you are looking straight down on the patch from above.</p> + <p><b>Jan 27, 2008 - This tool is not finished at this time, although the patch animations work</b><br/> Still to be done: <ul> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-01-28 01:47:47
|
Revision: 44 http://patchanim.svn.sourceforge.net/patchanim/?rev=44&view=rev Author: dbrosius Date: 2008-01-27 17:47:53 -0800 (Sun, 27 Jan 2008) Log Message: ----------- update docs Modified Paths: -------------- trunk/patchanim/htdocs/index.html Modified: trunk/patchanim/htdocs/index.html =================================================================== --- trunk/patchanim/htdocs/index.html 2008-01-28 01:45:28 UTC (rev 43) +++ trunk/patchanim/htdocs/index.html 2008-01-28 01:47:53 UTC (rev 44) @@ -22,7 +22,6 @@ <p><b>Jan 27, 2008 - This tool is not finished at this time, although the patch animations work</b><br/> Still to be done: <ul> - <li>PatchAnim file io</li> <li>Export to GIF, MPEG, etc</li> <li>redraw glitches</li> <li>Performance Improvements</li> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-01-28 01:45:24
|
Revision: 43 http://patchanim.svn.sourceforge.net/patchanim/?rev=43&view=rev Author: dbrosius Date: 2008-01-27 17:45:28 -0800 (Sun, 27 Jan 2008) Log Message: ----------- add asking for save before doing destroy actions. 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-01-28 01:22:32 UTC (rev 42) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-01-28 01:45:28 UTC (rev 43) @@ -84,10 +84,9 @@ fileMenu.add(newItem); openItem = new JMenuItem(rb.getString(PatchAnimBundle.OPEN)); fileMenu.add(openItem); - closeItem = new JMenuItem(rb.getString(PatchAnimBundle.CLOSE)); - fileMenu.add(closeItem); fileMenu.addSeparator(); saveItem = new JMenuItem(rb.getString(PatchAnimBundle.SAVE)); + saveItem.setEnabled(false); fileMenu.add(saveItem); saveAsItem = new JMenuItem(rb.getString(PatchAnimBundle.SAVEAS)); fileMenu.add(saveAsItem); @@ -104,8 +103,20 @@ addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent we) { - dispose(); - System.exit(0); + try { + if (document.isDirty()) { + int choice = askSave(); + if (choice == JOptionPane.CANCEL_OPTION) + return; + if (choice == JOptionPane.YES_OPTION) { + save(); + } + } + dispose(); + System.exit(0); + } catch (IOException ioe) { + JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.SAVEFAILED); + } } }); @@ -114,15 +125,16 @@ try { if (document.isDirty()) { int choice = askSave(); - if (choice == JFileChooser.CANCEL_OPTION) + if (choice == JOptionPane.CANCEL_OPTION) return; - if (choice == JFileChooser.APPROVE_OPTION) { + if (choice == JOptionPane.YES_OPTION) { save(); } } document = new PatchAnimDocument(); documentLocation = null; + saveItem.setEnabled(false); } catch (IOException ioe) { JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.SAVEFAILED); } @@ -134,9 +146,9 @@ try { if (document.isDirty()) { int choice = askSave(); - if (choice == JFileChooser.CANCEL_OPTION) + if (choice == JOptionPane.CANCEL_OPTION) return; - if (choice == JFileChooser.APPROVE_OPTION) { + if (choice == JOptionPane.YES_OPTION) { save(); } } @@ -176,9 +188,9 @@ try { if (document.isDirty()) { int choice = askSave(); - if (choice == JFileChooser.CANCEL_OPTION) + if (choice == JOptionPane.CANCEL_OPTION) return; - if (choice == JFileChooser.APPROVE_OPTION) { + if (choice == JOptionPane.YES_OPTION) { save(); } } @@ -189,6 +201,21 @@ } } }); + + PatchPanelMediator mediator = PatchPanelMediator.getMediator(); + mediator.addActivePatchChangedListener(new ActivePatchChangedListener () { + public void activePatchChanged(ActivePatchChangedEvent apce) { + document.setDirty(true); + saveItem.setEnabled(true); + } + }); + + mediator.addSettingsChangedListener(new SettingsChangedListener() { + public void settingsChanged(SettingsChangedEvent sce) { + document.setDirty(true); + saveItem.setEnabled(true); + } + }); } private void load() { @@ -222,6 +249,7 @@ } finally { PatchPanelMediator mediator = PatchPanelMediator.getMediator(); mediator.setDocument(document); + saveItem.setEnabled(false); } } @@ -243,14 +271,19 @@ documentLocation = new File(path); PatchAnimIO.saveFile(documentLocation, document); documentLocation = chooser.getSelectedFile(); + document.setDirty(false); + saveItem.setEnabled(false); } } private void save() throws IOException { PatchAnimIO.saveFile(documentLocation, document); + document.setDirty(false); + saveItem.setEnabled(false); } private int askSave() { - return JFileChooser.APPROVE_OPTION; + ResourceBundle rb = PatchAnimBundle.getBundle(); + return JOptionPane.showConfirmDialog(JPatchAnimFrame.this, rb.getString(PatchAnimBundle.ASKSAVE), rb.getString(PatchAnimBundle.TITLE), JOptionPane.YES_NO_CANCEL_OPTION); } } Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-01-28 01:22:32 UTC (rev 42) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-01-28 01:45:28 UTC (rev 43) @@ -27,7 +27,6 @@ public static final String FILE = "patchanim.file"; public static final String NEW = "patchanim.new"; public static final String OPEN = "patchanim.open"; - public static final String CLOSE = "patchanim.close"; public static final String SAVE = "patchanim.save"; public static final String SAVEAS = "patchanim.saveas"; public static final String QUIT = "patchanim.quit"; @@ -47,6 +46,7 @@ public static final String ADD = "patchanim.add"; public static final String REMOVE = "patchanim.remove"; public static final String COLOR = "patchanim.color"; + 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-01-28 01:22:32 UTC (rev 42) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-01-28 01:45:28 UTC (rev 43) @@ -20,7 +20,6 @@ patchanim.file = File patchanim.new = New patchanim.open = Open... -patchanim.close = Close patchanim.save = Save patchanim.saveas = Save As... patchanim.quit = Quit @@ -40,5 +39,6 @@ patchanim.add = Add patchanim.remove = Remove patchanim.color = Color +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-01-28 01:22:27
|
Revision: 42 http://patchanim.svn.sourceforge.net/patchanim/?rev=42&view=rev Author: dbrosius Date: 2008-01-27 17:22:32 -0800 (Sun, 27 Jan 2008) Log Message: ----------- add copyright Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/io/Closer.java trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/Closer.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/Closer.java 2008-01-28 01:21:47 UTC (rev 41) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/Closer.java 2008-01-28 01:22:32 UTC (rev 42) @@ -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.io; import java.io.Closeable; Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2008-01-28 01:21:47 UTC (rev 41) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2008-01-28 01:22:32 UTC (rev 42) @@ -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.io; import java.beans.XMLDecoder; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-01-28 01:21:42
|
Revision: 41 http://patchanim.svn.sourceforge.net/patchanim/?rev=41&view=rev Author: dbrosius Date: 2008-01-27 17:21:47 -0800 (Sun, 27 Jan 2008) Log Message: ----------- get file io working (dirty flag still not set, tho) Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java 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/PatchAnimDocument.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java 2008-01-27 23:19:28 UTC (rev 40) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java 2008-01-28 01:21:47 UTC (rev 41) @@ -47,7 +47,7 @@ tweenCount = 10; } - public boolean getDirty() { + public boolean isDirty() { return dirty; } Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-01-27 23:19:28 UTC (rev 40) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-01-28 01:21:47 UTC (rev 41) @@ -109,33 +109,84 @@ } }); + newItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + try { + if (document.isDirty()) { + int choice = askSave(); + if (choice == JFileChooser.CANCEL_OPTION) + return; + if (choice == JFileChooser.APPROVE_OPTION) { + save(); + } + } + + document = new PatchAnimDocument(); + documentLocation = null; + } catch (IOException ioe) { + JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.SAVEFAILED); + } + } + }); + openItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { - //Ask save - load(); + try { + if (document.isDirty()) { + int choice = askSave(); + if (choice == JFileChooser.CANCEL_OPTION) + return; + if (choice == JFileChooser.APPROVE_OPTION) { + save(); + } + } + load(); + } catch (IOException ioe) { + JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.LOADFAILED); + } } }); saveItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { - if (documentLocation == null) { - saveAs(); - } else { - save(); + try { + if (documentLocation == null) { + saveAs(); + } else { + save(); + } + } catch (IOException ioe) { + JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.SAVEFAILED); } } }); saveAsItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { - saveAs(); + try { + saveAs(); + } catch (IOException ioe) { + JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.SAVEFAILED); + } } }); quitItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { - dispose(); - System.exit(0); + try { + if (document.isDirty()) { + int choice = askSave(); + if (choice == JFileChooser.CANCEL_OPTION) + return; + if (choice == JFileChooser.APPROVE_OPTION) { + save(); + } + } + dispose(); + System.exit(0); + } catch (IOException ioe) { + JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.SAVEFAILED); + } } }); } @@ -174,36 +225,32 @@ } } - private void saveAs() { - try { - JFileChooser chooser = new JFileChooser(); - chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); - File defLocation; - if (documentLocation == null) - defLocation = new File(System.getProperty("user.dir")); - else - defLocation = documentLocation.getParentFile(); + private void saveAs() throws IOException { + JFileChooser chooser = new JFileChooser(); + chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); + File defLocation; + if (documentLocation == null) + defLocation = new File(System.getProperty("user.dir")); + else + defLocation = documentLocation.getParentFile(); - chooser.setCurrentDirectory(defLocation); - int option = chooser.showSaveDialog(JPatchAnimFrame.this); - if (option == JFileChooser.APPROVE_OPTION) { - String path = chooser.getSelectedFile().getPath(); - if (!path.toLowerCase().endsWith(".paf")) - path += ".paf"; - documentLocation = new File(path); - PatchAnimIO.saveFile(documentLocation, document); - documentLocation = chooser.getSelectedFile(); - } - } catch (IOException ioe) { - JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.SAVEFAILED); + chooser.setCurrentDirectory(defLocation); + int option = chooser.showSaveDialog(JPatchAnimFrame.this); + if (option == JFileChooser.APPROVE_OPTION) { + String path = chooser.getSelectedFile().getPath(); + if (!path.toLowerCase().endsWith(".paf")) + path += ".paf"; + documentLocation = new File(path); + PatchAnimIO.saveFile(documentLocation, document); + documentLocation = chooser.getSelectedFile(); } } - private void save() { - try { - PatchAnimIO.saveFile(documentLocation, document); - } catch (IOException ioe) { - JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.SAVEFAILED); - } + private void save() throws IOException { + PatchAnimIO.saveFile(documentLocation, document); } + + private int askSave() { + return JFileChooser.APPROVE_OPTION; + } } Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-01-27 23:19:28 UTC (rev 40) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-01-28 01:21:47 UTC (rev 41) @@ -47,6 +47,7 @@ public static final String ADD = "patchanim.add"; public static final String REMOVE = "patchanim.remove"; public static final String COLOR = "patchanim.color"; + public static final String LOADFAILED = "patchanim.err.loadfailed"; public static final String SAVEFAILED = "patchanim.err.savefailed"; private static ResourceBundle rb = ResourceBundle.getBundle("com/mebigfatguy/patchanim/resources"); Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-01-27 23:19:28 UTC (rev 40) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-01-28 01:21:47 UTC (rev 41) @@ -41,3 +41,4 @@ patchanim.remove = Remove patchanim.color = Color 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-01-27 23:19:25
|
Revision: 40 http://patchanim.svn.sourceforge.net/patchanim/?rev=40&view=rev Author: dbrosius Date: 2008-01-27 15:19:28 -0800 (Sun, 27 Jan 2008) Log Message: ----------- add basic file io Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.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/gui/JPatchAnimFrame.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-01-27 22:29:19 UTC (rev 39) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-01-27 23:19:28 UTC (rev 40) @@ -24,14 +24,20 @@ import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import java.io.File; +import java.io.IOException; import java.util.ResourceBundle; +import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.filechooser.FileFilter; import com.mebigfatguy.patchanim.PatchAnimDocument; +import com.mebigfatguy.patchanim.io.PatchAnimIO; import com.mebigfatguy.patchanim.main.PatchAnimBundle; public class JPatchAnimFrame extends JFrame { @@ -45,6 +51,7 @@ private JMenuItem saveAsItem; private JMenuItem quitItem; private PatchAnimDocument document; + private File documentLocation; public JPatchAnimFrame() { @@ -60,6 +67,7 @@ JPatchAnimPanel patchPanel = new JPatchAnimPanel(); document = new PatchAnimDocument(); + documentLocation = null; PatchPanelMediator mediator = PatchPanelMediator.getMediator(); mediator.setDocument(document); @@ -101,6 +109,29 @@ } }); + openItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + //Ask save + load(); + } + }); + + saveItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + if (documentLocation == null) { + saveAs(); + } else { + save(); + } + } + }); + + saveAsItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + saveAs(); + } + }); + quitItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { dispose(); @@ -108,4 +139,71 @@ } }); } + + private void load() { + try { + JFileChooser chooser = new JFileChooser(); + chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); + chooser.setFileFilter(new FileFilter() { + + @Override + public boolean accept(File f) { + if (f.isDirectory()) + return true; + return (f.getPath().endsWith("paf")); + } + + @Override + public String getDescription() { + return "PatchAnim Files (*.paf)"; + } + }); + chooser.setCurrentDirectory(new File(System.getProperty("user.dir"))); + int option = chooser.showOpenDialog(JPatchAnimFrame.this); + if (option == JFileChooser.APPROVE_OPTION) { + documentLocation = chooser.getSelectedFile(); + document = PatchAnimIO.loadFile(documentLocation); + } + } catch (Exception e) { + JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.SAVEFAILED); + documentLocation = null; + document = new PatchAnimDocument(); + } finally { + PatchPanelMediator mediator = PatchPanelMediator.getMediator(); + mediator.setDocument(document); + } + } + + private void saveAs() { + try { + JFileChooser chooser = new JFileChooser(); + chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); + File defLocation; + if (documentLocation == null) + defLocation = new File(System.getProperty("user.dir")); + else + defLocation = documentLocation.getParentFile(); + + chooser.setCurrentDirectory(defLocation); + int option = chooser.showSaveDialog(JPatchAnimFrame.this); + if (option == JFileChooser.APPROVE_OPTION) { + String path = chooser.getSelectedFile().getPath(); + if (!path.toLowerCase().endsWith(".paf")) + path += ".paf"; + documentLocation = new File(path); + PatchAnimIO.saveFile(documentLocation, document); + documentLocation = chooser.getSelectedFile(); + } + } catch (IOException ioe) { + JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.SAVEFAILED); + } + } + + private void save() { + try { + PatchAnimIO.saveFile(documentLocation, document); + } catch (IOException ioe) { + JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.SAVEFAILED); + } + } } Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2008-01-27 22:29:19 UTC (rev 39) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2008-01-27 23:19:28 UTC (rev 40) @@ -1,15 +1,14 @@ package com.mebigfatguy.patchanim.io; import java.beans.XMLDecoder; -import java.beans.XMLEncoder; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import com.mebigfatguy.patchanim.PatchAnimDocument; @@ -20,23 +19,22 @@ } public static void saveFile(File f, PatchAnimDocument document) throws IOException { - OutputStream os = null; + ObjectOutputStream os = null; try { - os = new BufferedOutputStream(new FileOutputStream(f)); - XMLEncoder encoder = new XMLEncoder(os); - encoder.writeObject(document); - encoder.flush(); + document.setDirty(false); + os = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(f))); + os.writeObject(document); + os.flush(); } finally { Closer.close(os); } } - public static PatchAnimDocument loadFile(File f) throws IOException { - InputStream is = null; + public static PatchAnimDocument loadFile(File f) throws IOException, ClassNotFoundException { + ObjectInputStream is = null; try { - is = new BufferedInputStream(new FileInputStream(f)); - XMLDecoder decoder = new XMLDecoder(is); - return (PatchAnimDocument)decoder.readObject(); + is = new ObjectInputStream(new BufferedInputStream(new FileInputStream(f))); + return (PatchAnimDocument)is.readObject(); } finally { Closer.close(is); } Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-01-27 22:29:19 UTC (rev 39) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-01-27 23:19:28 UTC (rev 40) @@ -47,6 +47,7 @@ public static final String ADD = "patchanim.add"; public static final String REMOVE = "patchanim.remove"; public static final String COLOR = "patchanim.color"; + public static final String SAVEFAILED = "patchanim.err.savefailed"; private static ResourceBundle rb = ResourceBundle.getBundle("com/mebigfatguy/patchanim/resources"); Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-01-27 22:29:19 UTC (rev 39) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-01-27 23:19:28 UTC (rev 40) @@ -40,3 +40,4 @@ patchanim.add = Add patchanim.remove = Remove patchanim.color = Color +patchanim.err.savefailed = Failed saving 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-01-27 22:29:20
|
Revision: 39 http://patchanim.svn.sourceforge.net/patchanim/?rev=39&view=rev Author: dbrosius Date: 2008-01-27 14:29:19 -0800 (Sun, 27 Jan 2008) Log Message: ----------- start adding io routines Added Paths: ----------- trunk/patchanim/src/com/mebigfatguy/patchanim/io/ trunk/patchanim/src/com/mebigfatguy/patchanim/io/Closer.java trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java Added: trunk/patchanim/src/com/mebigfatguy/patchanim/io/Closer.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/Closer.java (rev 0) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/Closer.java 2008-01-27 22:29:19 UTC (rev 39) @@ -0,0 +1,18 @@ +package com.mebigfatguy.patchanim.io; + +import java.io.Closeable; +import java.io.IOException; + +public class Closer { + + private Closer() { + } + + public static void close(Closeable c) { + try { + if (c != null) + c.close(); + } catch (IOException ioe) { + } + } +} Property changes on: trunk/patchanim/src/com/mebigfatguy/patchanim/io/Closer.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java (rev 0) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2008-01-27 22:29:19 UTC (rev 39) @@ -0,0 +1,46 @@ +package com.mebigfatguy.patchanim.io; + +import java.beans.XMLDecoder; +import java.beans.XMLEncoder; +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +import com.mebigfatguy.patchanim.PatchAnimDocument; + +public class PatchAnimIO { + + private PatchAnimIO() { + + } + + public static void saveFile(File f, PatchAnimDocument document) throws IOException { + OutputStream os = null; + try { + os = new BufferedOutputStream(new FileOutputStream(f)); + XMLEncoder encoder = new XMLEncoder(os); + encoder.writeObject(document); + encoder.flush(); + } finally { + Closer.close(os); + } + } + + public static PatchAnimDocument loadFile(File f) throws IOException { + InputStream is = null; + try { + is = new BufferedInputStream(new FileInputStream(f)); + XMLDecoder decoder = new XMLDecoder(is); + return (PatchAnimDocument)decoder.readObject(); + } finally { + Closer.close(is); + } + } + + +} Property changes on: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.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-01-27 04:31:50
|
Revision: 38 http://patchanim.svn.sourceforge.net/patchanim/?rev=38&view=rev Author: dbrosius Date: 2008-01-26 20:31:55 -0800 (Sat, 26 Jan 2008) Log Message: ----------- findbugs fixes Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java trunk/patchanim/src/com/mebigfatguy/patchanim/gui/ActivePatchChangedEvent.java trunk/patchanim/src/com/mebigfatguy/patchanim/gui/DocumentChangedEvent.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/surface/Coordinate.java Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java 2008-01-27 04:21:18 UTC (rev 37) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java 2008-01-27 04:31:55 UTC (rev 38) @@ -26,6 +26,8 @@ public class PatchAnimDocument implements Serializable { + private static final long serialVersionUID = -587863884486252874L; + private boolean dirty; private List<CombinedPatch> patches; private int width; Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/ActivePatchChangedEvent.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/ActivePatchChangedEvent.java 2008-01-27 04:21:18 UTC (rev 37) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/ActivePatchChangedEvent.java 2008-01-27 04:31:55 UTC (rev 38) @@ -23,6 +23,8 @@ import com.mebigfatguy.patchanim.surface.CombinedPatch; public class ActivePatchChangedEvent extends EventObject { + private static final long serialVersionUID = -6329025951907079541L; + private CombinedPatch patch; public ActivePatchChangedEvent(Object src, CombinedPatch activePatch) { Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/DocumentChangedEvent.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/DocumentChangedEvent.java 2008-01-27 04:21:18 UTC (rev 37) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/DocumentChangedEvent.java 2008-01-27 04:31:55 UTC (rev 38) @@ -23,6 +23,8 @@ import com.mebigfatguy.patchanim.PatchAnimDocument; public class DocumentChangedEvent extends EventObject { + private static final long serialVersionUID = 7694516648407911200L; + private PatchAnimDocument document; public DocumentChangedEvent(Object src, PatchAnimDocument d) { Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java 2008-01-27 04:21:18 UTC (rev 37) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JColorControlPatchPanel.java 2008-01-27 04:31:55 UTC (rev 38) @@ -42,6 +42,8 @@ public class JColorControlPatchPanel extends JPanel implements PatchDecorator { + private static final long serialVersionUID = -2524694507912574529L; + private PatchCoords coords; private PatchColor color; private JPatchSamplePanel sample; @@ -67,6 +69,7 @@ colorLabel = new JLabel(rb.getString(PatchAnimBundle.COLOR)); colorField = new JTextField(new DoubleDocument(), "", 4); + colorLabel.setLabelFor(colorField); add(Box.createVerticalGlue()); JPanel p = new JPanel(); Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-01-27 04:21:18 UTC (rev 37) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-01-27 04:31:55 UTC (rev 38) @@ -20,6 +20,8 @@ import java.awt.BorderLayout; import java.awt.Container; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.ResourceBundle; @@ -34,6 +36,8 @@ public class JPatchAnimFrame extends JFrame { + private static final long serialVersionUID = -4610407923936772733L; + private JMenuItem newItem; private JMenuItem openItem; private JMenuItem closeItem; @@ -64,7 +68,7 @@ pack(); } - public void initMenus() { + private void initMenus() { ResourceBundle rb = PatchAnimBundle.getBundle(); JMenuBar mb = new JMenuBar(); JMenu fileMenu = new JMenu(rb.getString(PatchAnimBundle.FILE)); @@ -96,5 +100,12 @@ System.exit(0); } }); + + quitItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + dispose(); + System.exit(0); + } + }); } } Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimPanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimPanel.java 2008-01-27 04:21:18 UTC (rev 37) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimPanel.java 2008-01-27 04:31:55 UTC (rev 38) @@ -29,11 +29,9 @@ public class JPatchAnimPanel extends JPanel { + private static final long serialVersionUID = 7719900566976553103L; private JPatchControlPanel ctrl; private JPatchSamplePanel sample; - private JColorControlPatchPanel redPatch; - private JColorControlPatchPanel greenPatch; - private JColorControlPatchPanel bluePatch; public JPatchAnimPanel() { initComponents(); @@ -63,9 +61,9 @@ q = new JPanel(); { q.setLayout(new BoxLayout(q, BoxLayout.X_AXIS)); - redPatch = new JColorControlPatchPanel(PatchColor.Red); - greenPatch = new JColorControlPatchPanel(PatchColor.Green); - bluePatch = new JColorControlPatchPanel(PatchColor.Blue); + JColorControlPatchPanel redPatch = new JColorControlPatchPanel(PatchColor.Red); + JColorControlPatchPanel greenPatch = new JColorControlPatchPanel(PatchColor.Green); + JColorControlPatchPanel bluePatch = new JColorControlPatchPanel(PatchColor.Blue); q.add(Box.createHorizontalGlue()); q.add(redPatch); Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java 2008-01-27 04:21:18 UTC (rev 37) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java 2008-01-27 04:31:55 UTC (rev 38) @@ -37,8 +37,6 @@ import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingUtilities; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; import com.mebigfatguy.patchanim.AnimationType; import com.mebigfatguy.patchanim.OutOfBoundsColor; @@ -47,6 +45,8 @@ public class JPatchControlPanel extends JPanel { + private static final long serialVersionUID = -5968231995166721151L; + private PatchAnimDocument document; private JTextField widthField; private JTextField heightField; Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java 2008-01-27 04:21:18 UTC (rev 37) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java 2008-01-27 04:31:55 UTC (rev 38) @@ -40,6 +40,8 @@ import com.mebigfatguy.patchanim.surface.CombinedPatch; public class JPatchListPanel extends JPanel { + private static final long serialVersionUID = -6673383252840039387L; + private JList patchList; private PatchListModel patchListModel; private JButton addButton; Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java 2008-01-27 04:21:18 UTC (rev 37) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java 2008-01-27 04:31:55 UTC (rev 38) @@ -38,6 +38,8 @@ import com.mebigfatguy.patchanim.surface.PatchGenerator; public class JPatchSamplePanel extends JPanel { + private static final long serialVersionUID = 8057501623261814175L; + private static final int SAMPLE_SIZE = 200; private PatchColor color; private Color rgb; Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java 2008-01-27 04:21:18 UTC (rev 37) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java 2008-01-27 04:31:55 UTC (rev 38) @@ -41,6 +41,8 @@ public class JTestFrame extends JFrame { + private static final long serialVersionUID = -7975149184522257748L; + private Thread animThread = null; private TestPanel testPanel = null; private int tweenCount; @@ -163,6 +165,8 @@ } class TestPanel extends JPanel { + private static final long serialVersionUID = 6268304008663415749L; + public TestPanel() { Dimension d = new Dimension(width, height); setMinimumSize(d); Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/Coordinate.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/surface/Coordinate.java 2008-01-27 04:21:18 UTC (rev 37) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/surface/Coordinate.java 2008-01-27 04:31:55 UTC (rev 38) @@ -22,6 +22,8 @@ public class Coordinate implements Serializable { + private static final long serialVersionUID = 5211344767856486552L; + private double x, y, color; public Coordinate(double xPos, double yPos, double colorVal) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-01-27 04:21:14
|
Revision: 37 http://patchanim.svn.sourceforge.net/patchanim/?rev=37&view=rev Author: dbrosius Date: 2008-01-26 20:21:18 -0800 (Sat, 26 Jan 2008) Log Message: ----------- better grammar Modified Paths: -------------- trunk/patchanim/htdocs/index.html Modified: trunk/patchanim/htdocs/index.html =================================================================== --- trunk/patchanim/htdocs/index.html 2008-01-27 04:16:18 UTC (rev 36) +++ trunk/patchanim/htdocs/index.html 2008-01-27 04:21:18 UTC (rev 37) @@ -16,7 +16,7 @@ <p>Thanks for your interest in PatchAnim.</p> <p>This tool generates a series of bitmaps that are color blends calculated from bezier surface patch values, where the z coordinate of the patch corresponds to the color intensity that is rendered at that u,v parameter. - There are three patches available to tailor, one for red, green and blue, each. These three patches are + There are three patches available to tailor, one for red, green and blue. These three patches are combined into one blend. A series of these patches can be created, and then the software creates a tween between them to get a nicely continuous animated blend.</p> <p><b>Jan 27, 2008 - This tool is not finished at this time, although the patch animations work</b><br/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-01-27 04:16:19
|
Revision: 36 http://patchanim.svn.sourceforge.net/patchanim/?rev=36&view=rev Author: dbrosius Date: 2008-01-26 20:16:18 -0800 (Sat, 26 Jan 2008) Log Message: ----------- more verbage Modified Paths: -------------- trunk/patchanim/htdocs/index.html Modified: trunk/patchanim/htdocs/index.html =================================================================== --- trunk/patchanim/htdocs/index.html 2008-01-27 03:54:45 UTC (rev 35) +++ trunk/patchanim/htdocs/index.html 2008-01-27 04:16:18 UTC (rev 36) @@ -19,7 +19,22 @@ There are three patches available to tailor, one for red, green and blue, each. These three patches are combined into one blend. A series of these patches can be created, and then the software creates a tween between them to get a nicely continuous animated blend.</p> - <p><b>This tool is not finished at this time, it is a work in process.</b></p> + <p><b>Jan 27, 2008 - This tool is not finished at this time, although the patch animations work</b><br/> + Still to be done: + <ul> + <li>PatchAnim file io</li> + <li>Export to GIF, MPEG, etc</li> + <li>redraw glitches</li> + <li>Performance Improvements</li> + <li>Patch Library</li> + <li>Color Swatch for editing values</li> + <li>Bulk editing of control point values</li> + <li>Patch Name editing</li> + <li>Patch reordering</li> + <li>Patch cloneing</li> + <li>....and much more</li> + </ul> + </p> <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"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-01-27 03:54:41
|
Revision: 35 http://patchanim.svn.sourceforge.net/patchanim/?rev=35&view=rev Author: dbrosius Date: 2008-01-26 19:54:45 -0800 (Sat, 26 Jan 2008) Log Message: ----------- Add IntegerDocument back in for width, height, tween count, and hook up those settings to listeners. Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java Added Paths: ----------- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/IntegerDocument.java Added: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/IntegerDocument.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/IntegerDocument.java (rev 0) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/IntegerDocument.java 2008-01-27 03:54:45 UTC (rev 35) @@ -0,0 +1,46 @@ +/* + * 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; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.swing.text.AttributeSet; +import javax.swing.text.BadLocationException; +import javax.swing.text.PlainDocument; + + +public class IntegerDocument extends PlainDocument +{ + private static final long serialVersionUID = 4081253155490713536L; + + private static final Pattern INTEGERPATTERN = Pattern.compile("-?[0-9]*"); + + @Override + public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { + String start = getText(0, offs); + String end = getText(offs, this.getLength() - offs); + String newIntegerString = (start + str + end).trim(); + + Matcher m = INTEGERPATTERN.matcher(newIntegerString); + if (m.matches()) { + super.insertString(offs, str, a); + } + } +} \ No newline at end of file Property changes on: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/IntegerDocument.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java 2008-01-27 03:33:55 UTC (rev 34) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java 2008-01-27 03:54:45 UTC (rev 35) @@ -21,6 +21,8 @@ import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.ResourceBundle; @@ -35,6 +37,8 @@ import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingUtilities; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; import com.mebigfatguy.patchanim.AnimationType; import com.mebigfatguy.patchanim.OutOfBoundsColor; @@ -69,7 +73,7 @@ { widthLabel = new JLabel(rb.getString(PatchAnimBundle.WIDTH)); - widthField = new JTextField(8); + widthField = new JTextField(new IntegerDocument(), "", 8); widthLabel.setLabelFor(widthField); JPanel p = Utils.createFormPanel(widthLabel, widthField); @@ -79,7 +83,7 @@ add(Box.createVerticalStrut(5)); { heightLabel = new JLabel(rb.getString(PatchAnimBundle.HEIGHT)); - heightField = new JTextField(8); + heightField = new JTextField(new IntegerDocument(), "", 8); heightLabel.setLabelFor(heightField); JPanel p = Utils.createFormPanel(heightLabel, heightField); @@ -111,7 +115,7 @@ add(Box.createVerticalStrut(5)); { tweenFramesLabel = new JLabel(rb.getString(PatchAnimBundle.TWEENFRAMES)); - tweenFramesField = new JTextField(8); + tweenFramesField = new JTextField(new IntegerDocument(), "", 8); tweenFramesLabel.setLabelFor(tweenFramesField); JPanel p = Utils.createFormPanel(tweenFramesLabel, tweenFramesField); Utils.limitPanelHeight(p, tweenFramesField); @@ -150,6 +154,49 @@ } }); + widthField.addFocusListener(new FocusAdapter() { + + @Override + public void focusLost(FocusEvent arg0) { + try { + document.setWidth(Integer.parseInt(widthField.getText())); + } catch (NumberFormatException nfe) { + document.setWidth(0); + } + PatchPanelMediator mediator = PatchPanelMediator.getMediator(); + mediator.fireSettingsChanged(); + } + }); + + + heightField.addFocusListener(new FocusAdapter() { + + @Override + public void focusLost(FocusEvent arg0) { + try { + document.setHeight(Integer.parseInt(heightField.getText())); + } catch (NumberFormatException nfe) { + document.setHeight(0); + } + PatchPanelMediator mediator = PatchPanelMediator.getMediator(); + mediator.fireSettingsChanged(); + } + }); + + tweenFramesField.addFocusListener(new FocusAdapter() { + + @Override + public void focusLost(FocusEvent arg0) { + try { + document.setTweenCount(Integer.parseInt(tweenFramesField.getText())); + } catch (NumberFormatException nfe) { + document.setTweenCount(0); + } + PatchPanelMediator mediator = PatchPanelMediator.getMediator(); + mediator.fireSettingsChanged(); + } + }); + animationCB.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent ie) { Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java 2008-01-27 03:33:55 UTC (rev 34) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java 2008-01-27 03:54:45 UTC (rev 35) @@ -26,6 +26,7 @@ import java.awt.image.BufferedImage; import java.lang.reflect.InvocationTargetException; import java.util.List; +import java.util.ResourceBundle; import javax.swing.JFrame; import javax.swing.JPanel; @@ -34,6 +35,7 @@ import com.mebigfatguy.patchanim.AnimationType; import com.mebigfatguy.patchanim.OutOfBoundsColor; import com.mebigfatguy.patchanim.PatchAnimDocument; +import com.mebigfatguy.patchanim.main.PatchAnimBundle; import com.mebigfatguy.patchanim.surface.CombinedPatch; import com.mebigfatguy.patchanim.surface.PatchGenerator; @@ -58,6 +60,13 @@ type = document.getAnimationType(); oob = document.getOutOfBoundsColor(); patches = document.getPatches(); + + if (width == 0) + width = 100; + if (height == 0) + height = 100; + if (tweenCount == 0) + tweenCount = 1; initComponents(); initListeners(); @@ -135,10 +144,12 @@ } private void initComponents() { + ResourceBundle rb = PatchAnimBundle.getBundle(); testPanel = new TestPanel(); setLayout(new BorderLayout(4, 4)); add(testPanel, BorderLayout.CENTER); pack(); + setTitle(rb.getString(PatchAnimBundle.TEST)); } private void initListeners() { Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-01-27 03:33:55 UTC (rev 34) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-01-27 03:54:45 UTC (rev 35) @@ -48,7 +48,6 @@ public static final String REMOVE = "patchanim.remove"; public static final String COLOR = "patchanim.color"; - private static ResourceBundle rb = ResourceBundle.getBundle("com/mebigfatguy/patchanim/resources"); private PatchAnimBundle() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-01-27 03:34:19
|
Revision: 34 http://patchanim.svn.sourceforge.net/patchanim/?rev=34&view=rev Author: dbrosius Date: 2008-01-26 19:33:55 -0800 (Sat, 26 Jan 2008) Log Message: ----------- hook up out of bounds colors, and add settings changed listeners support Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/AnimationType.java trunk/patchanim/src/com/mebigfatguy/patchanim/OutOfBoundsColor.java trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.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/PatchPanelMediator.java trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java Added Paths: ----------- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/SettingsChangedEvent.java trunk/patchanim/src/com/mebigfatguy/patchanim/gui/SettingsChangedListener.java Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/AnimationType.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/AnimationType.java 2008-01-27 01:59:07 UTC (rev 33) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/AnimationType.java 2008-01-27 03:33:55 UTC (rev 34) @@ -18,8 +18,18 @@ */ package com.mebigfatguy.patchanim; +import java.util.ResourceBundle; + +import com.mebigfatguy.patchanim.main.PatchAnimBundle; + public enum AnimationType { None, Cycle, Wave; + + @Override + public String toString() { + ResourceBundle rb = PatchAnimBundle.getBundle(); + return rb.getString(PatchAnimBundle.ROOT + name().toLowerCase()); + } } Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/OutOfBoundsColor.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/OutOfBoundsColor.java 2008-01-27 01:59:07 UTC (rev 33) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/OutOfBoundsColor.java 2008-01-27 03:33:55 UTC (rev 34) @@ -18,7 +18,17 @@ */ package com.mebigfatguy.patchanim; +import java.util.ResourceBundle; + +import com.mebigfatguy.patchanim.main.PatchAnimBundle; + public enum OutOfBoundsColor { Clip, Roll; + + @Override + public String toString() { + ResourceBundle rb = PatchAnimBundle.getBundle(); + return rb.getString(PatchAnimBundle.ROOT + name().toLowerCase()); + } } Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java 2008-01-27 01:59:07 UTC (rev 33) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java 2008-01-27 03:33:55 UTC (rev 34) @@ -21,6 +21,8 @@ import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; import java.util.ResourceBundle; import javax.swing.BorderFactory; @@ -34,6 +36,8 @@ import javax.swing.JTextField; import javax.swing.SwingUtilities; +import com.mebigfatguy.patchanim.AnimationType; +import com.mebigfatguy.patchanim.OutOfBoundsColor; import com.mebigfatguy.patchanim.PatchAnimDocument; import com.mebigfatguy.patchanim.main.PatchAnimBundle; @@ -85,9 +89,9 @@ add(Box.createVerticalStrut(5)); { animationLabel = new JLabel(rb.getString(PatchAnimBundle.ANIMATION)); - animationCB = new JComboBox(new Object[] { rb.getString(PatchAnimBundle.NONE), - rb.getString(PatchAnimBundle.CYCLE), - rb.getString(PatchAnimBundle.WAVE) }); + animationCB = new JComboBox(new Object[] { AnimationType.None, + AnimationType.Cycle, + AnimationType.Wave }); animationLabel.setLabelFor(animationCB); JPanel p = Utils.createFormPanel(animationLabel, animationCB); @@ -97,8 +101,8 @@ add(Box.createVerticalStrut(5)); { outOfBoundsLabel = new JLabel(rb.getString(PatchAnimBundle.OUTOFBOUNDSCOLOR)); - outOfBoundsColorCB = new JComboBox(new Object[] { rb.getString(PatchAnimBundle.CLIP), - rb.getString(PatchAnimBundle.ROLL) }); + outOfBoundsColorCB = new JComboBox(new Object[] { OutOfBoundsColor.Clip, + OutOfBoundsColor.Roll }); outOfBoundsLabel.setLabelFor(outOfBoundsColorCB); JPanel p = Utils.createFormPanel(outOfBoundsLabel, outOfBoundsColorCB); Utils.limitPanelHeight(p, outOfBoundsColorCB); @@ -146,6 +150,28 @@ } }); + animationCB.addItemListener(new ItemListener() { + + public void itemStateChanged(ItemEvent ie) { + if (ie.getStateChange() == ItemEvent.SELECTED) { + document.setAnimationType((AnimationType)ie.getItem()); + PatchPanelMediator mediator = PatchPanelMediator.getMediator(); + mediator.fireSettingsChanged(); + } + } + }); + + outOfBoundsColorCB.addItemListener(new ItemListener() { + + public void itemStateChanged(ItemEvent ie) { + if (ie.getStateChange() == ItemEvent.SELECTED) { + document.setOutOfBoundsColor((OutOfBoundsColor)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/gui/JPatchSamplePanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java 2008-01-27 01:59:07 UTC (rev 33) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java 2008-01-27 03:33:55 UTC (rev 34) @@ -31,6 +31,8 @@ import javax.swing.JPanel; import javax.swing.SwingUtilities; +import com.mebigfatguy.patchanim.OutOfBoundsColor; +import com.mebigfatguy.patchanim.PatchAnimDocument; import com.mebigfatguy.patchanim.PatchColor; import com.mebigfatguy.patchanim.surface.CombinedPatch; import com.mebigfatguy.patchanim.surface.PatchGenerator; @@ -39,6 +41,7 @@ private static final int SAMPLE_SIZE = 200; private PatchColor color; private Color rgb; + private OutOfBoundsColor oob; private BufferedImage image; private PatchDecorator decorator; @@ -90,30 +93,53 @@ recalcImage(color, currentPatch); } } - }); + }); + mediator.addDocumentChangedListener(new DocumentChangedListener() { + public void documentChanged(DocumentChangedEvent dce) { + PatchAnimDocument doc = dce.getDocument(); + oob = doc.getOutOfBoundsColor(); + PatchPanelMediator mediator = PatchPanelMediator.getMediator(); + recalcImage(color, mediator.getActivePatch()); + } + }); + mediator.addSettingsChangedListener(new SettingsChangedListener() { + public void settingsChanged(SettingsChangedEvent sce) { + oob = sce.getDocument().getOutOfBoundsColor(); + PatchPanelMediator mediator = PatchPanelMediator.getMediator(); + recalcImage(color, mediator.getActivePatch()); + } + }); } public void recalcImage(final PatchColor color, final CombinedPatch patch) { Thread t = new Thread(new Runnable() { public void run() { if (color == PatchColor.Combined) { - PatchGenerator.recalcCombinedImage(patch, image); + PatchGenerator.recalcCombinedImage(patch, image, oob); } else { - PatchGenerator.recalcIndexedImage(color, patch, image); + PatchGenerator.recalcIndexedImage(color, patch, image, oob); } - SwingUtilities.invokeLater(new Runnable() { - public void run() { - invalidate(); - revalidate(); - repaint(); - } - }); + redraw(); } }); t.start(); } + private void redraw() { + try { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + invalidate(); + revalidate(); + repaint(); + } + }); + } catch (Exception ie) { + //OK + } + } + @Override public void paintComponent(Graphics g) { Rectangle bounds = getBounds(); Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java 2008-01-27 01:59:07 UTC (rev 33) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java 2008-01-27 03:33:55 UTC (rev 34) @@ -32,6 +32,7 @@ import javax.swing.SwingUtilities; import com.mebigfatguy.patchanim.AnimationType; +import com.mebigfatguy.patchanim.OutOfBoundsColor; import com.mebigfatguy.patchanim.PatchAnimDocument; import com.mebigfatguy.patchanim.surface.CombinedPatch; import com.mebigfatguy.patchanim.surface.PatchGenerator; @@ -44,6 +45,7 @@ private int width; private int height; private AnimationType type; + private OutOfBoundsColor oob; private List<CombinedPatch> patches; private BufferedImage image; @@ -54,6 +56,7 @@ width = document.getWidth(); height = document.getHeight(); type = document.getAnimationType(); + oob = document.getOutOfBoundsColor(); patches = document.getPatches(); initComponents(); @@ -68,7 +71,7 @@ animThread = new Thread(new Runnable() { public void run() { try { - PatchGenerator.recalcCombinedImage(patches.get(0), image); + PatchGenerator.recalcCombinedImage(patches.get(0), image, oob); while (!Thread.interrupted()) { testPanel.redraw(); int lastPatch = patches.size() - 1; @@ -78,7 +81,7 @@ CombinedPatch endPatch = patches.get(p+1); for (int t = 0; t < tweenCount; t++) { CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)tweenCount); - PatchGenerator.recalcCombinedImage(tweenPatch, image); + PatchGenerator.recalcCombinedImage(tweenPatch, image, oob); long now = System.currentTimeMillis(); long sleepTime = 100 - (now - lastRedraw); if (sleepTime > 0) @@ -97,7 +100,7 @@ CombinedPatch endPatch = patches.get(p); for (int t = tweenCount - 1; t >= 0; t--) { CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)tweenCount); - PatchGenerator.recalcCombinedImage(tweenPatch, image); + PatchGenerator.recalcCombinedImage(tweenPatch, image, oob); long now = System.currentTimeMillis(); long sleepTime = 100 - (now - lastRedraw); if (sleepTime > 0) Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchPanelMediator.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchPanelMediator.java 2008-01-27 01:59:07 UTC (rev 33) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchPanelMediator.java 2008-01-27 03:33:55 UTC (rev 34) @@ -31,6 +31,7 @@ private CombinedPatch activePatch; private Set<DocumentChangedListener> dclisteners = new HashSet<DocumentChangedListener>(); private Set<ActivePatchChangedListener> apclisteners = new HashSet<ActivePatchChangedListener>(); + private Set<SettingsChangedListener> sclisteners = new HashSet<SettingsChangedListener>(); private PatchPanelMediator() { } @@ -58,6 +59,17 @@ apclisteners.add(apcl); } + public void addSettingsChangedListener(SettingsChangedListener scl) { + sclisteners.add(scl); + } + + public void fireSettingsChanged() { + SettingsChangedEvent sce = new SettingsChangedEvent(this, document); + for (SettingsChangedListener scl : sclisteners) { + scl.settingsChanged(sce); + } + } + public CombinedPatch getActivePatch() { return activePatch; } Added: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/SettingsChangedEvent.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/SettingsChangedEvent.java (rev 0) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/SettingsChangedEvent.java 2008-01-27 03:33:55 UTC (rev 34) @@ -0,0 +1,38 @@ +/* + * 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; + +import java.util.EventObject; + +import com.mebigfatguy.patchanim.PatchAnimDocument; + +public class SettingsChangedEvent extends EventObject { + private static final long serialVersionUID = 2005167344637800832L; + + private PatchAnimDocument doc; + + public SettingsChangedEvent(Object src, PatchAnimDocument document) { + super(src); + doc = document; + } + + public PatchAnimDocument getDocument() { + return doc; + } +} Property changes on: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/SettingsChangedEvent.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/SettingsChangedListener.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/SettingsChangedListener.java (rev 0) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/SettingsChangedListener.java 2008-01-27 03:33:55 UTC (rev 34) @@ -0,0 +1,23 @@ +/* + * 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; + +public interface SettingsChangedListener { + void settingsChanged(SettingsChangedEvent sce); +} Property changes on: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/SettingsChangedListener.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-01-27 01:59:07 UTC (rev 33) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-01-27 03:33:55 UTC (rev 34) @@ -22,6 +22,7 @@ public class PatchAnimBundle { + public static final String ROOT = "patchanim."; public static final String TITLE = "patchanim.title"; public static final String FILE = "patchanim.file"; public static final String NEW = "patchanim.new"; Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java 2008-01-27 01:59:07 UTC (rev 33) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/surface/PatchGenerator.java 2008-01-27 03:33:55 UTC (rev 34) @@ -23,6 +23,7 @@ import java.awt.image.BufferedImage; import java.awt.image.IndexColorModel; +import com.mebigfatguy.patchanim.OutOfBoundsColor; import com.mebigfatguy.patchanim.PatchColor; public class PatchGenerator { @@ -30,7 +31,10 @@ private PatchGenerator() { } - public static void recalcCombinedImage(CombinedPatch patch, BufferedImage image) { + public static void recalcCombinedImage(CombinedPatch patch, BufferedImage image, OutOfBoundsColor oob) { + if (patch == null) + return; + PatchCoords[] coords = new PatchCoords[3]; coords[0] = patch.getPatch(PatchColor.Red); @@ -86,10 +90,18 @@ for (int k = 0; k < 3; k++) { iValue[k] = (int)value[k]; - if (iValue[k] > 255) - iValue[k] = 255; - else if (iValue[k] < 0) - iValue[k] = 0; + if (iValue[k] > 255) { + if (oob == OutOfBoundsColor.Clip) + iValue[k] = 255; + else + iValue[k] = iValue[k] & 0x00FF; + } + else if (iValue[k] < 0) { + if (oob == OutOfBoundsColor.Clip) + iValue[k] = 0; + else + iValue[k] = iValue[k] & 0x00FF; + } } int compValue = 0xFF000000 | (iValue[0] << 16) | (iValue[1] << 8) | iValue[2]; image.setRGB(iu, iv, compValue); @@ -97,7 +109,10 @@ } } - public static void recalcIndexedImage(PatchColor color, CombinedPatch patch, BufferedImage image) { + public static void recalcIndexedImage(PatchColor color, CombinedPatch patch, BufferedImage image, OutOfBoundsColor oob) { + if (patch == null) + return; + PatchCoords coords = patch.getPatch(color); double u, u2, u3, oneMinusU, oneMinusU2, oneMinusU3; @@ -142,10 +157,18 @@ } int iValue = (int)value; - if (iValue > 255) - iValue = 255; - else if (iValue < 0) - iValue = 0; + if (iValue > 255) { + if (oob == OutOfBoundsColor.Clip) + iValue = 255; + else + iValue = iValue & 0x00FF; + } + else if (iValue < 0) { + if (oob == OutOfBoundsColor.Clip) + iValue = 0; + else + iValue = iValue & 0x00FF; + } if (color == PatchColor.Red) iValue <<= 16; else if (color == PatchColor.Green) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-01-27 01:59:04
|
Revision: 33 http://patchanim.svn.sourceforge.net/patchanim/?rev=33&view=rev Author: dbrosius Date: 2008-01-26 17:59:07 -0800 (Sat, 26 Jan 2008) Log Message: ----------- implement Animation Repeat types, None, Cycle and Wave Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java 2008-01-27 01:46:13 UTC (rev 32) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java 2008-01-27 01:59:07 UTC (rev 33) @@ -31,6 +31,7 @@ import javax.swing.JPanel; import javax.swing.SwingUtilities; +import com.mebigfatguy.patchanim.AnimationType; import com.mebigfatguy.patchanim.PatchAnimDocument; import com.mebigfatguy.patchanim.surface.CombinedPatch; import com.mebigfatguy.patchanim.surface.PatchGenerator; @@ -42,6 +43,7 @@ private int tweenCount; private int width; private int height; + private AnimationType type; private List<CombinedPatch> patches; private BufferedImage image; @@ -51,6 +53,7 @@ tweenCount = document.getTweenCount(); width = document.getWidth(); height = document.getHeight(); + type = document.getAnimationType(); patches = document.getPatches(); initComponents(); @@ -84,6 +87,26 @@ lastRedraw = now; } } + + 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); + PatchGenerator.recalcCombinedImage(tweenPatch, image); + long now = System.currentTimeMillis(); + long sleepTime = 100 - (now - lastRedraw); + if (sleepTime > 0) + Thread.sleep(sleepTime); + testPanel.redraw(); + lastRedraw = now; + } + } + } } } catch (InterruptedException ie) { //OK This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-01-27 01:46:08
|
Revision: 32 http://patchanim.svn.sourceforge.net/patchanim/?rev=32&view=rev Author: dbrosius Date: 2008-01-26 17:46:13 -0800 (Sat, 26 Jan 2008) Log Message: ----------- add copyright Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java 2008-01-27 01:45:15 UTC (rev 31) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java 2008-01-27 01:46:13 UTC (rev 32) @@ -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; import java.awt.BorderLayout; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-01-27 01:45:10
|
Revision: 31 http://patchanim.svn.sourceforge.net/patchanim/?rev=31&view=rev Author: dbrosius Date: 2008-01-26 17:45:15 -0800 (Sat, 26 Jan 2008) Log Message: ----------- Removed file/folder Removed Paths: ------------- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/IntegerDocument.java Deleted: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/IntegerDocument.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/IntegerDocument.java 2008-01-27 01:44:22 UTC (rev 30) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/IntegerDocument.java 2008-01-27 01:45:15 UTC (rev 31) @@ -1,46 +0,0 @@ -/* - * 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; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.swing.text.AttributeSet; -import javax.swing.text.BadLocationException; -import javax.swing.text.PlainDocument; - - -public class IntegerDocument extends PlainDocument -{ - private static final long serialVersionUID = -1526356835854424028L; - - private static final Pattern INTEGERPATTERN = Pattern.compile("-?(:?-?[0-9]*)?"); - - @Override - public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { - String start = getText(0, offs); - String end = getText(offs, this.getLength() - offs); - String newIntegerString = (start + str + end).trim(); - - Matcher m = INTEGERPATTERN.matcher(newIntegerString); - if (m.matches()) { - super.insertString(offs, str, a); - } - } -} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |