[Pixelle-commit] SF.net SVN: pixelle: [60] trunk/pixelle/src/com/mebigfatguy/pixelle
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2008-06-23 01:14:40
|
Revision: 60
http://pixelle.svn.sourceforge.net/pixelle/?rev=60&view=rev
Author: dbrosius
Date: 2008-06-22 18:14:48 -0700 (Sun, 22 Jun 2008)
Log Message:
-----------
use the PixelleTransformException rather than the hookey return null paradigm.
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-06-23 01:12:59 UTC (rev 59)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-06-23 01:14:48 UTC (rev 60)
@@ -43,7 +43,7 @@
algorithms = algos;
}
- public PixelleImage transform() {
+ public PixelleImage transform() throws PixelleTransformException {
try {
/** eventually allow for gui to set width/height */
PixelleImage destImage = new PixelleImage(new BufferedImage(srcImage.getWidth(), srcImage.getHeight(), BufferedImage.TYPE_4BYTE_ABGR));
@@ -90,7 +90,7 @@
return destImage;
} catch (Exception e) {
- return null;
+ throw new PixelleTransformException("Failed transforming the image", e);
}
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java 2008-06-23 01:12:59 UTC (rev 59)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java 2008-06-23 01:14:48 UTC (rev 60)
@@ -21,10 +21,12 @@
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
+import javax.swing.JOptionPane;
import com.mebigfatguy.pixelle.PixelleBundle;
import com.mebigfatguy.pixelle.PixelleFrame;
import com.mebigfatguy.pixelle.PixelleImage;
+import com.mebigfatguy.pixelle.PixelleTransformException;
import com.mebigfatguy.pixelle.PixelleTransformer;
import com.mebigfatguy.pixelle.dialogs.PixelleExpressionDialog;
@@ -39,17 +41,21 @@
}
public void actionPerformed(ActionEvent e) {
- PixelleExpressionDialog d = new PixelleExpressionDialog(frame);
- d.setLocationRelativeTo(frame);
- d.setModal(true);
- d.setVisible(true);
- if (d.isOK()) {
- PixelleTransformer transformer = new PixelleTransformer(frame.getImage(), d.getAlgorithms());
- PixelleImage dstImage = transformer.transform();
- if (dstImage != null) {
- PixelleFrame f = new PixelleFrame(dstImage);
- f.setVisible(true);
+ try {
+ PixelleExpressionDialog d = new PixelleExpressionDialog(frame);
+ d.setLocationRelativeTo(frame);
+ d.setModal(true);
+ d.setVisible(true);
+ if (d.isOK()) {
+ PixelleTransformer transformer = new PixelleTransformer(frame.getImage(), d.getAlgorithms());
+ PixelleImage dstImage = transformer.transform();
+ if (dstImage != null) {
+ PixelleFrame f = new PixelleFrame(dstImage);
+ f.setVisible(true);
+ }
}
+ } catch (PixelleTransformException pe) {
+ JOptionPane.showMessageDialog(frame, pe.getMessage());
}
}
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|