pixelle-commit Mailing List for pixelle (Page 7)
Brought to you by:
dbrosius
You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(129) |
Jul
(39) |
Aug
|
Sep
|
Oct
|
Nov
(63) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(1) |
Feb
(24) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(41) |
Aug
(1) |
Sep
(7) |
Oct
|
Nov
|
Dec
(5) |
| 2010 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2012 |
Jan
(2) |
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <dbr...@us...> - 2008-11-14 04:51:13
|
Revision: 172
http://pixelle.svn.sourceforge.net/pixelle/?rev=172&view=rev
Author: dbrosius
Date: 2008-11-14 04:51:08 +0000 (Fri, 14 Nov 2008)
Log Message:
-----------
try to render custom images
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java 2008-11-14 04:50:39 UTC (rev 171)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java 2008-11-14 04:51:08 UTC (rev 172)
@@ -23,6 +23,7 @@
import com.mebigfatguy.pixelle.eval.PixelleEval3ByteBGR;
import com.mebigfatguy.pixelle.eval.PixelleEval4ByteABGR;
import com.mebigfatguy.pixelle.eval.PixelleEvalByteGray;
+import com.mebigfatguy.pixelle.eval.PixelleEvalCustom;
import com.mebigfatguy.pixelle.eval.PixelleEvalIntARGB;
import com.mebigfatguy.pixelle.eval.PixelleEvalIntBGR;
import com.mebigfatguy.pixelle.eval.PixelleEvalIntRGB;
@@ -90,7 +91,7 @@
return new PixelleEvalIntRGB(image, ioobOption, coobOption);
case BufferedImage.TYPE_CUSTOM:
- throw new IllegalArgumentException("Image type: " + image.getType() + " (Custom) is not supported yet.");
+ return new PixelleEvalCustom(image, ioobOption, coobOption);
}
throw new IllegalArgumentException("Unknown image type: " + image.getType());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-14 04:50:44
|
Revision: 171
http://pixelle.svn.sourceforge.net/pixelle/?rev=171&view=rev
Author: dbrosius
Date: 2008-11-14 04:50:39 +0000 (Fri, 14 Nov 2008)
Log Message:
-----------
try to implement 'custom' evaluator, seems to work for ping customs, we'll see what else we get.
Added Paths:
-----------
trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalCustom.java
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalCustom.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalCustom.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalCustom.java 2008-11-14 04:50:39 UTC (rev 171)
@@ -0,0 +1,55 @@
+/*
+ * 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.ColorOutOfBoundsOption;
+import com.mebigfatguy.pixelle.IndexOutOfBoundsOption;
+import com.mebigfatguy.pixelle.PixelleEval;
+import com.mebigfatguy.pixelle.PixelleImage;
+
+public class PixelleEvalCustom extends PixelleEval {
+
+ public PixelleEvalCustom(PixelleImage srcImage, IndexOutOfBoundsOption iOption, ColorOutOfBoundsOption cOption) {
+ super(srcImage, iOption, cOption);
+ if (buffer.getNumBanks() > 1) {
+ throw new IllegalArgumentException("Unknown image type: " + srcImage.getType() + " with multiple data banks");
+ }
+ }
+
+ @Override
+ public double getBlueValue(int x, int y) {
+ return (double)buffer.getElem(y * width * 3 + x * 3 + 2);
+ }
+
+ @Override
+ public double getGreenValue(int x, int y) {
+ return (double)buffer.getElem(y * width * 3 + x * 3 + 1);
+ }
+
+ @Override
+ public double getRedValue(int x, int y) {
+ return (double)buffer.getElem(y * width * 3 + x * 3);
+ }
+
+ @Override
+ public double getTransparencyValue(int x, int y) {
+ return 255.0;
+ }
+
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalCustom.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: 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-11-12 06:18:03
|
Revision: 170
http://pixelle.svn.sourceforge.net/pixelle/?rev=170&view=rev
Author: dbrosius
Date: 2008-11-12 06:17:53 +0000 (Wed, 12 Nov 2008)
Log Message:
-----------
new license date
Modified Paths:
--------------
trunk/pixelle/pixelle.store
Modified: trunk/pixelle/pixelle.store
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-12 06:11:56
|
Revision: 169
http://pixelle.svn.sourceforge.net/pixelle/?rev=169&view=rev
Author: dbrosius
Date: 2008-11-12 06:11:46 +0000 (Wed, 12 Nov 2008)
Log Message:
-----------
fix dimension x,y switching
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java 2008-07-16 03:20:04 UTC (rev 168)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java 2008-11-12 06:11:46 UTC (rev 169)
@@ -290,11 +290,11 @@
double divH = (double)cHeight / (double)iHeight;
double divW = (double)cWidth / (double)iWidth;
double div = Math.min(divH, divW);
- return new Dimension((int)(div * iHeight), (int)(div * iWidth));
+ return new Dimension((int)(div * iWidth), (int)(div * iHeight));
}
else {
double zoomFactor = zoom.getZoom();
- return new Dimension((int)(image.getHeight() * zoomFactor), (int)(image.getWidth() * zoomFactor));
+ return new Dimension((int)(image.getWidth() * zoomFactor), (int)(image.getHeight() * zoomFactor));
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-07-16 03:19:55
|
Revision: 168
http://pixelle.svn.sourceforge.net/pixelle/?rev=168&view=rev
Author: dbrosius
Date: 2008-07-15 20:20:04 -0700 (Tue, 15 Jul 2008)
Log Message:
-----------
add delete button
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2008-07-16 03:09:36 UTC (rev 167)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2008-07-16 03:20:04 UTC (rev 168)
@@ -54,6 +54,7 @@
public static final String TRANSFORM_ITEM = "menu.transform.transform";
public static final String GRAPHIC_FILES = "label.graphic_files";
public static final String SAVE_ALGORITHM = "save.algorithm";
+ public static final String DELETE_ALGORITHM = "delete.algorithm";
public static final String RED_FORMULA = "formula.red";
public static final String GREEN_FORMULA = "formula.green";
public static final String BLUE_FORMULA = "formula.blue";
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-07-16 03:09:36 UTC (rev 167)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-07-16 03:20:04 UTC (rev 168)
@@ -88,6 +88,7 @@
JPopupMenu savedAlgorithms;
JButton save;
+ JButton delete;
boolean clickedOK = false;
public PixelleExpressionDialog(PixelleFrame owner) {
@@ -118,7 +119,8 @@
cancel = new JButton(PixelleBundle.getString(PixelleBundle.CANCEL));
reset = new JButton(PixelleBundle.getString(PixelleBundle.RESET));
save = new JButton(PixelleBundle.getString(PixelleBundle.SAVE_ALGORITHM));
- GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, new JComponent[] {ok, cancel, reset, save});
+ delete = new JButton(PixelleBundle.getString(PixelleBundle.DELETE_ALGORITHM));
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, new JComponent[] {ok, cancel, reset, save, delete});
cp.setLayout(new BorderLayout(4, 4));
@@ -183,6 +185,8 @@
ctlPanel.add(reset);
ctlPanel.add(Box.createHorizontalStrut(10));
ctlPanel.add(save);
+ ctlPanel.add(Box.createHorizontalStrut(10));
+ ctlPanel.add(delete);
ctlPanel.add(Box.createHorizontalGlue());
ctlPanel.add(ok);
ctlPanel.add(Box.createHorizontalStrut(10));
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties 2008-07-16 03:09:36 UTC (rev 167)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties 2008-07-16 03:20:04 UTC (rev 168)
@@ -59,6 +59,7 @@
title.algorithms = Pixel Algorithms
label.algorithm = Algorithm
save.algorithm = Save
+delete.algorithm = Delete
label.red = (Red)
label.green = (Green)
label.blue = (Blue)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-07-16 03:09:26
|
Revision: 167
http://pixelle.svn.sourceforge.net/pixelle/?rev=167&view=rev
Author: dbrosius
Date: 2008-07-15 20:09:36 -0700 (Tue, 15 Jul 2008)
Log Message:
-----------
allow parsing of system or user algorithms
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-13 01:18:17 UTC (rev 166)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-16 03:09:36 UTC (rev 167)
@@ -213,7 +213,7 @@
}
}
- private void parseAlgorithms(InputStream is, Map<String, Map<String, Map<PixelleComponent, String>>> algorithms) throws IOException, SAXException {
+ private void parseAlgorithms(InputStream is, final Map<String, Map<String, Map<PixelleComponent, String>>> algorithms) throws IOException, SAXException {
XMLReader r = XMLReaderFactory.createXMLReader();
r.setContentHandler(new DefaultHandler() {
Map<String, Map<PixelleComponent, String>> currentGroup = null;
@@ -225,7 +225,7 @@
public void startElement(String uri, String localName, String qName, Attributes atts) {
if (GROUP.equals(localName)) {
currentGroup = new HashMap<String, Map<PixelleComponent, String>>();
- systemAlgorithms.put(atts.getValue(NAME), currentGroup);
+ algorithms.put(atts.getValue(NAME), currentGroup);
} else if (ALGORITHM.equals(localName)) {
currentAlgorithm = new HashMap<PixelleComponent, String>();
currentGroup.put(atts.getValue(NAME), currentAlgorithm);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-07-13 01:18:10
|
Revision: 166
http://pixelle.svn.sourceforge.net/pixelle/?rev=166&view=rev
Author: dbrosius
Date: 2008-07-12 18:18:17 -0700 (Sat, 12 Jul 2008)
Log Message:
-----------
use the Version class
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-13 01:17:55 UTC (rev 165)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-13 01:18:17 UTC (rev 166)
@@ -186,7 +186,7 @@
PrintWriter pw = null;
try {
pw = new PrintWriter(new OutputStreamWriter(is));
- pw.println("<algorithms xmlns='http://pixelle.mebigfatguy.com/0.1.0'");
+ pw.println("<algorithms xmlns='http://pixelle.mebigfatguy.com/" + Version.getVersion() + "'");
pw.println(" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'");
pw.println(" xsi:schemaLocation='/com/mebigfatguy/pixelle/resources/algorithms.xsd'>");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-07-13 01:17:47
|
Revision: 165
http://pixelle.svn.sourceforge.net/pixelle/?rev=165&view=rev
Author: dbrosius
Date: 2008-07-12 18:17:55 -0700 (Sat, 12 Jul 2008)
Log Message:
-----------
class to read the generated version property file
Added Paths:
-----------
trunk/pixelle/src/com/mebigfatguy/pixelle/Version.java
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/Version.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/Version.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/Version.java 2008-07-13 01:17:55 UTC (rev 165)
@@ -0,0 +1,22 @@
+package com.mebigfatguy.pixelle;
+
+import java.util.ResourceBundle;
+
+public class Version {
+ private static String version;
+ static {
+ try {
+ ResourceBundle rb = ResourceBundle.getBundle("com/mebigfatguy/pixelle/resources/version");
+ version = rb.getString("pixelle.version");
+ } catch (Exception e) {
+ version = "?.?.?";
+ }
+ }
+
+ private Version() {
+ }
+
+ public static String getVersion() {
+ return version;
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/Version.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-07-13 01:08:37
|
Revision: 164
http://pixelle.svn.sourceforge.net/pixelle/?rev=164&view=rev
Author: dbrosius
Date: 2008-07-12 18:08:47 -0700 (Sat, 12 Jul 2008)
Log Message:
-----------
generate properties file with version in it
Modified Paths:
--------------
trunk/pixelle/build.xml
Modified: trunk/pixelle/build.xml
===================================================================
--- trunk/pixelle/build.xml 2008-07-13 00:56:24 UTC (rev 163)
+++ trunk/pixelle/build.xml 2008-07-13 01:08:47 UTC (rev 164)
@@ -46,6 +46,7 @@
<delete>
<fileset dir="${basedir}" includes="*.zip"/>
</delete>
+ <delete file="${src.dir}/com/mebigfatguy/pixelle/resources/version.properties"/>
</target>
<target name="-init" description="prepares repository for a build">
@@ -58,6 +59,7 @@
<pathelement location="${lib.dir}/antlr-runtime-3.1b1.jar"/>
<pathelement location="${lib.dir}/asm-3.1.jar"/>
</path>
+ <echo message="pixelle.version = ${pixelle.version}" file="${src.dir}/com/mebigfatguy/pixelle/resources/version.properties"/>
</target>
<target name="-gen" description="generate antlr files">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-07-13 00:56:14
|
Revision: 163
http://pixelle.svn.sourceforge.net/pixelle/?rev=163&view=rev
Author: dbrosius
Date: 2008-07-12 17:56:24 -0700 (Sat, 12 Jul 2008)
Log Message:
-----------
ah carumba
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-13 00:55:03 UTC (rev 162)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-13 00:56:24 UTC (rev 163)
@@ -194,10 +194,10 @@
pw.println(" <group name='" + group.getKey() + "'>");
for (Map.Entry<String, Map<PixelleComponent, String>> algorithm : group.getValue().entrySet()) {
- pw.println(" <algorithm name'" + algorithm.getKey() + "'>");
+ pw.println(" <algorithm name='" + algorithm.getKey() + "'>");
for (Map.Entry<PixelleComponent, String> component : algorithm.getValue().entrySet()) {
- pw.println(" <component name ='" + component.getKey().name().toLowerCase() + "'>");
+ pw.println(" <component name='" + component.getKey().name().toLowerCase() + "'>");
pw.println(" " + component.getValue());
pw.println(" </component>");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-07-13 00:54:56
|
Revision: 162
http://pixelle.svn.sourceforge.net/pixelle/?rev=162&view=rev
Author: dbrosius
Date: 2008-07-12 17:55:03 -0700 (Sat, 12 Jul 2008)
Log Message:
-----------
oops fix namespace
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-13 00:50:36 UTC (rev 161)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-13 00:55:03 UTC (rev 162)
@@ -186,9 +186,9 @@
PrintWriter pw = null;
try {
pw = new PrintWriter(new OutputStreamWriter(is));
- pw.println("<algorithms 'http://pixelle.mebigfatguy.com/0.1.0'");
- pw.println(" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'");
- pw.println(" xsi:schemaLocation='/com/mebigfatguy/pixelle/resources/algorithms.xsd'>");
+ pw.println("<algorithms xmlns='http://pixelle.mebigfatguy.com/0.1.0'");
+ pw.println(" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'");
+ pw.println(" xsi:schemaLocation='/com/mebigfatguy/pixelle/resources/algorithms.xsd'>");
for (Map.Entry<String, Map<String, Map<PixelleComponent, String>>> group : algorithms.entrySet()) {
pw.println(" <group name='" + group.getKey() + "'>");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-07-13 00:50:27
|
Revision: 161
http://pixelle.svn.sourceforge.net/pixelle/?rev=161&view=rev
Author: dbrosius
Date: 2008-07-12 17:50:36 -0700 (Sat, 12 Jul 2008)
Log Message:
-----------
write out the algo file
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-13 00:39:33 UTC (rev 160)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-13 00:50:36 UTC (rev 161)
@@ -20,10 +20,15 @@
import java.awt.event.ActionListener;
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.OutputStreamWriter;
+import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
@@ -132,6 +137,18 @@
}
public void save() {
+ OutputStream xmlOut = null;
+ try {
+ File pixelleDir = new File(System.getProperty("user.home"), PIXELLE);
+ pixelleDir.mkdirs();
+ File algoFile = new File(pixelleDir, ALGORITHMS_FILE);
+ xmlOut = new BufferedOutputStream(new FileOutputStream(algoFile));
+ writeAlgorithms(xmlOut, userAlgorithms);
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ Closer.close(xmlOut);
+ }
}
@@ -165,6 +182,37 @@
}
+ private void writeAlgorithms(OutputStream is, Map<String, Map<String, Map<PixelleComponent, String>>> algorithms) throws IOException {
+ PrintWriter pw = null;
+ try {
+ pw = new PrintWriter(new OutputStreamWriter(is));
+ pw.println("<algorithms 'http://pixelle.mebigfatguy.com/0.1.0'");
+ pw.println(" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'");
+ pw.println(" xsi:schemaLocation='/com/mebigfatguy/pixelle/resources/algorithms.xsd'>");
+
+ for (Map.Entry<String, Map<String, Map<PixelleComponent, String>>> group : algorithms.entrySet()) {
+ pw.println(" <group name='" + group.getKey() + "'>");
+
+ for (Map.Entry<String, Map<PixelleComponent, String>> algorithm : group.getValue().entrySet()) {
+ pw.println(" <algorithm name'" + algorithm.getKey() + "'>");
+
+ for (Map.Entry<PixelleComponent, String> component : algorithm.getValue().entrySet()) {
+ pw.println(" <component name ='" + component.getKey().name().toLowerCase() + "'>");
+ pw.println(" " + component.getValue());
+ pw.println(" </component>");
+ }
+ pw.println(" </algorithm>");
+ }
+ pw.println(" </group>");
+ }
+ pw.println("</algorithms>");
+ pw.flush();
+ }
+ finally {
+ pw.close();
+ }
+ }
+
private void parseAlgorithms(InputStream is, Map<String, Map<String, Map<PixelleComponent, String>>> algorithms) throws IOException, SAXException {
XMLReader r = XMLReaderFactory.createXMLReader();
r.setContentHandler(new DefaultHandler() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-07-13 00:39:25
|
Revision: 160
http://pixelle.svn.sourceforge.net/pixelle/?rev=160&view=rev
Author: dbrosius
Date: 2008-07-12 17:39:33 -0700 (Sat, 12 Jul 2008)
Log Message:
-----------
fix schema location
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xml
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xml
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xml 2008-07-12 17:28:23 UTC (rev 159)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xml 2008-07-13 00:39:33 UTC (rev 160)
@@ -20,7 +20,7 @@
-->
<algorithms xmlns="http://pixelle.mebigfatguy.com/0.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.w3schools.com note.xsd">
+ xsi:schemaLocation="/com/mebigfatguy/pixelle/resources/algorithms.xsd">
<group name="Separations">
<algorithm name="cyan">
<component name="red">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-07-12 17:28:15
|
Revision: 159
http://pixelle.svn.sourceforge.net/pixelle/?rev=159&view=rev
Author: dbrosius
Date: 2008-07-12 10:28:23 -0700 (Sat, 12 Jul 2008)
Log Message:
-----------
add saved algos to the menu
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-12 17:20:33 UTC (rev 158)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-12 17:28:23 UTC (rev 159)
@@ -116,8 +116,15 @@
public String[] getUserGroups() {
return userAlgorithms.keySet().toArray(new String[userAlgorithms.size()]);
}
- public void addAlgorithm(String group, String name, Map<PixelleComponent, String> algorithm) {
+
+ public void addAlgorithm(String groupName, String algorithmName, Map<PixelleComponent, String> algorithm) {
+ Map<String, Map<PixelleComponent, String>> group = userAlgorithms.get(groupName);
+ if (group == null) {
+ group = new HashMap<String, Map<PixelleComponent, String>>();
+ userAlgorithms.put(groupName, group);
+ }
+ group.put(algorithmName, new HashMap<PixelleComponent, String>(algorithm));
}
public void removeAlgorithm(String group, String name) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-07-12 17:20:24
|
Revision: 158
http://pixelle.svn.sourceforge.net/pixelle/?rev=158&view=rev
Author: dbrosius
Date: 2008-07-12 10:20:33 -0700 (Sat, 12 Jul 2008)
Log Message:
-----------
more saving of algorithms, not done yet
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-09 05:37:09 UTC (rev 157)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-12 17:20:33 UTC (rev 158)
@@ -124,6 +124,10 @@
}
+ public void save() {
+
+ }
+
private void loadSystemAlgorithms() {
InputStream xmlIs = null;
try {
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-07-09 05:37:09 UTC (rev 157)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-07-12 17:20:33 UTC (rev 158)
@@ -213,6 +213,14 @@
dialog.setLocationRelativeTo(frame);
dialog.setModal(true);
dialog.setVisible(true);
+ if (dialog.isOK()) {
+ String group = dialog.getGroup();
+ String name = dialog.getName();
+ Map<PixelleComponent, String> algorithm = getAlgorithms();
+ AlgorithmArchiver archiver = AlgorithmArchiver.getArchiver();
+ archiver.addAlgorithm(group, name, algorithm);
+ archiver.save();
+ }
}
});
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-07-09 05:37:00
|
Revision: 157
http://pixelle.svn.sourceforge.net/pixelle/?rev=157&view=rev
Author: dbrosius
Date: 2008-07-08 22:37:09 -0700 (Tue, 08 Jul 2008)
Log Message:
-----------
oi
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-07-09 05:35:48 UTC (rev 156)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-07-09 05:37:09 UTC (rev 157)
@@ -36,7 +36,6 @@
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
-import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-07-09 05:35:40
|
Revision: 156
http://pixelle.svn.sourceforge.net/pixelle/?rev=156&view=rev
Author: dbrosius
Date: 2008-07-08 22:35:48 -0700 (Tue, 08 Jul 2008)
Log Message:
-----------
build out the saveAlgorithmDialog class
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/SaveAlgorithmDialog.java
trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-08 04:02:26 UTC (rev 155)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-09 05:35:48 UTC (rev 156)
@@ -113,6 +113,9 @@
}
+ public String[] getUserGroups() {
+ return userAlgorithms.keySet().toArray(new String[userAlgorithms.size()]);
+ }
public void addAlgorithm(String group, String name, Map<PixelleComponent, String> algorithm) {
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2008-07-08 04:02:26 UTC (rev 155)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2008-07-09 05:35:48 UTC (rev 156)
@@ -61,6 +61,7 @@
public static final String SELECTION_FORMULA = "formula.selection";
public static final String PIXEL_ALGORITHMS = "title.algorithms";
public static final String PIXEL_ALGORITHM = "label.algorithm";
+ public static final String PIXEL_GROUP = "label.group";
public static final String RED_LABEL = "label.red";
public static final String GREEN_LABEL = "label.green";
public static final String BLUE_LABEL = "label.blue";
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-07-08 04:02:26 UTC (rev 155)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-07-09 05:35:48 UTC (rev 156)
@@ -210,7 +210,7 @@
save.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
- SaveAlgorithmDialog dialog = new SaveAlgorithmDialog(frame, null);
+ SaveAlgorithmDialog dialog = new SaveAlgorithmDialog(frame);
dialog.setLocationRelativeTo(frame);
dialog.setModal(true);
dialog.setVisible(true);
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/SaveAlgorithmDialog.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/SaveAlgorithmDialog.java 2008-07-08 04:02:26 UTC (rev 155)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/SaveAlgorithmDialog.java 2008-07-09 05:35:48 UTC (rev 156)
@@ -18,33 +18,101 @@
*/
package com.mebigfatguy.pixelle.dialogs;
-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.Map;
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import com.mebigfatguy.pixelle.AlgorithmArchiver;
import com.mebigfatguy.pixelle.PixelleBundle;
-import com.mebigfatguy.pixelle.PixelleComponent;
import com.mebigfatguy.pixelle.PixelleFrame;
+import com.mebigfatguy.pixelle.utils.GuiUtils;
-public class SaveAlgorithmDialog extends JDialog {
-
- private Map<PixelleComponent, String> algorithm;
+public class SaveAlgorithmDialog extends JDialog {
+ private static final long serialVersionUID = -6991592080722431427L;
- public SaveAlgorithmDialog(PixelleFrame owner, Map<PixelleComponent, String> algorithmToSave) {
+ private JLabel[] labels = new JLabel[] {
+ new JLabel(PixelleBundle.getString(PixelleBundle.PIXEL_GROUP)),
+ new JLabel(PixelleBundle.getString(PixelleBundle.PIXEL_ALGORITHM))
+ };
+
+ private JComboBox groupBox;
+ private JTextField nameField;
+ private JButton ok;
+ private JButton cancel;
+ private boolean okClicked = false;
+
+ public SaveAlgorithmDialog(PixelleFrame owner) {
super(owner, PixelleBundle.getString(PixelleBundle.SAVE_ALGORITHM));
- algorithm = algorithmToSave;
initComponents();
initListeners();
}
+ public boolean isOK() {
+ return okClicked;
+ }
+
+ public String getGroup() {
+ return (String)groupBox.getSelectedItem();
+ }
+
+ public String getName() {
+ return nameField.getText();
+ }
+
private void initComponents() {
Container cp = getContentPane();
- cp.setLayout(new BorderLayout(4, 4));
+ cp.setLayout(new BoxLayout(cp, BoxLayout.Y_AXIS));
+ String[] groups = AlgorithmArchiver.getArchiver().getUserGroups();
+ groupBox = new JComboBox(new DefaultComboBoxModel(groups));
+ groupBox.setEditable(true);
+ nameField = new JTextField(10);
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, labels);
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, groupBox, nameField);
+
+ JComponent[] fields = new JComponent[] {groupBox, nameField};
+ cp.add(Box.createVerticalStrut(20));
+ for (int i = 0; i < labels.length; i++) {
+ JPanel p = new JPanel();
+ p.setBorder(BorderFactory.createEmptyBorder(2, 30, 2, 30));
+ p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
+ p.add(Box.createHorizontalGlue());
+ p.add(labels[i]);
+ p.add(Box.createHorizontalStrut(10));
+ p.add(fields[i]);
+ labels[i].setLabelFor(fields[i]);
+ p.add(Box.createHorizontalGlue());
+ cp.add(p);
+ cp.add(Box.createVerticalStrut(10));
+ }
+
+ JPanel p = new JPanel();
+ p.setBorder(BorderFactory.createEmptyBorder(2, 30, 20, 30));
+ p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
+ ok = new JButton(PixelleBundle.getString(PixelleBundle.OK));
+ cancel = new JButton(PixelleBundle.getString(PixelleBundle.CANCEL));
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, ok, cancel);
+ p.add(Box.createHorizontalGlue());
+ p.add(ok);
+ p.add(Box.createHorizontalStrut(10));
+ p.add(cancel);
+ p.add(Box.createHorizontalGlue());
+
+ cp.add(p);
pack();
}
@@ -57,6 +125,18 @@
dispose();
}
});
-
+
+ ok.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ okClicked = true;
+ dispose();
+ }
+ });
+
+ cancel.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ dispose();
+ }
+ });
}
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties 2008-07-08 04:02:26 UTC (rev 155)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties 2008-07-09 05:35:48 UTC (rev 156)
@@ -55,6 +55,7 @@
formula.transparency = p[x,y].t
formula.selection = p[x,y].s
+label.group = Group
title.algorithms = Pixel Algorithms
label.algorithm = Algorithm
save.algorithm = Save
@@ -77,4 +78,3 @@
label.wave_color = Color Waving
label.save_overwrite = The file "{0}" already exists, do you want to overwrite it?
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-07-08 04:02:26
|
Revision: 155
http://pixelle.svn.sourceforge.net/pixelle/?rev=155&view=rev
Author: dbrosius
Date: 2008-07-07 21:02:26 -0700 (Mon, 07 Jul 2008)
Log Message:
-----------
stub in the save algorithm dialog
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
Added Paths:
-----------
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/SaveAlgorithmDialog.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-07-08 03:48:00 UTC (rev 154)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-07-08 04:02:26 UTC (rev 155)
@@ -81,6 +81,7 @@
new JLabel(PixelleBundle.getString(PixelleBundle.SELECTION_LABEL))
};
+ PixelleFrame frame;
JButton ok;
JButton cancel;
JButton reset;
@@ -92,6 +93,7 @@
public PixelleExpressionDialog(PixelleFrame owner) {
super(owner, PixelleBundle.getString(PixelleBundle.PIXEL_ALGORITHMS));
+ frame = owner;
initComponents();
initListeners();
}
@@ -206,6 +208,15 @@
}
});
+ save.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ SaveAlgorithmDialog dialog = new SaveAlgorithmDialog(frame, null);
+ dialog.setLocationRelativeTo(frame);
+ dialog.setModal(true);
+ dialog.setVisible(true);
+ }
+ });
+
ok.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
clickedOK = true;
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/SaveAlgorithmDialog.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/SaveAlgorithmDialog.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/SaveAlgorithmDialog.java 2008-07-08 04:02:26 UTC (rev 155)
@@ -0,0 +1,62 @@
+/*
+ * 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.dialogs;
+
+import java.awt.BorderLayout;
+import java.awt.Container;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.util.Map;
+
+import javax.swing.JDialog;
+
+import com.mebigfatguy.pixelle.PixelleBundle;
+import com.mebigfatguy.pixelle.PixelleComponent;
+import com.mebigfatguy.pixelle.PixelleFrame;
+
+public class SaveAlgorithmDialog extends JDialog {
+
+ private Map<PixelleComponent, String> algorithm;
+
+ public SaveAlgorithmDialog(PixelleFrame owner, Map<PixelleComponent, String> algorithmToSave) {
+ super(owner, PixelleBundle.getString(PixelleBundle.SAVE_ALGORITHM));
+ algorithm = algorithmToSave;
+ initComponents();
+ initListeners();
+ }
+
+ private void initComponents() {
+ Container cp = getContentPane();
+ cp.setLayout(new BorderLayout(4, 4));
+
+ pack();
+ }
+
+ private void initListeners() {
+ setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+
+ addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent we) {
+ dispose();
+ }
+ });
+
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/SaveAlgorithmDialog.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-07-08 03:47:59
|
Revision: 154
http://pixelle.svn.sourceforge.net/pixelle/?rev=154&view=rev
Author: dbrosius
Date: 2008-07-07 20:48:00 -0700 (Mon, 07 Jul 2008)
Log Message:
-----------
oops, fix blue component calc
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xml
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xml
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xml 2008-07-08 03:40:41 UTC (rev 153)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xml 2008-07-08 03:48:00 UTC (rev 154)
@@ -24,13 +24,13 @@
<group name="Separations">
<algorithm name="cyan">
<component name="red">
- (255 - p[x,y].r) - min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
+ (255 - p[x,y].r) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
</component>
<component name="green">
- (255 - p[x,y].r) - min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
+ (255 - p[x,y].r) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
</component>
<component name="blue">
- (255 - p[x,y].r) - min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
+ (255 - p[x,y].r) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
</component>
<component name="transparency">
255
@@ -41,13 +41,13 @@
</algorithm>
<algorithm name="magenta">
<component name="red">
- (255 - p[x,y].g) - min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
+ (255 - p[x,y].g) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
</component>
<component name="green">
- (255 - p[x,y].g) - min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
+ (255 - p[x,y].g) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
</component>
<component name="blue">
- (255 - p[x,y].g) - min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
+ (255 - p[x,y].g) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
</component>
<component name="transparency">
255
@@ -58,13 +58,13 @@
</algorithm>
<algorithm name="yellow">
<component name="red">
- (255 - p[x,y].b) - min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
+ (255 - p[x,y].b) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
</component>
<component name="green">
- (255 - p[x,y].b) - min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
+ (255 - p[x,y].b) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
</component>
<component name="blue">
- (255 - p[x,y].b) - min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
+ (255 - p[x,y].b) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
</component>
<component name="transparency">
255
@@ -75,13 +75,13 @@
</algorithm>
<algorithm name="black">
<component name="red">
- min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
+ min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
</component>
<component name="green">
- min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
+ min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
</component>
<component name="blue">
- min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
+ min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
</component>
<component name="transparency">
255
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-07-08 03:40:42
|
Revision: 153
http://pixelle.svn.sourceforge.net/pixelle/?rev=153&view=rev
Author: dbrosius
Date: 2008-07-07 20:40:41 -0700 (Mon, 07 Jul 2008)
Log Message:
-----------
move 'Graphic Files' to the properties file
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OpenFileAction.java
trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2008-07-08 03:35:36 UTC (rev 152)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2008-07-08 03:40:41 UTC (rev 153)
@@ -52,6 +52,7 @@
public static final String OPTIONS_ITEM = "menu.transform.options";
public static final String TRANSFORM_NEW_ITEM = "menu.transform.newwindow";
public static final String TRANSFORM_ITEM = "menu.transform.transform";
+ public static final String GRAPHIC_FILES = "label.graphic_files";
public static final String SAVE_ALGORITHM = "save.algorithm";
public static final String RED_FORMULA = "formula.red";
public static final String GREEN_FORMULA = "formula.green";
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OpenFileAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OpenFileAction.java 2008-07-08 03:35:36 UTC (rev 152)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OpenFileAction.java 2008-07-08 03:40:41 UTC (rev 153)
@@ -63,7 +63,7 @@
@Override
public String getDescription() {
- return "Graphic Files";
+ return PixelleBundle.getString(PixelleBundle.GRAPHIC_FILES);
}
});
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties 2008-07-08 03:35:36 UTC (rev 152)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties 2008-07-08 03:40:41 UTC (rev 153)
@@ -47,6 +47,8 @@
menu.transform.newwindow = Transform creates new Window
menu.transform.transform = Transform
+label.graphic_files = Graphic Files
+
formula.red = p[x,y].r
formula.green = p[x,y].g
formula.blue = p[x,y].b
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-07-08 03:35:36
|
Revision: 152
http://pixelle.svn.sourceforge.net/pixelle/?rev=152&view=rev
Author: dbrosius
Date: 2008-07-07 20:35:36 -0700 (Mon, 07 Jul 2008)
Log Message:
-----------
switch to separations using gcr
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xml
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xml
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xml 2008-07-08 03:20:22 UTC (rev 151)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xml 2008-07-08 03:35:36 UTC (rev 152)
@@ -21,16 +21,16 @@
<algorithms xmlns="http://pixelle.mebigfatguy.com/0.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com note.xsd">
- <group name="Blends">
- <algorithm name="simple">
+ <group name="Separations">
+ <algorithm name="cyan">
<component name="red">
- x
+ (255 - p[x,y].r) - min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
</component>
<component name="green">
- y
+ (255 - p[x,y].r) - min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
</component>
<component name="blue">
- width-x
+ (255 - p[x,y].r) - min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
</component>
<component name="transparency">
255
@@ -39,5 +39,56 @@
0
</component>
</algorithm>
+ <algorithm name="magenta">
+ <component name="red">
+ (255 - p[x,y].g) - min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
+ </component>
+ <component name="green">
+ (255 - p[x,y].g) - min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
+ </component>
+ <component name="blue">
+ (255 - p[x,y].g) - min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
+ </component>
+ <component name="transparency">
+ 255
+ </component>
+ <component name="selection">
+ 0
+ </component>
+ </algorithm>
+ <algorithm name="yellow">
+ <component name="red">
+ (255 - p[x,y].b) - min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
+ </component>
+ <component name="green">
+ (255 - p[x,y].b) - min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
+ </component>
+ <component name="blue">
+ (255 - p[x,y].b) - min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
+ </component>
+ <component name="transparency">
+ 255
+ </component>
+ <component name="selection">
+ 0
+ </component>
+ </algorithm>
+ <algorithm name="black">
+ <component name="red">
+ min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
+ </component>
+ <component name="green">
+ min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
+ </component>
+ <component name="blue">
+ min(min(255 - p[x,y].r, 255 - p[x,y].g), p[x,y].b)
+ </component>
+ <component name="transparency">
+ 255
+ </component>
+ <component name="selection">
+ 0
+ </component>
+ </algorithm>
</group>
</algorithms>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-07-08 03:20:26
|
Revision: 151
http://pixelle.svn.sourceforge.net/pixelle/?rev=151&view=rev
Author: dbrosius
Date: 2008-07-07 20:20:22 -0700 (Mon, 07 Jul 2008)
Log Message:
-----------
what's with the UPPERCASE
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties 2008-07-07 04:53:13 UTC (rev 150)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties 2008-07-08 03:20:22 UTC (rev 151)
@@ -16,8 +16,8 @@
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
ok = OK
-cancel = CANCEL
-reset = RESET
+cancel = Cancel
+reset = Reset
pixelle.title = Pixelle - {0}
pixelle.untitled = Untitled
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-07-07 04:53:12
|
Revision: 150
http://pixelle.svn.sourceforge.net/pixelle/?rev=150&view=rev
Author: dbrosius
Date: 2008-07-06 21:53:13 -0700 (Sun, 06 Jul 2008)
Log Message:
-----------
start adding in saved algorithms
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
trunk/pixelle/src/com/mebigfatguy/pixelle/Pixelle.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-06 22:09:40 UTC (rev 149)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-07 04:53:13 UTC (rev 150)
@@ -18,6 +18,7 @@
*/
package com.mebigfatguy.pixelle;
+import java.awt.event.ActionListener;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -26,6 +27,8 @@
import java.util.HashMap;
import java.util.Map;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
@@ -42,12 +45,12 @@
private static final String SYSTEM_ALGO_XML_PATH = "/com/mebigfatguy/pixelle/resources/algorithms.xml";
private static final String SYSTEM_ALGO_XSD_PATH = "/com/mebigfatguy/pixelle/resources/algorithms.xsd";
- private static final String GROUP = "group";
- private static final String ALGORITHM = "algorithm";
- private static final String COMPONENT = "component";
- private static final String NAME = "name";
- private static final String PIXELLE = "pixelle";
- private static final String ALGORITHMS_FILE = "algorithms.xml";
+ public static final String GROUP = "group";
+ public static final String ALGORITHM = "algorithm";
+ public static final String COMPONENT = "component";
+ public static final String NAME = "name";
+ public static final String PIXELLE = "pixelle";
+ public static final String ALGORITHMS_FILE = "algorithms.xml";
private static AlgorithmArchiver archiver = new AlgorithmArchiver();
@@ -66,10 +69,50 @@
return archiver;
}
- public JPopupMenu getAlgorithmDisplayPopup() {
- return new JPopupMenu(PixelleBundle.getString(PixelleBundle.PIXEL_ALGORITHM));
+ public JPopupMenu getAlgorithmDisplayPopup(ActionListener l) {
+ JPopupMenu m = new JPopupMenu(PixelleBundle.getString(PixelleBundle.PIXEL_ALGORITHM));
+ populateMenuAlgorithms(m, systemAlgorithms, l);
+ populateMenuAlgorithms(m, userAlgorithms, l);
+
+ return m;
}
+ private void populateMenuAlgorithms(JPopupMenu menu, Map<String, Map<String, Map<PixelleComponent, String>>> algorithms, ActionListener l) {
+ for (final Map.Entry<String, Map<String, Map<PixelleComponent, String>>> entry : algorithms.entrySet()) {
+ String groupName = entry.getKey();
+ JMenu group = new JMenu(groupName);
+ menu.add(group);
+ for (final String algos : entry.getValue().keySet()) {
+ JMenuItem algoItem = new JMenuItem(algos);
+ algoItem.putClientProperty(NAME, groupName);
+ algoItem.addActionListener(l);
+ group.add(algoItem);
+ }
+ }
+ }
+
+ public Map<PixelleComponent, String> getAlgorithm(String groupName, String algorithmName) {
+ Map<String, Map<PixelleComponent, String>> group = systemAlgorithms.get(groupName);
+ if (group != null) {
+ Map<PixelleComponent, String> algo = group.get(algorithmName);
+ if (algo != null)
+ return algo;
+ }
+
+ group = userAlgorithms.get(groupName);
+ if (group == null) {
+ throw new IllegalArgumentException("Unknown group name " + groupName);
+ }
+
+ Map<PixelleComponent, String> algo = group.get(algorithmName);
+ if (algo == null) {
+ throw new IllegalArgumentException("Unknown algorithm name " + algorithmName);
+ }
+
+ return algo;
+
+ }
+
public void addAlgorithm(String group, String name, Map<PixelleComponent, String> algorithm) {
}
@@ -114,6 +157,7 @@
Map<String, Map<PixelleComponent, String>> currentGroup = null;
Map<PixelleComponent, String> currentAlgorithm = null;
String currentComponentName = null;
+ StringBuilder algorithmText = null;
@Override
public void startElement(String uri, String localName, String qName, Attributes atts) {
@@ -125,20 +169,23 @@
currentGroup.put(atts.getValue(NAME), currentAlgorithm);
} else if (COMPONENT.equals(localName)) {
currentComponentName = atts.getValue(NAME);
+ algorithmText = new StringBuilder();
}
}
@Override
public void characters(char[] c, int start, int offset) {
if (currentComponentName != null) {
- PixelleComponent pc = PixelleComponent.valueOf(currentComponentName.toUpperCase());
- currentAlgorithm.put(pc, new String(c, start, offset).trim());
+ algorithmText.append(c, start, offset);
}
}
@Override
public void endElement(String uri, String localName, String qName) {
if (COMPONENT.equals(localName)) {
+ PixelleComponent pc = PixelleComponent.valueOf(currentComponentName.toUpperCase());
+ currentAlgorithm.put(pc, algorithmText.toString().trim());
+ algorithmText = null;
currentComponentName = null;
} else if (ALGORITHM.equals(localName)) {
currentAlgorithm = null;
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/Pixelle.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/Pixelle.java 2008-07-06 22:09:40 UTC (rev 149)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/Pixelle.java 2008-07-07 04:53:13 UTC (rev 150)
@@ -39,7 +39,7 @@
public static void main(String[] args) {
try {
PixelleFrame pf = new PixelleFrame();
- String title = MessageFormat.format(PixelleBundle.getString(PixelleBundle.TITLE), PixelleBundle.getString(PixelleBundle.UNKNOWN));
+ String title = MessageFormat.format(PixelleBundle.getString(PixelleBundle.TITLE), PixelleBundle.getString(PixelleBundle.UNTITLED));
pf.setTitle(title);
Rectangle bounds = GuiUtils.getScreenBounds();
pf.setBounds(bounds);
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2008-07-06 22:09:40 UTC (rev 149)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2008-07-07 04:53:13 UTC (rev 150)
@@ -29,7 +29,7 @@
public static final String CANCEL = "cancel";
public static final String RESET = "reset";
public static final String TITLE = "pixelle.title";
- public static final String UNKNOWN = "pixelle.unknown";
+ public static final String UNTITLED = "pixelle.untitled";
public static final String FILE_MENU = "menu.file.title";
public static final String NEW_ITEM = "menu.file.new";
public static final String OPEN_ITEM = "menu.file.open";
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java 2008-07-06 22:09:40 UTC (rev 149)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java 2008-07-07 04:53:13 UTC (rev 150)
@@ -55,7 +55,7 @@
if (dstImage != null) {
if (frame.createNewWindow()) {
PixelleFrame f = new PixelleFrame(dstImage);
- String title = MessageFormat.format(PixelleBundle.getString(PixelleBundle.TITLE), PixelleBundle.getString(PixelleBundle.UNKNOWN));
+ String title = MessageFormat.format(PixelleBundle.getString(PixelleBundle.TITLE), PixelleBundle.getString(PixelleBundle.UNTITLED));
f.setTitle(title);
f.setVisible(true);
} else
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-07-06 22:09:40 UTC (rev 149)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-07-07 04:53:13 UTC (rev 150)
@@ -23,6 +23,8 @@
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
import java.util.EnumMap;
import java.util.Map;
@@ -34,9 +36,13 @@
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
import javax.swing.JTextField;
+import com.mebigfatguy.pixelle.AlgorithmArchiver;
import com.mebigfatguy.pixelle.PixelleBundle;
import com.mebigfatguy.pixelle.PixelleComponent;
import com.mebigfatguy.pixelle.PixelleFrame;
@@ -63,7 +69,7 @@
new JTextField(PixelleBundle.getString(PixelleBundle.GREEN_FORMULA), 50),
new JTextField(PixelleBundle.getString(PixelleBundle.BLUE_FORMULA), 50),
new JTextField(PixelleBundle.getString(PixelleBundle.TRANSPARENCY_FORMULA), 50),
- new JTextField(PixelleBundle.getString(PixelleBundle.SELECTION_FORMULA), 50)
+ new JTextField(PixelleBundle.getString(PixelleBundle.SELECTION_FORMULA), 50),
};
private final JLabel labels[] =
@@ -78,6 +84,10 @@
JButton ok;
JButton cancel;
JButton reset;
+ JTextField selectedAlgorithm;
+ JPopupMenu savedAlgorithms;
+
+ JButton save;
boolean clickedOK = false;
public PixelleExpressionDialog(PixelleFrame owner) {
@@ -102,45 +112,100 @@
private void initComponents() {
Container cp = getContentPane();
- cp.setLayout(new GridLayout(6, 1));
- GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, lhs);
- GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, editor);
- GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, labels);
-
- for (int i = 0; i < NUM_LABELS; i++) {
- JPanel p = new JPanel();
- p.setLayout(new BorderLayout(10, 10));
- p.add(lhs[i], BorderLayout.WEST);
- p.add(editor[i], BorderLayout.CENTER);
- p.add(labels[i], BorderLayout.EAST);
- labels[i].setLabelFor(editor[i]);
- p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
- cp.add(p);
- }
-
ok = new JButton(PixelleBundle.getString(PixelleBundle.OK));
cancel = new JButton(PixelleBundle.getString(PixelleBundle.CANCEL));
reset = new JButton(PixelleBundle.getString(PixelleBundle.RESET));
- GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, new JComponent[] {ok, cancel, reset});
+ save = new JButton(PixelleBundle.getString(PixelleBundle.SAVE_ALGORITHM));
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, new JComponent[] {ok, cancel, reset, save});
+
+ cp.setLayout(new BorderLayout(4, 4));
- JPanel p = new JPanel();
- p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
- p.add(Box.createHorizontalStrut(10));
- p.add(reset);
- p.add(Box.createHorizontalGlue());
- p.add(ok);
- p.add(Box.createHorizontalStrut(10));
- p.add(cancel);
- p.add(Box.createHorizontalStrut(10));
- p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
- cp.add(p);
+ {
+ JPanel optionsPanel = new JPanel();
+ optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.X_AXIS));
+ optionsPanel.add(Box.createHorizontalGlue());
+ JLabel l = new JLabel(PixelleBundle.getString(PixelleBundle.PIXEL_ALGORITHM));
+ optionsPanel.add(l);
+ optionsPanel.add(Box.createHorizontalStrut(10));
+ selectedAlgorithm = new JTextField(PixelleBundle.getString(PixelleBundle.UNTITLED));
+ selectedAlgorithm.setEditable(false);
+ optionsPanel.add(selectedAlgorithm);
+ optionsPanel.add(Box.createHorizontalStrut(10));
+ savedAlgorithms = AlgorithmArchiver.getArchiver().getAlgorithmDisplayPopup(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ JMenuItem item = (JMenuItem)ae.getSource();
+ String algorithmName = item.getText();
+ String groupName = (String)item.getClientProperty(AlgorithmArchiver.NAME);
+ selectedAlgorithm.setText(algorithmName);
+ Map<PixelleComponent, String> algorithms = AlgorithmArchiver.getArchiver().getAlgorithm(groupName, algorithmName);
+ editor[0].setText(algorithms.get(PixelleComponent.RED));
+ editor[1].setText(algorithms.get(PixelleComponent.GREEN));
+ editor[2].setText(algorithms.get(PixelleComponent.BLUE));
+ editor[3].setText(algorithms.get(PixelleComponent.TRANSPARENCY));
+ editor[4].setText(algorithms.get(PixelleComponent.SELECTION));
+ }
+ });
+ savedAlgorithms.setInvoker(selectedAlgorithm);
+ optionsPanel.add(savedAlgorithms);
+ optionsPanel.add(Box.createHorizontalGlue());
+ optionsPanel.setBorder(BorderFactory.createEmptyBorder(10, 4, 5, 4));
+ cp.add(optionsPanel, BorderLayout.NORTH);
+ }
+
+ {
+ JPanel algoPanel = new JPanel();
+ algoPanel.setLayout(new GridLayout(5, 1));
+
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, lhs);
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, editor);
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, labels);
+
+ for (int i = 0; i < NUM_LABELS; i++) {
+ JPanel p = new JPanel();
+ p.setLayout(new BorderLayout(10, 10));
+ p.add(lhs[i], BorderLayout.WEST);
+ p.add(editor[i], BorderLayout.CENTER);
+ p.add(labels[i], BorderLayout.EAST);
+ labels[i].setLabelFor(editor[i]);
+ p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
+ algoPanel.add(p);
+ }
+
+ cp.add(algoPanel, BorderLayout.CENTER);
+ }
+
+ {
+ JPanel ctlPanel = new JPanel();
+ ctlPanel.setLayout(new BoxLayout(ctlPanel, BoxLayout.X_AXIS));
+ ctlPanel.add(Box.createHorizontalStrut(10));
+ ctlPanel.add(reset);
+ ctlPanel.add(Box.createHorizontalStrut(10));
+ ctlPanel.add(save);
+ ctlPanel.add(Box.createHorizontalGlue());
+ ctlPanel.add(ok);
+ ctlPanel.add(Box.createHorizontalStrut(10));
+ ctlPanel.add(cancel);
+ ctlPanel.add(Box.createHorizontalStrut(10));
+ ctlPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
+ cp.add(ctlPanel, BorderLayout.SOUTH);
+ }
+
pack();
}
private void initListeners() {
getRootPane().setDefaultButton(ok);
+
+ selectedAlgorithm.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mousePressed(MouseEvent me) {
+ savedAlgorithms.setSize(selectedAlgorithm.getSize());
+ savedAlgorithms.show(selectedAlgorithm, 0, 0);
+ }
+ });
+
ok.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
clickedOK = true;
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties 2008-07-06 22:09:40 UTC (rev 149)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties 2008-07-07 04:53:13 UTC (rev 150)
@@ -20,7 +20,7 @@
reset = RESET
pixelle.title = Pixelle - {0}
-pixelle.unknown = Unknown
+pixelle.untitled = Untitled
menu.file.title = File
menu.file.new = New
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-07-06 22:09:40
|
Revision: 149
http://pixelle.svn.sourceforge.net/pixelle/?rev=149&view=rev
Author: dbrosius
Date: 2008-07-06 15:09:40 -0700 (Sun, 06 Jul 2008)
Log Message:
-----------
load user algorithms
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-06 22:02:11 UTC (rev 148)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-06 22:09:40 UTC (rev 149)
@@ -18,11 +18,15 @@
*/
package com.mebigfatguy.pixelle;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
+import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import org.xml.sax.Attributes;
@@ -42,11 +46,8 @@
private static final String ALGORITHM = "algorithm";
private static final String COMPONENT = "component";
private static final String NAME = "name";
- private static final String RED = "red";
- private static final String GREEN = "green";
- private static final String BLUE = "blue";
- private static final String TRANSPARENCY = "transparency";
- private static final String SELECTION = "selection";
+ private static final String PIXELLE = "pixelle";
+ private static final String ALGORITHMS_FILE = "algorithms.xml";
private static AlgorithmArchiver archiver = new AlgorithmArchiver();
@@ -58,6 +59,7 @@
systemAlgorithms = new HashMap<String, Map<String, Map<PixelleComponent, String>>>();
userAlgorithms = new HashMap<String, Map<String, Map<PixelleComponent, String>>>();
loadSystemAlgorithms();
+ loadUserAlgorithms();
}
public static AlgorithmArchiver getArchiver() {
@@ -89,6 +91,20 @@
}
private void loadUserAlgorithms() {
+ InputStream is = null;
+ try {
+ File pixelleDir = new File(System.getProperty("user.home"), PIXELLE);
+ pixelleDir.mkdirs();
+ File algoFile = new File(pixelleDir, ALGORITHMS_FILE);
+ if (algoFile.exists() && algoFile.isFile()) {
+ is = new BufferedInputStream(new FileInputStream(algoFile));
+ parseAlgorithms(is, userAlgorithms);
+ }
+ } catch (Exception e) {
+ JOptionPane.showMessageDialog(null, e.getMessage());
+ } finally {
+ Closer.close(is);
+ }
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2008-07-06 22:02:11 UTC (rev 148)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2008-07-06 22:09:40 UTC (rev 149)
@@ -52,12 +52,14 @@
public static final String OPTIONS_ITEM = "menu.transform.options";
public static final String TRANSFORM_NEW_ITEM = "menu.transform.newwindow";
public static final String TRANSFORM_ITEM = "menu.transform.transform";
+ public static final String SAVE_ALGORITHM = "save.algorithm";
public static final String RED_FORMULA = "formula.red";
public static final String GREEN_FORMULA = "formula.green";
public static final String BLUE_FORMULA = "formula.blue";
public static final String TRANSPARENCY_FORMULA = "formula.transparency";
public static final String SELECTION_FORMULA = "formula.selection";
public static final String PIXEL_ALGORITHMS = "title.algorithms";
+ public static final String PIXEL_ALGORITHM = "label.algorithm";
public static final String RED_LABEL = "label.red";
public static final String GREEN_LABEL = "label.green";
public static final String BLUE_LABEL = "label.blue";
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties 2008-07-06 22:02:11 UTC (rev 148)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties 2008-07-06 22:09:40 UTC (rev 149)
@@ -54,6 +54,8 @@
formula.selection = p[x,y].s
title.algorithms = Pixel Algorithms
+label.algorithm = Algorithm
+save.algorithm = Save
label.red = (Red)
label.green = (Green)
label.blue = (Blue)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-07-06 22:03:09
|
Revision: 148
http://pixelle.svn.sourceforge.net/pixelle/?rev=148&view=rev
Author: dbrosius
Date: 2008-07-06 15:02:11 -0700 (Sun, 06 Jul 2008)
Log Message:
-----------
parse system algorithms
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-06 21:29:32 UTC (rev 147)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-07-06 22:02:11 UTC (rev 148)
@@ -18,13 +18,37 @@
*/
package com.mebigfatguy.pixelle;
+import java.io.IOException;
+import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JPopupMenu;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+import com.mebigfatguy.pixelle.utils.Closer;
+
public class AlgorithmArchiver {
+ private static final String SYSTEM_ALGO_XML_PATH = "/com/mebigfatguy/pixelle/resources/algorithms.xml";
+ private static final String SYSTEM_ALGO_XSD_PATH = "/com/mebigfatguy/pixelle/resources/algorithms.xsd";
+ private static final String GROUP = "group";
+ private static final String ALGORITHM = "algorithm";
+ private static final String COMPONENT = "component";
+ private static final String NAME = "name";
+ private static final String RED = "red";
+ private static final String GREEN = "green";
+ private static final String BLUE = "blue";
+ private static final String TRANSPARENCY = "transparency";
+ private static final String SELECTION = "selection";
+
+
private static AlgorithmArchiver archiver = new AlgorithmArchiver();
private Map<String, Map<String, Map<PixelleComponent, String>>> systemAlgorithms;
@@ -33,7 +57,7 @@
private AlgorithmArchiver() {
systemAlgorithms = new HashMap<String, Map<String, Map<PixelleComponent, String>>>();
userAlgorithms = new HashMap<String, Map<String, Map<PixelleComponent, String>>>();
-
+ loadSystemAlgorithms();
}
public static AlgorithmArchiver getArchiver() {
@@ -51,4 +75,62 @@
public void removeAlgorithm(String group, String name) {
}
+
+ private void loadSystemAlgorithms() {
+ InputStream xmlIs = null;
+ try {
+ xmlIs = AlgorithmArchiver.class.getResourceAsStream(SYSTEM_ALGO_XML_PATH);
+ parseAlgorithms(xmlIs, systemAlgorithms);
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ Closer.close(xmlIs);
+ }
+ }
+
+ private void loadUserAlgorithms() {
+
+ }
+
+ private void parseAlgorithms(InputStream is, Map<String, Map<String, Map<PixelleComponent, String>>> algorithms) throws IOException, SAXException {
+ XMLReader r = XMLReaderFactory.createXMLReader();
+ r.setContentHandler(new DefaultHandler() {
+ Map<String, Map<PixelleComponent, String>> currentGroup = null;
+ Map<PixelleComponent, String> currentAlgorithm = null;
+ String currentComponentName = null;
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes atts) {
+ if (GROUP.equals(localName)) {
+ currentGroup = new HashMap<String, Map<PixelleComponent, String>>();
+ systemAlgorithms.put(atts.getValue(NAME), currentGroup);
+ } else if (ALGORITHM.equals(localName)) {
+ currentAlgorithm = new HashMap<PixelleComponent, String>();
+ currentGroup.put(atts.getValue(NAME), currentAlgorithm);
+ } else if (COMPONENT.equals(localName)) {
+ currentComponentName = atts.getValue(NAME);
+ }
+ }
+
+ @Override
+ public void characters(char[] c, int start, int offset) {
+ if (currentComponentName != null) {
+ PixelleComponent pc = PixelleComponent.valueOf(currentComponentName.toUpperCase());
+ currentAlgorithm.put(pc, new String(c, start, offset).trim());
+ }
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) {
+ if (COMPONENT.equals(localName)) {
+ currentComponentName = null;
+ } else if (ALGORITHM.equals(localName)) {
+ currentAlgorithm = null;
+ } else if (GROUP.equals(localName)) {
+ currentGroup = null;
+ }
+ }
+ });
+ r.parse(new InputSource(is));
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|