pixelle-commit Mailing List for pixelle (Page 12)
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-06-21 17:18:14
|
Revision: 47
http://pixelle.svn.sourceforge.net/pixelle/?rev=47&view=rev
Author: dbrosius
Date: 2008-06-21 09:50:26 -0700 (Sat, 21 Jun 2008)
Log Message:
-----------
action for options item
Added Paths:
-----------
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OptionsAction.java
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OptionsAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OptionsAction.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OptionsAction.java 2008-06-21 16:50:26 UTC (rev 47)
@@ -0,0 +1,46 @@
+/*
+ * 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.actions;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+import com.mebigfatguy.pixelle.PixelleBundle;
+import com.mebigfatguy.pixelle.PixelleFrame;
+import com.mebigfatguy.pixelle.dialogs.PixelleOptionsDialog;
+
+public class OptionsAction extends AbstractAction {
+
+ private static final long serialVersionUID = -4788815421907339556L;
+
+ PixelleFrame frame;
+
+ public OptionsAction(PixelleFrame pf) {
+ super(PixelleBundle.getString(PixelleBundle.OPTIONS_ITEM));
+ frame = pf;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ PixelleOptionsDialog d = new PixelleOptionsDialog(frame);
+ d.setLocationRelativeTo(frame);
+ d.setModal(true);
+ d.setVisible(true);
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OptionsAction.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-06-21 17:18:00
|
Revision: 48
http://pixelle.svn.sourceforge.net/pixelle/?rev=48&view=rev
Author: dbrosius
Date: 2008-06-21 10:16:04 -0700 (Sat, 21 Jun 2008)
Log Message:
-----------
add some implementation to the options dialog
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OptionsAction.java
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleOptionsDialog.java
trunk/pixelle/src/com/mebigfatguy/pixelle/pixelle.properties
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2008-06-21 16:50:26 UTC (rev 47)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2008-06-21 17:16:04 UTC (rev 48)
@@ -57,6 +57,11 @@
public static final String BLUE_LABEL = "label.blue";
public static final String TRANSPARENCY_LABEL = "label.transparency";
public static final String SELECTION_LABEL = "label.selection";
+ public static final String PIXEL_OPTIONS = "title.pixel_options";
+ public static final String OUT_OF_BOUNDS_PIXELS = "title.out_of_bounds_pixels";
+ public static final String STATIC_COLOR = "label.color";
+ public static final String BORDER_COLOR = "label.border_color";
+ public static final String WRAPPED_COLOR = "label.wrapped_color";
private static ResourceBundle rb = ResourceBundle.getBundle("com/mebigfatguy/pixelle/pixelle");
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OptionsAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OptionsAction.java 2008-06-21 16:50:26 UTC (rev 47)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OptionsAction.java 2008-06-21 17:16:04 UTC (rev 48)
@@ -42,5 +42,8 @@
d.setLocationRelativeTo(frame);
d.setModal(true);
d.setVisible(true);
+ if (d.isOK()) {
+
+ }
}
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleOptionsDialog.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleOptionsDialog.java 2008-06-21 16:50:26 UTC (rev 47)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleOptionsDialog.java 2008-06-21 17:16:04 UTC (rev 48)
@@ -18,13 +18,107 @@
*/
package com.mebigfatguy.pixelle.dialogs;
+import java.awt.Container;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
import javax.swing.JDialog;
+import javax.swing.JPanel;
+import com.mebigfatguy.pixelle.PixelleBundle;
import com.mebigfatguy.pixelle.PixelleFrame;
+import com.mebigfatguy.pixelle.utils.GuiUtils;
public class PixelleOptionsDialog extends JDialog {
+ private JCheckBox colorBox = new JCheckBox(PixelleBundle.getString(PixelleBundle.STATIC_COLOR));
+ private JCheckBox borderColorBox = new JCheckBox(PixelleBundle.getString(PixelleBundle.BORDER_COLOR));
+ private JCheckBox wrappedColorBox = new JCheckBox(PixelleBundle.getString(PixelleBundle.WRAPPED_COLOR));
+ private JButton ok = new JButton(PixelleBundle.getString(PixelleBundle.OK));
+ private JButton cancel = new JButton(PixelleBundle.getString(PixelleBundle.CANCEL));
+ private boolean okClicked = false;
+
public PixelleOptionsDialog(PixelleFrame owner) {
+ super(owner, PixelleBundle.getString(PixelleBundle.PIXEL_OPTIONS));
+ initComponents();
+ initListeners();
+ pack();
+ }
+
+ public boolean isOK() {
+ return okClicked;
+ }
+
+ private void initComponents() {
+ Container cp = getContentPane();
+ cp.setLayout(new BoxLayout(cp, BoxLayout.Y_AXIS));
+ {
+ JPanel p = new JPanel();
+ p.setLayout(new GridLayout(3, 1));
+ p.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), PixelleBundle.getString(PixelleBundle.OUT_OF_BOUNDS_PIXELS)));
+
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, colorBox, borderColorBox, wrappedColorBox);
+
+ p.add(colorBox);
+ p.add(borderColorBox);
+ p.add(wrappedColorBox);
+
+ ButtonGroup g = new ButtonGroup();
+ g.add(colorBox);
+ g.add(borderColorBox);
+ g.add(wrappedColorBox);
+
+ borderColorBox.setSelected(true);
+
+ cp.add(p);
+ }
+
+ cp.add(Box.createVerticalGlue());
+
+ {
+ JPanel p = new JPanel();
+ p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
+ p.setBorder(BorderFactory.createEmptyBorder(4, 10, 4, 10));
+ p.add(Box.createHorizontalGlue());
+
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, ok, cancel);
+ p.add(ok);
+ p.add(Box.createHorizontalStrut(10));
+ p.add(cancel);
+ p.add(Box.createHorizontalGlue());
+ cp.add(p);
+ }
}
+
+ private void initListeners() {
+ ok.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ okClicked = true;
+ dispose();
+ }
+ });
+
+ cancel.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ dispose();
+ }
+ });
+
+ addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent we) {
+ dispose();
+ }
+ });
+ }
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/pixelle.properties
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/pixelle.properties 2008-06-21 16:50:26 UTC (rev 47)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/pixelle.properties 2008-06-21 17:16:04 UTC (rev 48)
@@ -57,4 +57,10 @@
label.green = (Green)
label.blue = (Blue)
label.transparency = (Transparency)
-label.selection = (Selection)
\ No newline at end of file
+label.selection = (Selection)
+
+title.pixel_options = Pixel Options
+title.out_of_bounds_pixels = For out of Bounds Pixels use:
+label.color = Color
+label.border_color = Closest border color
+label.wrapped_color = Wrapped color
\ 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-06-21 16:47:58
|
Revision: 46
http://pixelle.svn.sourceforge.net/pixelle/?rev=46&view=rev
Author: dbrosius
Date: 2008-06-21 09:48:00 -0700 (Sat, 21 Jun 2008)
Log Message:
-----------
add in options dialog item
Modified Paths:
--------------
trunk/pixelle/build.xml
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java
trunk/pixelle/src/com/mebigfatguy/pixelle/pixelle.properties
Modified: trunk/pixelle/build.xml
===================================================================
--- trunk/pixelle/build.xml 2008-06-21 16:45:44 UTC (rev 45)
+++ trunk/pixelle/build.xml 2008-06-21 16:48:00 UTC (rev 46)
@@ -42,13 +42,8 @@
<delete dir="${classes.dir}"/>
<delete dir="${antlr.gen.dir}"/>
<delete dir="${javadoc.dir}"/>
+ <delete dir="${jnlp.dir}"/>
<delete>
- <fileset dir="${jnlp.dir}">
- <include name="pixelle*.jar"/>
- <include name="*.jnlp"/>
- </fileset>
- </delete>
- <delete>
<fileset dir="${basedir}" includes="*.zip"/>
</delete>
</target>
@@ -58,6 +53,7 @@
<mkdir dir="${antlr.gen.dir}"/>
<mkdir dir="${src.dir}/com/mebigfatguy"/>
<mkdir dir="${javadoc.dir}"/>
+ <mkdir dir="${jnlp.dir}"/>
<path id="pixelle.classpath">
<pathelement location="${lib.dir}/antlr-runtime-3.1b1.jar"/>
<pathelement location="${lib.dir}/asm-3.1.jar"/>
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2008-06-21 16:45:44 UTC (rev 45)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2008-06-21 16:48:00 UTC (rev 46)
@@ -44,6 +44,7 @@
public static final String EIGHTTIMES_ITEM = "menu.view.eight_times";
public static final String FITTOWINDOW_ITEM = "menu.view.fit_to_window";
public static final String TRANSFORM_MENU = "menu.transform.title";
+ public static final String OPTIONS_ITEM = "menu.transform.options";
public static final String TRANSFORM_ITEM = "menu.transform.transform";
public static final String RED_FORMULA = "formula.red";
public static final String GREEN_FORMULA = "formula.green";
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java 2008-06-21 16:45:44 UTC (rev 45)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java 2008-06-21 16:48:00 UTC (rev 46)
@@ -43,6 +43,7 @@
import com.mebigfatguy.pixelle.actions.CloseFileAction;
import com.mebigfatguy.pixelle.actions.NewFileAction;
import com.mebigfatguy.pixelle.actions.OpenFileAction;
+import com.mebigfatguy.pixelle.actions.OptionsAction;
import com.mebigfatguy.pixelle.actions.PageSetupAction;
import com.mebigfatguy.pixelle.actions.PrintAction;
import com.mebigfatguy.pixelle.actions.QuitAction;
@@ -77,6 +78,7 @@
JCheckBoxMenuItem fitToWindowItem;
JMenu transformMenu;
+ JMenuItem optionsItem;
JMenuItem transformItem;
ResourceBundle rb = ResourceBundle.getBundle("com.mebigfatguy.pixelle.pixelle");
@@ -163,6 +165,8 @@
mb.add(viewMenu);
transformMenu = new JMenu(rb.getString(PixelleBundle.TRANSFORM_MENU));
+ optionsItem = new JMenuItem(new OptionsAction(this));
+ transformMenu.add(optionsItem);
transformItem = new JMenuItem(new TransformAction(this));
transformMenu.add(transformItem);
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java 2008-06-21 16:45:44 UTC (rev 45)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java 2008-06-21 16:48:00 UTC (rev 46)
@@ -22,12 +22,11 @@
import javax.swing.AbstractAction;
-import com.mebigfatguy.pixelle.FrameMgr;
import com.mebigfatguy.pixelle.PixelleBundle;
-import com.mebigfatguy.pixelle.PixelleExpressionDialog;
import com.mebigfatguy.pixelle.PixelleFrame;
import com.mebigfatguy.pixelle.PixelleImage;
import com.mebigfatguy.pixelle.PixelleTransformer;
+import com.mebigfatguy.pixelle.dialogs.PixelleExpressionDialog;
public class TransformAction extends AbstractAction {
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/pixelle.properties
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/pixelle.properties 2008-06-21 16:45:44 UTC (rev 45)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/pixelle.properties 2008-06-21 16:48:00 UTC (rev 46)
@@ -43,6 +43,7 @@
menu.view.fit_to_window = Fit to Window
menu.transform.title = Transform
+menu.transform.options = Options
menu.transform.transform = Transform
formula.red = p[x,y].r
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-06-21 16:45:36
|
Revision: 45
http://pixelle.svn.sourceforge.net/pixelle/?rev=45&view=rev
Author: dbrosius
Date: 2008-06-21 09:45:44 -0700 (Sat, 21 Jun 2008)
Log Message:
-----------
fix package
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-06-21 16:43:21 UTC (rev 44)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-06-21 16:45:44 UTC (rev 45)
@@ -16,7 +16,7 @@
* 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;
+package com.mebigfatguy.pixelle.dialogs;
import java.awt.BorderLayout;
import java.awt.Container;
@@ -37,11 +37,15 @@
import javax.swing.JPanel;
import javax.swing.JTextField;
+import com.mebigfatguy.pixelle.PixelleBundle;
+import com.mebigfatguy.pixelle.PixelleComponent;
+import com.mebigfatguy.pixelle.PixelleFrame;
import com.mebigfatguy.pixelle.utils.GuiUtils;
public class PixelleExpressionDialog extends JDialog {
- private static final long serialVersionUID = -4549468926608244333L;
+ private static final long serialVersionUID = -420573137466431577L;
+
private static final int NUM_LABELS = 5;
private final JLabel lhs[] =
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-06-21 16:43:16
|
Revision: 44
http://pixelle.svn.sourceforge.net/pixelle/?rev=44&view=rev
Author: dbrosius
Date: 2008-06-21 09:43:21 -0700 (Sat, 21 Jun 2008)
Log Message:
-----------
move dialog to new dialog package
Added Paths:
-----------
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
Removed Paths:
-------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpressionDialog.java
Deleted: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpressionDialog.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpressionDialog.java 2008-06-21 16:42:25 UTC (rev 43)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpressionDialog.java 2008-06-21 16:43:21 UTC (rev 44)
@@ -1,148 +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.BorderLayout;
-import java.awt.Container;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.EnumMap;
-import java.util.Map;
-
-import javax.swing.BorderFactory;
-import javax.swing.Box;
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JDialog;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-
-import com.mebigfatguy.pixelle.utils.GuiUtils;
-
-public class PixelleExpressionDialog extends JDialog {
- private static final long serialVersionUID = -4549468926608244333L;
-
- private static final int NUM_LABELS = 5;
-
- private final JLabel lhs[] =
- {
- new JLabel(PixelleBundle.getString(PixelleBundle.RED_FORMULA) + " = "),
- new JLabel(PixelleBundle.getString(PixelleBundle.GREEN_FORMULA) + " = "),
- new JLabel(PixelleBundle.getString(PixelleBundle.BLUE_FORMULA) + " = "),
- new JLabel(PixelleBundle.getString(PixelleBundle.TRANSPARENCY_FORMULA) + " = "),
- new JLabel(PixelleBundle.getString(PixelleBundle.SELECTION_FORMULA) + " = ")
- };
-
- private final JTextField editor[] =
- {
- new JTextField(PixelleBundle.getString(PixelleBundle.RED_FORMULA), 80),
- new JTextField(PixelleBundle.getString(PixelleBundle.GREEN_FORMULA), 80),
- new JTextField(PixelleBundle.getString(PixelleBundle.BLUE_FORMULA), 80),
- new JTextField(PixelleBundle.getString(PixelleBundle.TRANSPARENCY_FORMULA), 80),
- new JTextField(PixelleBundle.getString(PixelleBundle.SELECTION_FORMULA), 80)
- };
-
- private final JLabel labels[] =
- {
- new JLabel(PixelleBundle.getString(PixelleBundle.RED_LABEL)),
- new JLabel(PixelleBundle.getString(PixelleBundle.GREEN_LABEL)),
- new JLabel(PixelleBundle.getString(PixelleBundle.BLUE_LABEL)),
- new JLabel(PixelleBundle.getString(PixelleBundle.TRANSPARENCY_LABEL)),
- new JLabel(PixelleBundle.getString(PixelleBundle.SELECTION_LABEL))
- };
-
- JButton ok;
- JButton cancel;
- boolean clickedOK = false;
-
- public PixelleExpressionDialog(PixelleFrame owner) {
- super(owner, PixelleBundle.getString(PixelleBundle.PIXEL_ALGORITHMS));
- initComponents();
- initListeners();
- }
-
- public boolean isOK() {
- return clickedOK;
- }
-
- 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;
- }
-
- 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);
- 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));
- GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, new JComponent[] {ok, cancel});
-
- JPanel p = new JPanel();
- p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
- p.add(Box.createHorizontalGlue());
- p.add(ok);
- p.add(Box.createHorizontalStrut(10));
- p.add(cancel);
- p.add(Box.createHorizontalGlue());
- p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
- cp.add(p);
- pack();
- }
-
- private void initListeners() {
- ok.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent ae) {
- clickedOK = true;
- dispose();
- }
- });
-
- cancel.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent ae) {
- dispose();
- }
- });
-
- setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- }
-}
Copied: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java (from rev 43, trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpressionDialog.java)
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-06-21 16:43:21 UTC (rev 44)
@@ -0,0 +1,148 @@
+/*
+ * 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.BorderLayout;
+import java.awt.Container;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.EnumMap;
+import java.util.Map;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+
+import com.mebigfatguy.pixelle.utils.GuiUtils;
+
+public class PixelleExpressionDialog extends JDialog {
+ private static final long serialVersionUID = -4549468926608244333L;
+
+ private static final int NUM_LABELS = 5;
+
+ private final JLabel lhs[] =
+ {
+ new JLabel(PixelleBundle.getString(PixelleBundle.RED_FORMULA) + " = "),
+ new JLabel(PixelleBundle.getString(PixelleBundle.GREEN_FORMULA) + " = "),
+ new JLabel(PixelleBundle.getString(PixelleBundle.BLUE_FORMULA) + " = "),
+ new JLabel(PixelleBundle.getString(PixelleBundle.TRANSPARENCY_FORMULA) + " = "),
+ new JLabel(PixelleBundle.getString(PixelleBundle.SELECTION_FORMULA) + " = ")
+ };
+
+ private final JTextField editor[] =
+ {
+ new JTextField(PixelleBundle.getString(PixelleBundle.RED_FORMULA), 80),
+ new JTextField(PixelleBundle.getString(PixelleBundle.GREEN_FORMULA), 80),
+ new JTextField(PixelleBundle.getString(PixelleBundle.BLUE_FORMULA), 80),
+ new JTextField(PixelleBundle.getString(PixelleBundle.TRANSPARENCY_FORMULA), 80),
+ new JTextField(PixelleBundle.getString(PixelleBundle.SELECTION_FORMULA), 80)
+ };
+
+ private final JLabel labels[] =
+ {
+ new JLabel(PixelleBundle.getString(PixelleBundle.RED_LABEL)),
+ new JLabel(PixelleBundle.getString(PixelleBundle.GREEN_LABEL)),
+ new JLabel(PixelleBundle.getString(PixelleBundle.BLUE_LABEL)),
+ new JLabel(PixelleBundle.getString(PixelleBundle.TRANSPARENCY_LABEL)),
+ new JLabel(PixelleBundle.getString(PixelleBundle.SELECTION_LABEL))
+ };
+
+ JButton ok;
+ JButton cancel;
+ boolean clickedOK = false;
+
+ public PixelleExpressionDialog(PixelleFrame owner) {
+ super(owner, PixelleBundle.getString(PixelleBundle.PIXEL_ALGORITHMS));
+ initComponents();
+ initListeners();
+ }
+
+ public boolean isOK() {
+ return clickedOK;
+ }
+
+ 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;
+ }
+
+ 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);
+ 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));
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, new JComponent[] {ok, cancel});
+
+ JPanel p = new JPanel();
+ p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
+ p.add(Box.createHorizontalGlue());
+ p.add(ok);
+ p.add(Box.createHorizontalStrut(10));
+ p.add(cancel);
+ p.add(Box.createHorizontalGlue());
+ p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
+ cp.add(p);
+ pack();
+ }
+
+ private void initListeners() {
+ ok.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ clickedOK = true;
+ dispose();
+ }
+ });
+
+ cancel.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ dispose();
+ }
+ });
+
+ setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-06-21 16:42:16
|
Revision: 43
http://pixelle.svn.sourceforge.net/pixelle/?rev=43&view=rev
Author: dbrosius
Date: 2008-06-21 09:42:25 -0700 (Sat, 21 Jun 2008)
Log Message:
-----------
stub in the options dialog
Added Paths:
-----------
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleOptionsDialog.java
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleOptionsDialog.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleOptionsDialog.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleOptionsDialog.java 2008-06-21 16:42:25 UTC (rev 43)
@@ -0,0 +1,30 @@
+/*
+ * 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 javax.swing.JDialog;
+
+import com.mebigfatguy.pixelle.PixelleFrame;
+
+public class PixelleOptionsDialog extends JDialog {
+
+ public PixelleOptionsDialog(PixelleFrame owner) {
+
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleOptionsDialog.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-06-21 16:41:31
|
Revision: 41
http://pixelle.svn.sourceforge.net/pixelle/?rev=41&view=rev
Author: dbrosius
Date: 2008-06-21 09:36:42 -0700 (Sat, 21 Jun 2008)
Log Message:
-----------
Removed file/folder
Removed Paths:
-------------
trunk/pixelle/htdocs/javadoc/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-06-21 16:41:31
|
Revision: 42
http://pixelle.svn.sourceforge.net/pixelle/?rev=42&view=rev
Author: dbrosius
Date: 2008-06-21 09:37:04 -0700 (Sat, 21 Jun 2008)
Log Message:
-----------
Removed file/folder
Removed Paths:
-------------
trunk/pixelle/htdocs/jnlp/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-06-21 03:11:11
|
Revision: 39
http://pixelle.svn.sourceforge.net/pixelle/?rev=39&view=rev
Author: dbrosius
Date: 2008-06-20 20:11:14 -0700 (Fri, 20 Jun 2008)
Log Message:
-----------
add max and min
Modified Paths:
--------------
trunk/pixelle/etc/Pixelle.g
Modified: trunk/pixelle/etc/Pixelle.g
===================================================================
--- trunk/pixelle/etc/Pixelle.g 2008-06-21 03:06:19 UTC (rev 38)
+++ trunk/pixelle/etc/Pixelle.g 2008-06-21 03:11:14 UTC (rev 39)
@@ -78,7 +78,9 @@
| 'y' {mv.visitVarInsn(Opcodes.ILOAD, 3); mv.visitInsn(Opcodes.I2D);}
| 'width' {mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "com/mebigfatguy/pixelle/PixelleEval", "getWidth", "()I" ); mv.visitInsn(Opcodes.I2D);}
| 'height' {mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "com/mebigfatguy/pixelle/PixelleEval", "getHeight", "()I" ); mv.visitInsn(Opcodes.I2D);}
- | 'abs' '(' expr ')' {mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Math", "abs", "(D)D");};
+ | 'abs' '(' expr ')' {mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Math", "abs", "(D)D");}
+ | 'max' '(' expr ',' expr ')' {mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Math", "max", "(DD)D");}
+ | 'min' '(' expr ',' expr ')' {mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Math", "min", "(DD)D");} ;
NUMBER : '0'..'9'+ ( '.' ('0'..'9'+))?;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-06-21 03:06:12
|
Revision: 38
http://pixelle.svn.sourceforge.net/pixelle/?rev=38&view=rev
Author: dbrosius
Date: 2008-06-20 20:06:19 -0700 (Fri, 20 Jun 2008)
Log Message:
-----------
add '(' expr ')' and abs( expr )
Modified Paths:
--------------
trunk/pixelle/etc/Pixelle.g
Modified: trunk/pixelle/etc/Pixelle.g
===================================================================
--- trunk/pixelle/etc/Pixelle.g 2008-06-20 05:59:16 UTC (rev 37)
+++ trunk/pixelle/etc/Pixelle.g 2008-06-21 03:06:19 UTC (rev 38)
@@ -48,14 +48,12 @@
}
public byte[] getClassBytes() {
- mv.visitInsn(Opcodes.DRETURN);
- mv.visitMaxs(0,0);
- cw.visitEnd();
return cw.toByteArray();
}
}
-pixelle : expr;
+pixelle :
+ expr {mv.visitInsn(Opcodes.DRETURN);mv.visitMaxs(0,0);cw.visitEnd();} ;
expr
: term
@@ -65,8 +63,8 @@
{mv.visitInsn(Opcodes.DSUB);})*;
term
- : factor {}
- ('*' factor
+ : factor
+ ('*' factor
{mv.visitInsn(Opcodes.DMUL);}
| '/' factor
{mv.visitInsn(Opcodes.DDIV);})*;
@@ -74,12 +72,14 @@
factor
: NUMBER
{mv.visitLdcInsn(Double.valueOf($NUMBER.text));}
+ | '(' expr ')'
| '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/PixelleEval", "getWidth", "()I" ); mv.visitInsn(Opcodes.I2D);}
- | 'height' {mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "com/mebigfatguy/pixelle/PixelleEval", "getHeight", "()I" ); mv.visitInsn(Opcodes.I2D);};
-
+ | 'height' {mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "com/mebigfatguy/pixelle/PixelleEval", "getHeight", "()I" ); mv.visitInsn(Opcodes.I2D);}
+ | 'abs' '(' expr ')' {mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Math", "abs", "(D)D");};
+
NUMBER : '0'..'9'+ ( '.' ('0'..'9'+))?;
NEWLINE:'\r'? '\n' ;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-06-20 05:59:12
|
Revision: 37
http://pixelle.svn.sourceforge.net/pixelle/?rev=37&view=rev
Author: dbrosius
Date: 2008-06-19 22:59:16 -0700 (Thu, 19 Jun 2008)
Log Message:
-----------
fix the .g def of getWidth and getHeight to return an int, and then do I2D
Modified Paths:
--------------
trunk/pixelle/etc/Pixelle.g
Modified: trunk/pixelle/etc/Pixelle.g
===================================================================
--- trunk/pixelle/etc/Pixelle.g 2008-06-20 05:38:41 UTC (rev 36)
+++ trunk/pixelle/etc/Pixelle.g 2008-06-20 05:59:16 UTC (rev 37)
@@ -77,8 +77,8 @@
| '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/PixelleEval", "getWidth", "()D" );}
- | 'height' {mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "com/mebigfatguy/pixelle/PixelleEval", "getHeight", "()D" );};
+ | 'width' {mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "com/mebigfatguy/pixelle/PixelleEval", "getWidth", "()I" ); mv.visitInsn(Opcodes.I2D);}
+ | 'height' {mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "com/mebigfatguy/pixelle/PixelleEval", "getHeight", "()I" ); mv.visitInsn(Opcodes.I2D);};
NUMBER : '0'..'9'+ ( '.' ('0'..'9'+))?;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-06-20 05:38:32
|
Revision: 36
http://pixelle.svn.sourceforge.net/pixelle/?rev=36&view=rev
Author: dbrosius
Date: 2008-06-19 22:38:41 -0700 (Thu, 19 Jun 2008)
Log Message:
-----------
no transparency is 255, and also create a new image, and put it in a new frame when a transform occurs.
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java
trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteABGR.java
trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteBGR.java
trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalByteGray.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java 2008-06-20 04:46:24 UTC (rev 35)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java 2008-06-20 05:38:41 UTC (rev 36)
@@ -67,7 +67,7 @@
return 0.0;
}
}
-
+
public int getWidth() {
return width;
}
@@ -79,4 +79,7 @@
private double getSelectionValue(int x, int y) {
return 0.0;
}
+
+ private void setSelectionValue(int x, int y, double value) {
+ }
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java 2008-06-20 04:46:24 UTC (rev 35)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java 2008-06-20 05:38:41 UTC (rev 36)
@@ -21,6 +21,7 @@
import java.awt.image.BufferedImage;
import com.mebigfatguy.pixelle.eval.PixelleEval3ByteBGR;
+import com.mebigfatguy.pixelle.eval.PixelleEvalByteGray;
public class PixelleEvalFactory {
@@ -40,7 +41,7 @@
break;
case BufferedImage.TYPE_BYTE_GRAY:
- break;
+ return new PixelleEvalByteGray(image);
case BufferedImage.TYPE_INT_ARGB:
break;
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java 2008-06-20 04:46:24 UTC (rev 35)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java 2008-06-20 05:38:41 UTC (rev 36)
@@ -19,11 +19,9 @@
package com.mebigfatguy.pixelle;
import java.awt.BorderLayout;
-import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
-import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ResourceBundle;
@@ -50,6 +48,7 @@
import com.mebigfatguy.pixelle.actions.SaveFileAsAction;
import com.mebigfatguy.pixelle.actions.TransformAction;
import com.mebigfatguy.pixelle.actions.ZoomAction;
+import com.mebigfatguy.pixelle.utils.GuiUtils;
import com.mebigfatguy.pixelle.utils.ZoomLevel;
public class PixelleFrame extends JFrame {
@@ -88,6 +87,18 @@
setTitle(rb.getString("pixelle.title"));
}
+ public PixelleFrame(PixelleImage srcImage) {
+ this();
+ image = srcImage;
+ Container cp = getContentPane();
+ cp.removeAll();
+ setZoom(ZoomLevel.FitToWindow);
+ scroll = new JScrollPane(panel);
+ cp.add(scroll, BorderLayout.CENTER);
+ setBounds(GuiUtils.getScreenBounds());
+ FrameMgr.getInstance().add(this);
+ }
+
private void initComponents() {
JMenuBar mb = new JMenuBar();
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-06-20 04:46:24 UTC (rev 35)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-06-20 05:38:41 UTC (rev 36)
@@ -18,7 +18,7 @@
*/
package com.mebigfatguy.pixelle;
-import java.awt.image.DataBuffer;
+import java.awt.image.BufferedImage;
import java.io.FileOutputStream;
import java.io.IOException;
import java.security.AccessController;
@@ -31,6 +31,7 @@
import com.mebigfatguy.pixelle.antlr.PixelleLexer;
import com.mebigfatguy.pixelle.antlr.PixelleParser;
+import com.mebigfatguy.pixelle.eval.PixelleEval3ByteABGR;
public class PixelleTransformer {
@@ -44,7 +45,12 @@
public PixelleImage transform() {
try {
- PixelleEval pe = PixelleEvalFactory.create(srcImage);
+ /** eventually allow for gui to set width/height */
+ PixelleImage destImage = new PixelleImage(new BufferedImage(srcImage.getWidth(), srcImage.getHeight(), BufferedImage.TYPE_4BYTE_ABGR));
+
+ PixelleEval srcPE = PixelleEvalFactory.create(srcImage);
+ PixelleEval3ByteABGR destPE = new PixelleEval3ByteABGR(destImage);
+
PixelleClassLoader pcl = AccessController.doPrivileged(new PrivilegedAction<PixelleClassLoader>() {
public PixelleClassLoader run() {
return new PixelleClassLoader(Thread.currentThread().getContextClassLoader());
@@ -68,22 +74,21 @@
Class<?> cl = pcl.loadClass(clsName);
PixelleExpr expr = (PixelleExpr)cl.newInstance();
- DataBuffer buffer = srcImage.getBuffer();
- int width = srcImage.getWidth();
- int height = srcImage.getHeight();
- int offset = entry.getKey().getComponentOffset();
+
+ int width = destImage.getWidth();
+ int height = destImage.getHeight();
+ char pixelSpec = entry.getKey().getPixelSpec();
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
- double value = expr.eval(pe, x, y);
- if (value < 0.0)
- value = 0.0;
- else if (value > 255.0)
- value = 255.0;
- buffer.setElem(y * width * 3 + x * 3 + offset, (int)(value + 0.49));
+ double value = expr.eval(srcPE, x, y);
+
+ destPE.setValue(x, y, pixelSpec, value);
}
}
}
- return null;
+
+ return destImage;
+
} catch (Exception e) {
return null;
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java 2008-06-20 04:46:24 UTC (rev 35)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java 2008-06-20 05:38:41 UTC (rev 36)
@@ -22,6 +22,7 @@
import javax.swing.AbstractAction;
+import com.mebigfatguy.pixelle.FrameMgr;
import com.mebigfatguy.pixelle.PixelleBundle;
import com.mebigfatguy.pixelle.PixelleExpressionDialog;
import com.mebigfatguy.pixelle.PixelleFrame;
@@ -46,7 +47,10 @@
if (d.isOK()) {
PixelleTransformer transformer = new PixelleTransformer(frame.getImage(), d.getAlgorithms());
PixelleImage dstImage = transformer.transform();
- frame.repaint();
+ if (dstImage != null) {
+ PixelleFrame f = new PixelleFrame(dstImage);
+ f.setVisible(true);
+ }
}
}
}
\ No newline at end of file
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteABGR.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteABGR.java 2008-06-20 04:46:24 UTC (rev 35)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteABGR.java 2008-06-20 05:38:41 UTC (rev 36)
@@ -46,4 +46,34 @@
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':
+ break;
+ }
+ }
+
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteBGR.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteBGR.java 2008-06-20 04:46:24 UTC (rev 35)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteBGR.java 2008-06-20 05:38:41 UTC (rev 36)
@@ -44,7 +44,7 @@
@Override
public double getTransparencyValue(int x, int y) {
- return 0;
+ return 255.0;
}
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalByteGray.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalByteGray.java 2008-06-20 04:46:24 UTC (rev 35)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalByteGray.java 2008-06-20 05:38:41 UTC (rev 36)
@@ -44,7 +44,7 @@
@Override
public double getTransparencyValue(int x, int y) {
- return 0.0;
+ return 255.0;
}
private double getValue(int x, int y) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-06-20 04:46:15
|
Revision: 35
http://pixelle.svn.sourceforge.net/pixelle/?rev=35&view=rev
Author: dbrosius
Date: 2008-06-19 21:46:24 -0700 (Thu, 19 Jun 2008)
Log Message:
-----------
a pixel evaluator for grayscale images
Added Paths:
-----------
trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalByteGray.java
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalByteGray.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalByteGray.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalByteGray.java 2008-06-20 04:46:24 UTC (rev 35)
@@ -0,0 +1,54 @@
+/*
+ * 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.PixelleEval;
+import com.mebigfatguy.pixelle.PixelleImage;
+
+public class PixelleEvalByteGray extends PixelleEval {
+
+ public PixelleEvalByteGray(PixelleImage srcImage) {
+ super(srcImage);
+ }
+
+ @Override
+ public double getRedValue(int x, int y) {
+ return getValue(x, y);
+ }
+
+ @Override
+ public double getGreenValue(int x, int y) {
+ return getValue(x, y);
+ }
+
+ @Override
+ public double getBlueValue(int x, int y) {
+ return getValue(x, y);
+ }
+
+ @Override
+ public double getTransparencyValue(int x, int y) {
+ return 0.0;
+ }
+
+ private double getValue(int x, int y) {
+ return (double)buffer.getElem(y * width + x);
+ }
+
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalByteGray.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-06-20 04:38:36
|
Revision: 34
http://pixelle.svn.sourceforge.net/pixelle/?rev=34&view=rev
Author: dbrosius
Date: 2008-06-19 21:38:44 -0700 (Thu, 19 Jun 2008)
Log Message:
-----------
add bmp
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OpenFileAction.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OpenFileAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OpenFileAction.java 2008-06-20 04:35:23 UTC (rev 33)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OpenFileAction.java 2008-06-20 04:38:44 UTC (rev 34)
@@ -49,7 +49,7 @@
return true;
String path = f.getPath();
- return (path.endsWith(".gif") || path.endsWith(".jpg") || path.endsWith(".png"));
+ return (path.endsWith(".gif") || path.endsWith(".jpg") || path.endsWith(".png") || path.endsWith(".bmp"));
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-06-20 04:35:15
|
Revision: 33
http://pixelle.svn.sourceforge.net/pixelle/?rev=33&view=rev
Author: dbrosius
Date: 2008-06-19 21:35:23 -0700 (Thu, 19 Jun 2008)
Log Message:
-----------
an evaluator for transparent ABGR images
Added Paths:
-----------
trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteABGR.java
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteABGR.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteABGR.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteABGR.java 2008-06-20 04:35:23 UTC (rev 33)
@@ -0,0 +1,49 @@
+/*
+ * 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.PixelleEval;
+import com.mebigfatguy.pixelle.PixelleImage;
+
+public class PixelleEval3ByteABGR extends PixelleEval {
+
+ public PixelleEval3ByteABGR(PixelleImage srcImage) {
+ super(srcImage);
+ }
+
+ @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);
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteABGR.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-06-20 04:34:16
|
Revision: 32
http://pixelle.svn.sourceforge.net/pixelle/?rev=32&view=rev
Author: dbrosius
Date: 2008-06-19 21:34:22 -0700 (Thu, 19 Jun 2008)
Log Message:
-----------
add copyright
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteBGR.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteBGR.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteBGR.java 2008-06-20 04:30:38 UTC (rev 31)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteBGR.java 2008-06-20 04:34:22 UTC (rev 32)
@@ -1,3 +1,21 @@
+/*
+ * 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.PixelleEval;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-06-20 04:30:29
|
Revision: 31
http://pixelle.svn.sourceforge.net/pixelle/?rev=31&view=rev
Author: dbrosius
Date: 2008-06-19 21:30:38 -0700 (Thu, 19 Jun 2008)
Log Message:
-----------
Move towards a Pixel Eval factory for different types of images
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleImage.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
Added Paths:
-----------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java
trunk/pixelle/src/com/mebigfatguy/pixelle/eval/
trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteBGR.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java 2008-06-20 03:55:36 UTC (rev 30)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java 2008-06-20 04:30:38 UTC (rev 31)
@@ -18,53 +18,54 @@
*/
package com.mebigfatguy.pixelle;
-import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
-public class PixelleEval {
+public abstract class PixelleEval {
- private DataBuffer buffer;
- private int width;
- private int height;
+ protected PixelleImage srcImage;
+ protected DataBuffer buffer;
+ protected int width;
+ protected int height;
public PixelleEval(PixelleImage image) {
+ srcImage = image;
buffer = image.getBuffer();
width = image.getWidth();
height = image.getHeight();
}
+ public abstract double getRedValue(int x, int y);
+ public abstract double getGreenValue(int x, int y);
+ public abstract double getBlueValue(int x, int y);
+ public abstract double getTransparencyValue(int x, int y);
+
public double getValue(int x, int y, char pixelSpec) {
+
+ /* in the future, allow customization of out of bounds indices */
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;
+ return getRedValue(x, y);
case 'g':
- offset = 1;
- break;
+ return getGreenValue(x, y);
case 'b':
- offset = 2;
- break;
+ return getBlueValue(x, y);
case 't':
- offset = 3;
- break;
+ return getTransparencyValue(x, y);
case 's':
- return 0.0;
+ return getSelectionValue(x, y);
default:
return 0.0;
}
-
- return (double)buffer.getElem(y * width * 3 + x * 3 + offset);
}
public int getWidth() {
@@ -74,4 +75,8 @@
public int getHeight() {
return height;
}
+
+ private double getSelectionValue(int x, int y) {
+ return 0.0;
+ }
}
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java 2008-06-20 04:30:38 UTC (rev 31)
@@ -0,0 +1,57 @@
+/*
+ * 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 com.mebigfatguy.pixelle.eval.PixelleEval3ByteBGR;
+
+public class PixelleEvalFactory {
+
+ private PixelleEvalFactory() {
+ }
+
+ public static PixelleEval create(PixelleImage image) throws IllegalArgumentException {
+
+ switch (image.getType()) {
+ case BufferedImage.TYPE_3BYTE_BGR:
+ return new PixelleEval3ByteBGR(image);
+
+ case BufferedImage.TYPE_4BYTE_ABGR:
+ break;
+
+ case BufferedImage.TYPE_BYTE_BINARY:
+ break;
+
+ case BufferedImage.TYPE_BYTE_GRAY:
+ break;
+
+ case BufferedImage.TYPE_INT_ARGB:
+ break;
+
+ case BufferedImage.TYPE_INT_BGR:
+ break;
+
+ case BufferedImage.TYPE_INT_RGB:
+ break;
+ }
+
+ throw new IllegalArgumentException("Unknown image type: " + image.getType());
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleImage.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleImage.java 2008-06-20 03:55:36 UTC (rev 30)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleImage.java 2008-06-20 04:30:38 UTC (rev 31)
@@ -23,6 +23,7 @@
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.awt.image.IndexColorModel;
+import java.awt.image.SampleModel;
public class PixelleImage {
@@ -37,6 +38,10 @@
selection = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_BYTE_BINARY, bw);
}
+ public int getType() {
+ return image.getType();
+ }
+
public int getWidth() {
return image.getWidth();
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-06-20 03:55:36 UTC (rev 30)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-06-20 04:30:38 UTC (rev 31)
@@ -44,7 +44,7 @@
public PixelleImage transform() {
try {
- PixelleEval pe = new PixelleEval(srcImage);
+ PixelleEval pe = PixelleEvalFactory.create(srcImage);
PixelleClassLoader pcl = AccessController.doPrivileged(new PrivilegedAction<PixelleClassLoader>() {
public PixelleClassLoader run() {
return new PixelleClassLoader(Thread.currentThread().getContextClassLoader());
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteBGR.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteBGR.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteBGR.java 2008-06-20 04:30:38 UTC (rev 31)
@@ -0,0 +1,32 @@
+package com.mebigfatguy.pixelle.eval;
+
+import com.mebigfatguy.pixelle.PixelleEval;
+import com.mebigfatguy.pixelle.PixelleImage;
+
+public class PixelleEval3ByteBGR extends PixelleEval {
+
+ public PixelleEval3ByteBGR(PixelleImage srcImage) {
+ super(srcImage);
+ }
+
+ @Override
+ public double getBlueValue(int x, int y) {
+ return (double)buffer.getElem(y * width * 3 + x * 3);
+ }
+
+ @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 + 2);
+ }
+
+ @Override
+ public double getTransparencyValue(int x, int y) {
+ return 0;
+ }
+
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval3ByteBGR.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-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.
|
|
From: <dbr...@us...> - 2008-06-20 02:59:39
|
Revision: 29
http://pixelle.svn.sourceforge.net/pixelle/?rev=29&view=rev
Author: dbrosius
Date: 2008-06-19 19:59:41 -0700 (Thu, 19 Jun 2008)
Log Message:
-----------
fix jnlp reference
Modified Paths:
--------------
trunk/pixelle/htdocs/index.html
Modified: trunk/pixelle/htdocs/index.html
===================================================================
--- trunk/pixelle/htdocs/index.html 2008-06-20 02:53:12 UTC (rev 28)
+++ trunk/pixelle/htdocs/index.html 2008-06-20 02:59:41 UTC (rev 29)
@@ -13,7 +13,7 @@
<img src="vbar.gif" height="12"/>
<a href="javadoc/index.html">JavaDoc</a>
<img src="vbar.gif" height="12"/>
- <a href="jnlp/patchanim.jnlp">Web Start</a>
+ <a href="jnlp/pixelle.jnlp">Web Start</a>
<hr/>
<p>Thanks for your interest in Pixelle.</p>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-06-20 02:53:08
|
Revision: 28
http://pixelle.svn.sourceforge.net/pixelle/?rev=28&view=rev
Author: dbrosius
Date: 2008-06-19 19:53:12 -0700 (Thu, 19 Jun 2008)
Log Message:
-----------
use range of 0 - 255, rather than 0 - 1 as that is more understandable
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java 2008-06-19 05:52:07 UTC (rev 27)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java 2008-06-20 02:53:12 UTC (rev 28)
@@ -64,7 +64,7 @@
return 0.0;
}
- return buffer.getElemDouble(y * width * 3 + x * 3 + offset);
+ return (double)buffer.getElem(y * width * 3 + x * 3 + offset);
}
public int getWidth() {
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-06-19 05:52:07 UTC (rev 27)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-06-20 02:53:12 UTC (rev 28)
@@ -75,11 +75,11 @@
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
double value = expr.eval(pe, x, y);
- /*if (value < 0.0)
+ if (value < 0.0)
value = 0.0;
- else if (value > 1.0)
- value = 1.0;*/
- buffer.setElemDouble(y * width * 3 + x * 3 + offset, value);
+ else if (value > 255.0)
+ value = 255.0;
+ buffer.setElem(y * width * 3 + x * 3 + offset, (int)(value + 0.49));
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-06-19 05:51:59
|
Revision: 27
http://pixelle.svn.sourceforge.net/pixelle/?rev=27&view=rev
Author: dbrosius
Date: 2008-06-18 22:52:07 -0700 (Wed, 18 Jun 2008)
Log Message:
-----------
start using PixelleImage
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleImage.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java 2008-06-19 05:41:03 UTC (rev 26)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java 2008-06-19 05:52:07 UTC (rev 27)
@@ -27,10 +27,10 @@
private int width;
private int height;
- public PixelEval(BufferedImage bufferedImage) {
- buffer = bufferedImage.getRaster().getDataBuffer();
- width = bufferedImage.getWidth();
- height = bufferedImage.getHeight();
+ public PixelEval(PixelleImage image) {
+ buffer = image.getBuffer();
+ width = image.getWidth();
+ height = image.getHeight();
}
public double getValue(int x, int y, char pixelSpec) {
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java 2008-06-19 05:41:03 UTC (rev 26)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java 2008-06-19 05:52:07 UTC (rev 27)
@@ -81,7 +81,7 @@
ResourceBundle rb = ResourceBundle.getBundle("com.mebigfatguy.pixelle.pixelle");
JScrollPane scroll;
ImagePanel panel = new ImagePanel();
- BufferedImage image;
+ PixelleImage image;
public PixelleFrame() {
initComponents();
@@ -162,14 +162,14 @@
cp.setLayout(new BorderLayout());
}
- public BufferedImage getImage() {
+ public PixelleImage getImage() {
return image;
}
public void openFile(File f) {
setTitle(f.getName());
try {
- image = ImageIO.read(f);
+ image = new PixelleImage(ImageIO.read(f));
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Container cp = getContentPane();
@@ -228,7 +228,7 @@
public void paintComponent(Graphics g) {
super.paintComponent(g);
if (image != null) {
- g.drawImage(image, 0, 0, dim.width, dim.height, Color.WHITE, null);
+ image.draw(g, 0, 0, dim.width, dim.height);
}
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleImage.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleImage.java 2008-06-19 05:41:03 UTC (rev 26)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleImage.java 2008-06-19 05:52:07 UTC (rev 27)
@@ -18,7 +18,10 @@
*/
package com.mebigfatguy.pixelle;
+import java.awt.Color;
+import java.awt.Graphics;
import java.awt.image.BufferedImage;
+import java.awt.image.DataBuffer;
import java.awt.image.IndexColorModel;
public class PixelleImage {
@@ -33,12 +36,20 @@
IndexColorModel bw = new IndexColorModel(1, 2, color, color, color);
selection = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_BYTE_BINARY, bw);
}
-
- public BufferedImage getImage() {
- return image;
+
+ public int getWidth() {
+ return image.getWidth();
}
+
+ public int getHeight() {
+ return image.getHeight();
+ }
+
+ public DataBuffer getBuffer() {
+ return image.getRaster().getDataBuffer();
+ }
+ public void draw(Graphics g, int left, int top, int width, int height) {
+ g.drawImage(image, left, top, width, height, Color.WHITE, null);
+ }
- public BufferedImage getSelection() {
- return selection;
- }
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-06-19 05:41:03 UTC (rev 26)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-06-19 05:52:07 UTC (rev 27)
@@ -18,7 +18,6 @@
*/
package com.mebigfatguy.pixelle;
-import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -35,15 +34,15 @@
public class PixelleTransformer {
- private BufferedImage srcImage;
+ private PixelleImage srcImage;
private Map<PixelComponent, String> algorithms = null;
- public PixelleTransformer(BufferedImage image, Map<PixelComponent, String> algos) {
+ public PixelleTransformer(PixelleImage image, Map<PixelComponent, String> algos) {
srcImage = image;
algorithms = algos;
}
- public BufferedImage transform() {
+ public PixelleImage transform() {
try {
PixelEval pe = new PixelEval(srcImage);
PixelleClassLoader pcl = AccessController.doPrivileged(new PrivilegedAction<PixelleClassLoader>() {
@@ -69,17 +68,17 @@
Class<?> cl = pcl.loadClass(clsName);
PixelleExpr expr = (PixelleExpr)cl.newInstance();
- DataBuffer buffer = srcImage.getRaster().getDataBuffer();
+ DataBuffer buffer = srcImage.getBuffer();
int width = srcImage.getWidth();
int height = srcImage.getHeight();
int offset = entry.getKey().getComponentOffset();
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
double value = expr.eval(pe, x, y);
- if (value < 0.0)
+ /*if (value < 0.0)
value = 0.0;
else if (value > 1.0)
- value = 1.0;
+ value = 1.0;*/
buffer.setElemDouble(y * width * 3 + x * 3 + offset, value);
}
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java 2008-06-19 05:41:03 UTC (rev 26)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java 2008-06-19 05:52:07 UTC (rev 27)
@@ -19,13 +19,13 @@
package com.mebigfatguy.pixelle.actions;
import java.awt.event.ActionEvent;
-import java.awt.image.BufferedImage;
import javax.swing.AbstractAction;
import com.mebigfatguy.pixelle.PixelleBundle;
import com.mebigfatguy.pixelle.PixelleExpressionDialog;
import com.mebigfatguy.pixelle.PixelleFrame;
+import com.mebigfatguy.pixelle.PixelleImage;
import com.mebigfatguy.pixelle.PixelleTransformer;
public class TransformAction extends AbstractAction {
@@ -45,7 +45,7 @@
d.setVisible(true);
if (d.isOK()) {
PixelleTransformer transformer = new PixelleTransformer(frame.getImage(), d.getAlgorithms());
- BufferedImage dstImage = transformer.transform();
+ PixelleImage dstImage = transformer.transform();
frame.repaint();
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-06-19 05:40:57
|
Revision: 26
http://pixelle.svn.sourceforge.net/pixelle/?rev=26&view=rev
Author: dbrosius
Date: 2008-06-18 22:41:03 -0700 (Wed, 18 Jun 2008)
Log Message:
-----------
pixelle's representation of a selectable image
Added Paths:
-----------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleImage.java
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleImage.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleImage.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleImage.java 2008-06-19 05:41:03 UTC (rev 26)
@@ -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;
+
+import java.awt.image.BufferedImage;
+import java.awt.image.IndexColorModel;
+
+public class PixelleImage {
+
+ private BufferedImage image;
+ private BufferedImage selection;
+
+ public PixelleImage(BufferedImage img) {
+ image = img;
+
+ byte[] color = new byte[] {0, -1};
+ IndexColorModel bw = new IndexColorModel(1, 2, color, color, color);
+ selection = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_BYTE_BINARY, bw);
+ }
+
+ public BufferedImage getImage() {
+ return image;
+ }
+
+ public BufferedImage getSelection() {
+ return selection;
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleImage.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-06-18 04:35:04
|
Revision: 25
http://pixelle.svn.sourceforge.net/pixelle/?rev=25&view=rev
Author: dbrosius
Date: 2008-06-17 21:35:10 -0700 (Tue, 17 Jun 2008)
Log Message:
-----------
cap the pixel values to 0..1
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-06-18 04:12:01 UTC (rev 24)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-06-18 04:35:10 UTC (rev 25)
@@ -76,6 +76,10 @@
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
double value = expr.eval(pe, x, y);
+ if (value < 0.0)
+ value = 0.0;
+ else if (value > 1.0)
+ value = 1.0;
buffer.setElemDouble(y * width * 3 + x * 3 + offset, value);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-06-18 04:11:53
|
Revision: 24
http://pixelle.svn.sourceforge.net/pixelle/?rev=24&view=rev
Author: dbrosius
Date: 2008-06-17 21:12:01 -0700 (Tue, 17 Jun 2008)
Log Message:
-----------
start hooking up the color components
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelComponent.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelComponent.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelComponent.java 2008-06-18 04:00:36 UTC (rev 23)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelComponent.java 2008-06-18 04:12:01 UTC (rev 24)
@@ -20,19 +20,25 @@
public enum PixelComponent {
- RED('r'),
- GREEN('g'),
- BLUE('b'),
- TRANSPARENCY('t'),
- SELECTION('s');
+ RED('r', 0),
+ GREEN('g', 1),
+ BLUE('b', 2),
+ TRANSPARENCY('t', 3),
+ SELECTION('s', -1);
private char pixelSpec;
+ private int compOffset;
- PixelComponent(char c) {
+ PixelComponent(char c, int offset) {
pixelSpec = c;
+ compOffset = offset;
}
public char getPixelSpec() {
return pixelSpec;
}
+
+ public int getComponentOffset() {
+ return compOffset;
+ }
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java 2008-06-18 04:00:36 UTC (rev 23)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java 2008-06-18 04:12:01 UTC (rev 24)
@@ -42,7 +42,7 @@
int offset;
switch (pixelSpec) {
case 'r':
- offset = 2;
+ offset = 0;
break;
case 'g':
@@ -50,7 +50,7 @@
break;
case 'b':
- offset = 0;
+ offset = 2;
break;
case 't':
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-06-18 04:00:36 UTC (rev 23)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-06-18 04:12:01 UTC (rev 24)
@@ -72,10 +72,11 @@
DataBuffer buffer = srcImage.getRaster().getDataBuffer();
int width = srcImage.getWidth();
int height = srcImage.getHeight();
+ int offset = entry.getKey().getComponentOffset();
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
double value = expr.eval(pe, x, y);
- buffer.setElemDouble(y * width * 3 + x * 3 + 2, value);
+ buffer.setElemDouble(y * width * 3 + x * 3 + offset, value);
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-06-18 04:00:27
|
Revision: 23
http://pixelle.svn.sourceforge.net/pixelle/?rev=23&view=rev
Author: dbrosius
Date: 2008-06-17 21:00:36 -0700 (Tue, 17 Jun 2008)
Log Message:
-----------
allow for pngs
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OpenFileAction.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OpenFileAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OpenFileAction.java 2008-06-18 03:53:25 UTC (rev 22)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OpenFileAction.java 2008-06-18 04:00:36 UTC (rev 23)
@@ -49,7 +49,7 @@
return true;
String path = f.getPath();
- return (path.endsWith(".gif") || path.endsWith(".jpg"));
+ return (path.endsWith(".gif") || path.endsWith(".jpg") || path.endsWith(".png"));
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|