[Pixelle-commit] SF.net SVN: pixelle: [52] trunk/pixelle/src/com/mebigfatguy/pixelle
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2008-06-22 14:44:35
|
Revision: 52
http://pixelle.svn.sourceforge.net/pixelle/?rev=52&view=rev
Author: dbrosius
Date: 2008-06-22 07:44:43 -0700 (Sun, 22 Jun 2008)
Log Message:
-----------
get out of bounds options working
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/OutOfBoundsOption.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OptionsAction.java
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleOptionsDialog.java
trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteABGR.java
trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteBGR.java
trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalByteGray.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/OutOfBoundsOption.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/OutOfBoundsOption.java 2008-06-22 14:27:07 UTC (rev 51)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/OutOfBoundsOption.java 2008-06-22 14:44:43 UTC (rev 52)
@@ -25,7 +25,7 @@
BorderColor,
WrapColor;
- private Color color;
+ private Color color = Color.WHITE;
public Color getColor() {
return color;
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java 2008-06-22 14:27:07 UTC (rev 51)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java 2008-06-22 14:44:43 UTC (rev 52)
@@ -26,12 +26,14 @@
protected DataBuffer buffer;
protected int width;
protected int height;
+ protected OutOfBoundsOption oobOption;
- public PixelleEval(PixelleImage image) {
+ public PixelleEval(PixelleImage image, OutOfBoundsOption option) {
srcImage = image;
buffer = image.getBuffer();
width = image.getWidth();
height = image.getHeight();
+ oobOption = option;
}
public abstract double getRedValue(int x, int y);
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java 2008-06-22 14:27:07 UTC (rev 51)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java 2008-06-22 14:44:43 UTC (rev 52)
@@ -25,14 +25,24 @@
public class PixelleEvalFactory {
+ private static OutOfBoundsOption oobOption = OutOfBoundsOption.BorderColor;
+
private PixelleEvalFactory() {
}
+ public static OutOfBoundsOption getOutOfBoundsOption() {
+ return oobOption;
+ }
+
+ public static void setOutOfBoundsOption(OutOfBoundsOption option) {
+ oobOption = option;
+ }
+
public static PixelleEval create(PixelleImage image) throws IllegalArgumentException {
switch (image.getType()) {
case BufferedImage.TYPE_3BYTE_BGR:
- return new PixelleEval3ByteBGR(image);
+ return new PixelleEval3ByteBGR(image, oobOption);
case BufferedImage.TYPE_4BYTE_ABGR:
break;
@@ -41,7 +51,7 @@
break;
case BufferedImage.TYPE_BYTE_GRAY:
- return new PixelleEvalByteGray(image);
+ return new PixelleEvalByteGray(image, oobOption);
case BufferedImage.TYPE_INT_ARGB:
break;
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-06-22 14:27:07 UTC (rev 51)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-06-22 14:44:43 UTC (rev 52)
@@ -49,7 +49,7 @@
PixelleImage destImage = new PixelleImage(new BufferedImage(srcImage.getWidth(), srcImage.getHeight(), BufferedImage.TYPE_4BYTE_ABGR));
PixelleEval srcPE = PixelleEvalFactory.create(srcImage);
- PixelleEval3ByteABGR destPE = new PixelleEval3ByteABGR(destImage);
+ PixelleEval3ByteABGR destPE = new PixelleEval3ByteABGR(destImage, OutOfBoundsOption.BorderColor);
PixelleClassLoader pcl = AccessController.doPrivileged(new PrivilegedAction<PixelleClassLoader>() {
public PixelleClassLoader run() {
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OptionsAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OptionsAction.java 2008-06-22 14:27:07 UTC (rev 51)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OptionsAction.java 2008-06-22 14:44:43 UTC (rev 52)
@@ -23,6 +23,7 @@
import javax.swing.AbstractAction;
import com.mebigfatguy.pixelle.PixelleBundle;
+import com.mebigfatguy.pixelle.PixelleEvalFactory;
import com.mebigfatguy.pixelle.PixelleFrame;
import com.mebigfatguy.pixelle.dialogs.PixelleOptionsDialog;
@@ -38,11 +39,12 @@
}
public void actionPerformed(ActionEvent e) {
- PixelleOptionsDialog d = new PixelleOptionsDialog(frame);
+ PixelleOptionsDialog d = new PixelleOptionsDialog(frame, PixelleEvalFactory.getOutOfBoundsOption());
d.setLocationRelativeTo(frame);
d.setModal(true);
d.setVisible(true);
if (d.isOK()) {
+ PixelleEvalFactory.setOutOfBoundsOption(d.getOutOfBoundsOption());
}
}
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleOptionsDialog.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleOptionsDialog.java 2008-06-22 14:27:07 UTC (rev 51)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleOptionsDialog.java 2008-06-22 14:44:43 UTC (rev 52)
@@ -36,7 +36,9 @@
import javax.swing.JDialog;
import javax.swing.JPanel;
+import com.mebigfatguy.pixelle.OutOfBoundsOption;
import com.mebigfatguy.pixelle.PixelleBundle;
+import com.mebigfatguy.pixelle.PixelleEvalFactory;
import com.mebigfatguy.pixelle.PixelleFrame;
import com.mebigfatguy.pixelle.utils.GuiUtils;
@@ -51,10 +53,11 @@
private JButton ok = new JButton(PixelleBundle.getString(PixelleBundle.OK));
private JButton cancel = new JButton(PixelleBundle.getString(PixelleBundle.CANCEL));
private boolean okClicked = false;
- private Color defColor = Color.WHITE;
+ private OutOfBoundsOption oobOption;
- public PixelleOptionsDialog(PixelleFrame owner) {
+ public PixelleOptionsDialog(PixelleFrame owner, OutOfBoundsOption option) {
super(owner, PixelleBundle.getString(PixelleBundle.PIXEL_OPTIONS));
+ oobOption = option;
initComponents();
initListeners();
pack();
@@ -64,6 +67,10 @@
return okClicked;
}
+ public OutOfBoundsOption getOutOfBoundsOption() {
+ return oobOption;
+ }
+
private void initComponents() {
Container cp = getContentPane();
cp.setLayout(new BoxLayout(cp, BoxLayout.Y_AXIS));
@@ -74,8 +81,11 @@
p.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), PixelleBundle.getString(PixelleBundle.OUT_OF_BOUNDS_PIXELS)));
GuiUtils.sizeUniformly(GuiUtils.Sizing.Height, colorBox, colorButton, borderColorBox, wrappedColorBox);
- colorButton.setColor(defColor);
+ oobOption = PixelleEvalFactory.getOutOfBoundsOption();
+
+ colorButton.setColor(oobOption.getColor());
+
JPanel colorP = new JPanel();
colorP.setLayout(new BoxLayout(colorP, BoxLayout.X_AXIS));
colorP.add(colorBox);
@@ -92,7 +102,19 @@
g.add(borderColorBox);
g.add(wrappedColorBox);
- borderColorBox.setSelected(true);
+ switch (oobOption) {
+ case SpecifiedColor:
+ colorBox.setSelected(true);
+ break;
+
+ case BorderColor:
+ borderColorBox.setSelected(true);
+ break;
+
+ case WrapColor:
+ wrappedColorBox.setSelected(true);
+ break;
+ }
cp.add(p);
}
@@ -138,10 +160,10 @@
colorButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
colorBox.setSelected(true);
- Color chosenColor = JColorChooser.showDialog(PixelleOptionsDialog.this, PixelleBundle.getString(PixelleBundle.PICK_COLOR), defColor);
+ Color chosenColor = JColorChooser.showDialog(PixelleOptionsDialog.this, PixelleBundle.getString(PixelleBundle.PICK_COLOR), oobOption.getColor());
if (chosenColor != null) {
- defColor = chosenColor;
- colorButton.setColor(defColor);
+ oobOption.setColor(chosenColor);
+ colorButton.setColor(chosenColor);
colorButton.repaint();
}
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteABGR.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteABGR.java 2008-06-22 14:27:07 UTC (rev 51)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteABGR.java 2008-06-22 14:44:43 UTC (rev 52)
@@ -18,13 +18,14 @@
*/
package com.mebigfatguy.pixelle.eval;
+import com.mebigfatguy.pixelle.OutOfBoundsOption;
import com.mebigfatguy.pixelle.PixelleEval;
import com.mebigfatguy.pixelle.PixelleImage;
public class PixelleEval3ByteABGR extends PixelleEval {
- public PixelleEval3ByteABGR(PixelleImage srcImage) {
- super(srcImage);
+ public PixelleEval3ByteABGR(PixelleImage srcImage, OutOfBoundsOption option) {
+ super(srcImage, option);
}
@Override
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteBGR.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteBGR.java 2008-06-22 14:27:07 UTC (rev 51)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteBGR.java 2008-06-22 14:44:43 UTC (rev 52)
@@ -18,13 +18,14 @@
*/
package com.mebigfatguy.pixelle.eval;
+import com.mebigfatguy.pixelle.OutOfBoundsOption;
import com.mebigfatguy.pixelle.PixelleEval;
import com.mebigfatguy.pixelle.PixelleImage;
public class PixelleEval3ByteBGR extends PixelleEval {
- public PixelleEval3ByteBGR(PixelleImage srcImage) {
- super(srcImage);
+ public PixelleEval3ByteBGR(PixelleImage srcImage, OutOfBoundsOption option) {
+ super(srcImage, option);
}
@Override
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalByteGray.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalByteGray.java 2008-06-22 14:27:07 UTC (rev 51)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalByteGray.java 2008-06-22 14:44:43 UTC (rev 52)
@@ -18,13 +18,14 @@
*/
package com.mebigfatguy.pixelle.eval;
+import com.mebigfatguy.pixelle.OutOfBoundsOption;
import com.mebigfatguy.pixelle.PixelleEval;
import com.mebigfatguy.pixelle.PixelleImage;
public class PixelleEvalByteGray extends PixelleEval {
- public PixelleEvalByteGray(PixelleImage srcImage) {
- super(srcImage);
+ public PixelleEvalByteGray(PixelleImage srcImage, OutOfBoundsOption option) {
+ super(srcImage, option);
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|