[Pixelle-commit] SF.net SVN: pixelle: [106] trunk/pixelle/src/com/mebigfatguy/pixelle
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2008-06-28 22:29:16
|
Revision: 106
http://pixelle.svn.sourceforge.net/pixelle/?rev=106&view=rev
Author: dbrosius
Date: 2008-06-28 15:29:17 -0700 (Sat, 28 Jun 2008)
Log Message:
-----------
support 4ByteABGR
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java
Removed Paths:
-------------
trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteABGR.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java 2008-06-28 22:28:37 UTC (rev 105)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java 2008-06-28 22:29:17 UTC (rev 106)
@@ -21,6 +21,7 @@
import java.awt.image.BufferedImage;
import com.mebigfatguy.pixelle.eval.PixelleEval3ByteBGR;
+import com.mebigfatguy.pixelle.eval.PixelleEval4ByteABGR;
import com.mebigfatguy.pixelle.eval.PixelleEvalByteGray;
public class PixelleEvalFactory {
@@ -45,7 +46,7 @@
return new PixelleEval3ByteBGR(image, oobOption);
case BufferedImage.TYPE_4BYTE_ABGR:
- break;
+ return new PixelleEval4ByteABGR(image, oobOption);
case BufferedImage.TYPE_BYTE_BINARY:
break;
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java 2008-06-28 22:28:37 UTC (rev 105)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java 2008-06-28 22:29:17 UTC (rev 106)
@@ -194,6 +194,10 @@
cp.setLayout(new BorderLayout());
}
+ public boolean createNewWindow() {
+ return doNewWindow;
+ }
+
public void toggleNewWindowOption() {
doNewWindow = !doNewWindow;
transformNewWindowItem.setSelected(doNewWindow);
@@ -213,6 +217,13 @@
return image;
}
+ public void setImage(PixelleImage img) {
+ image = img;
+ panel.invalidate();
+ panel.revalidate();
+ panel.repaint();
+ }
+
public void openFile(File f) {
setTitle(f.getName());
try {
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java 2008-06-28 22:28:37 UTC (rev 105)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java 2008-06-28 22:29:17 UTC (rev 106)
@@ -50,11 +50,15 @@
PixelleTransformer transformer = new PixelleTransformer(frame.getImage(), d.getAlgorithms());
PixelleImage dstImage = transformer.transform();
if (dstImage != null) {
- PixelleFrame f = new PixelleFrame(dstImage);
- f.setVisible(true);
+ if (frame.createNewWindow()) {
+ PixelleFrame f = new PixelleFrame(dstImage);
+ f.setVisible(true);
+ } else
+ frame.setImage(dstImage);
}
}
} catch (PixelleTransformException pe) {
+ pe.printStackTrace();
JOptionPane.showMessageDialog(frame, pe.getMessage());
}
}
Deleted: trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteABGR.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteABGR.java 2008-06-28 22:28:37 UTC (rev 105)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteABGR.java 2008-06-28 22:29:17 UTC (rev 106)
@@ -1,81 +0,0 @@
-/*
- * pixelle - Graphics algorithmic editor
- * 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.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, OutOfBoundsOption option) {
- super(srcImage, option);
- }
-
- @Override
- public double getTransparencyValue(int x, int y) {
- return (double)buffer.getElem(y * width * 4 + x * 4);
- }
-
- @Override
- public double getBlueValue(int x, int y) {
- return (double)buffer.getElem(y * width * 4 + x * 4 + 1);
- }
-
- @Override
- public double getGreenValue(int x, int y) {
- return (double)buffer.getElem(y * width * 4 + x * 4 + 2);
- }
-
- @Override
- public double getRedValue(int x, int y) {
- return (double)buffer.getElem(y * width * 4 + x * 4 + 3);
- }
-
- public void setValue(int x, int y, char pixelSpec, double value) {
-
- if (value < 0.0)
- value = 0.0;
- else if (value > 255.0)
- value = 255.0;
-
- switch (pixelSpec) {
- case 't':
- buffer.setElem(y * width * 4 + x * 4, (int)(value + 0.49));
- break;
-
- case 'b':
- buffer.setElem(y * width * 4 + x * 4 + 1, (int)(value + 0.49));
- break;
-
- case 'g':
- buffer.setElem(y * width * 4 + x * 4 + 2, (int)(value + 0.49));
- break;
-
- case 'r':
- buffer.setElem(y * width * 4 + x * 4 + 3, (int)(value + 0.49));
- break;
-
- case 's':
- setSelectionValue(x, y, value);
- break;
- }
- }
-
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|