[Pixelle-commit] SF.net SVN: pixelle: [30] trunk/pixelle
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2008-06-20 03:55:27
|
Revision: 30
http://pixelle.svn.sourceforge.net/pixelle/?rev=30&view=rev
Author: dbrosius
Date: 2008-06-19 20:55:36 -0700 (Thu, 19 Jun 2008)
Log Message:
-----------
make the names more uniform
Modified Paths:
--------------
trunk/pixelle/etc/Pixelle.g
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpr.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpressionDialog.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
Added Paths:
-----------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleComponent.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java
Removed Paths:
-------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelComponent.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java
Modified: trunk/pixelle/etc/Pixelle.g
===================================================================
--- trunk/pixelle/etc/Pixelle.g 2008-06-20 02:59:41 UTC (rev 29)
+++ trunk/pixelle/etc/Pixelle.g 2008-06-20 03:55:36 UTC (rev 30)
@@ -44,7 +44,7 @@
mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
mv.visitInsn(Opcodes.RETURN);
mv.visitMaxs(0,0);
- mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "eval", "(Lcom/mebigfatguy/pixelle/PixelEval;II)D", null, new String[0]);
+ mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "eval", "(Lcom/mebigfatguy/pixelle/PixelleEval;II)D", null, new String[0]);
}
public byte[] getClassBytes() {
@@ -74,11 +74,11 @@
factor
: NUMBER
{mv.visitLdcInsn(Double.valueOf($NUMBER.text));}
- | 'p' {mv.visitVarInsn(Opcodes.ALOAD, 1);} '[' expr { mv.visitInsn(Opcodes.D2I); } ',' expr { mv.visitInsn(Opcodes.D2I); } ']' '.' spec=('r'|'g'|'b'|'t'|'s') {String s = $spec.text; mv.visitLdcInsn(Character.valueOf(s.charAt(0))); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "com/mebigfatguy/pixelle/PixelEval", "getValue", "(IIC)D" );}
+ | 'p' {mv.visitVarInsn(Opcodes.ALOAD, 1);} '[' expr { mv.visitInsn(Opcodes.D2I); } ',' expr { mv.visitInsn(Opcodes.D2I); } ']' '.' spec=('r'|'g'|'b'|'t'|'s') {String s = $spec.text; mv.visitLdcInsn(Character.valueOf(s.charAt(0))); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "com/mebigfatguy/pixelle/PixelleEval", "getValue", "(IIC)D" );}
| 'x' {mv.visitVarInsn(Opcodes.ILOAD, 2); mv.visitInsn(Opcodes.I2D);}
| 'y' {mv.visitVarInsn(Opcodes.ILOAD, 3); mv.visitInsn(Opcodes.I2D);}
- | 'width' {mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "com/mebigfatguy/pixelle/PixelEval", "getWidth", "()D" );}
- | 'height' {mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "com/mebigfatguy/pixelle/PixelEval", "getHeight", "()D" );};
+ | 'width' {mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "com/mebigfatguy/pixelle/PixelleEval", "getWidth", "()D" );}
+ | 'height' {mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "com/mebigfatguy/pixelle/PixelleEval", "getHeight", "()D" );};
NUMBER : '0'..'9'+ ( '.' ('0'..'9'+))?;
Deleted: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelComponent.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelComponent.java 2008-06-20 02:59:41 UTC (rev 29)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelComponent.java 2008-06-20 03:55:36 UTC (rev 30)
@@ -1,44 +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;
-
-
-public enum PixelComponent {
- RED('r', 0),
- GREEN('g', 1),
- BLUE('b', 2),
- TRANSPARENCY('t', 3),
- SELECTION('s', -1);
-
- private char pixelSpec;
- private int compOffset;
-
- PixelComponent(char c, int offset) {
- pixelSpec = c;
- compOffset = offset;
- }
-
- public char getPixelSpec() {
- return pixelSpec;
- }
-
- public int getComponentOffset() {
- return compOffset;
- }
-}
Deleted: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java 2008-06-20 02:59:41 UTC (rev 29)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java 2008-06-20 03:55:36 UTC (rev 30)
@@ -1,77 +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;
-
-import java.awt.image.BufferedImage;
-import java.awt.image.DataBuffer;
-
-public class PixelEval {
-
- private DataBuffer buffer;
- private int width;
- private int height;
-
- public PixelEval(PixelleImage image) {
- buffer = image.getBuffer();
- width = image.getWidth();
- height = image.getHeight();
- }
-
- public double getValue(int x, int y, char pixelSpec) {
- if ((x < 0) || (x >= width))
- return 1.0;
- if ((y < 0) || (y >= height))
- return 1.0;
-
- int offset;
- switch (pixelSpec) {
- case 'r':
- offset = 0;
- break;
-
- case 'g':
- offset = 1;
- break;
-
- case 'b':
- offset = 2;
- break;
-
- case 't':
- offset = 3;
- break;
-
- case 's':
- return 0.0;
-
- default:
- return 0.0;
- }
-
- return (double)buffer.getElem(y * width * 3 + x * 3 + offset);
- }
-
- public int getWidth() {
- return width;
- }
-
- public int getHeight() {
- return height;
- }
-}
Copied: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleComponent.java (from rev 24, trunk/pixelle/src/com/mebigfatguy/pixelle/PixelComponent.java)
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleComponent.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleComponent.java 2008-06-20 03:55:36 UTC (rev 30)
@@ -0,0 +1,44 @@
+/*
+ * 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;
+
+
+public enum PixelleComponent {
+ RED('r', 0),
+ GREEN('g', 1),
+ BLUE('b', 2),
+ TRANSPARENCY('t', 3),
+ SELECTION('s', -1);
+
+ private char pixelSpec;
+ private int compOffset;
+
+ PixelleComponent(char c, int offset) {
+ pixelSpec = c;
+ compOffset = offset;
+ }
+
+ public char getPixelSpec() {
+ return pixelSpec;
+ }
+
+ public int getComponentOffset() {
+ return compOffset;
+ }
+}
Copied: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java (from rev 28, trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java)
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java 2008-06-20 03:55:36 UTC (rev 30)
@@ -0,0 +1,77 @@
+/*
+ * 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;
+
+import java.awt.image.BufferedImage;
+import java.awt.image.DataBuffer;
+
+public class PixelleEval {
+
+ private DataBuffer buffer;
+ private int width;
+ private int height;
+
+ public PixelleEval(PixelleImage image) {
+ buffer = image.getBuffer();
+ width = image.getWidth();
+ height = image.getHeight();
+ }
+
+ public double getValue(int x, int y, char pixelSpec) {
+ if ((x < 0) || (x >= width))
+ return 1.0;
+ if ((y < 0) || (y >= height))
+ return 1.0;
+
+ int offset;
+ switch (pixelSpec) {
+ case 'r':
+ offset = 0;
+ break;
+
+ case 'g':
+ offset = 1;
+ break;
+
+ case 'b':
+ offset = 2;
+ break;
+
+ case 't':
+ offset = 3;
+ break;
+
+ case 's':
+ return 0.0;
+
+ default:
+ return 0.0;
+ }
+
+ return (double)buffer.getElem(y * width * 3 + x * 3 + offset);
+ }
+
+ public int getWidth() {
+ return width;
+ }
+
+ public int getHeight() {
+ return height;
+ }
+}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpr.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpr.java 2008-06-20 02:59:41 UTC (rev 29)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpr.java 2008-06-20 03:55:36 UTC (rev 30)
@@ -19,5 +19,5 @@
package com.mebigfatguy.pixelle;
public interface PixelleExpr {
- double eval(PixelEval e, int x, int y);
+ double eval(PixelleEval e, int x, int y);
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpressionDialog.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpressionDialog.java 2008-06-20 02:59:41 UTC (rev 29)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpressionDialog.java 2008-06-20 03:55:36 UTC (rev 30)
@@ -85,13 +85,13 @@
return clickedOK;
}
- public Map<PixelComponent, String> getAlgorithms() {
- Map<PixelComponent, String> algorithms = new EnumMap<PixelComponent, String>(PixelComponent.class);
- algorithms.put(PixelComponent.RED, editor[0].getText());
- algorithms.put(PixelComponent.GREEN, editor[1].getText());
- algorithms.put(PixelComponent.BLUE, editor[2].getText());
- algorithms.put(PixelComponent.TRANSPARENCY, editor[3].getText());
- algorithms.put(PixelComponent.SELECTION, editor[4].getText());
+ public Map<PixelleComponent, String> getAlgorithms() {
+ Map<PixelleComponent, String> algorithms = new EnumMap<PixelleComponent, String>(PixelleComponent.class);
+ algorithms.put(PixelleComponent.RED, editor[0].getText());
+ algorithms.put(PixelleComponent.GREEN, editor[1].getText());
+ algorithms.put(PixelleComponent.BLUE, editor[2].getText());
+ algorithms.put(PixelleComponent.TRANSPARENCY, editor[3].getText());
+ algorithms.put(PixelleComponent.SELECTION, editor[4].getText());
return algorithms;
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-06-20 02:59:41 UTC (rev 29)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-06-20 03:55:36 UTC (rev 30)
@@ -35,23 +35,23 @@
public class PixelleTransformer {
private PixelleImage srcImage;
- private Map<PixelComponent, String> algorithms = null;
+ private Map<PixelleComponent, String> algorithms = null;
- public PixelleTransformer(PixelleImage image, Map<PixelComponent, String> algos) {
+ public PixelleTransformer(PixelleImage image, Map<PixelleComponent, String> algos) {
srcImage = image;
algorithms = algos;
}
public PixelleImage transform() {
try {
- PixelEval pe = new PixelEval(srcImage);
+ PixelleEval pe = new PixelleEval(srcImage);
PixelleClassLoader pcl = AccessController.doPrivileged(new PrivilegedAction<PixelleClassLoader>() {
public PixelleClassLoader run() {
return new PixelleClassLoader(Thread.currentThread().getContextClassLoader());
}
});
- for (Map.Entry<PixelComponent, String> entry : algorithms.entrySet()) {
+ for (Map.Entry<PixelleComponent, String> entry : algorithms.entrySet()) {
CharStream cs = new ANTLRStringStream(entry.getValue());
PixelleLexer pl = new PixelleLexer(cs);
CommonTokenStream tokens = new CommonTokenStream();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|