[Pixelle-commit] SF.net SVN: pixelle: [11] trunk/pixelle/src
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2008-06-18 02:36:33
|
Revision: 11
http://pixelle.svn.sourceforge.net/pixelle/?rev=11&view=rev
Author: dbrosius
Date: 2008-06-17 19:36:40 -0700 (Tue, 17 Jun 2008)
Log Message:
-----------
Initial source code commit
Added Paths:
-----------
trunk/pixelle/src/com/
trunk/pixelle/src/com/mebigfatguy/
trunk/pixelle/src/com/mebigfatguy/pixelle/
trunk/pixelle/src/com/mebigfatguy/pixelle/FrameMgr.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelComponent.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java
trunk/pixelle/src/com/mebigfatguy/pixelle/Pixelle.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleClassLoader.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpr.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpressionDialog.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/CloseFileAction.java
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/NewFileAction.java
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OpenFileAction.java
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/PageSetupAction.java
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/PrintAction.java
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/QuitAction.java
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/SaveFileAction.java
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/SaveFileAsAction.java
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/ZoomAction.java
trunk/pixelle/src/com/mebigfatguy/pixelle/pixelle.properties
trunk/pixelle/src/com/mebigfatguy/pixelle/utils/
trunk/pixelle/src/com/mebigfatguy/pixelle/utils/GuiUtils.java
trunk/pixelle/src/com/mebigfatguy/pixelle/utils/ZoomLevel.java
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/FrameMgr.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/FrameMgr.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/FrameMgr.java 2008-06-18 02:36:40 UTC (rev 11)
@@ -0,0 +1,48 @@
+/*
+ * 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.util.HashSet;
+import java.util.Set;
+
+import javax.swing.JFrame;
+
+public class FrameMgr {
+
+ private static FrameMgr mgr = new FrameMgr();
+ public Set<JFrame> frames = new HashSet<JFrame>();
+
+ private FrameMgr() {}
+
+ public static FrameMgr getInstance() {
+ return mgr;
+ }
+
+ public void add(JFrame frame) {
+ frames.add(frame);
+ }
+
+ public void remove(JFrame frame) {
+ frames.remove(frame);
+ }
+
+ public Set<JFrame> getFrames() {
+ return new HashSet<JFrame>(frames);
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/FrameMgr.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelComponent.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelComponent.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelComponent.java 2008-06-18 02:36:40 UTC (rev 11)
@@ -0,0 +1,38 @@
+/*
+ * 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'),
+ GREEN('g'),
+ BLUE('b'),
+ TRANSPARENCY('t'),
+ SELECTION('s');
+
+ private char pixelSpec;
+
+ PixelComponent(char c) {
+ pixelSpec = c;
+ }
+
+ public char getPixelSpec() {
+ return pixelSpec;
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelComponent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java 2008-06-18 02:36:40 UTC (rev 11)
@@ -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 PixelEval {
+
+ private DataBuffer buffer;
+ private int width;
+ private int height;
+
+ public PixelEval(BufferedImage bufferedImage) {
+ buffer = bufferedImage.getRaster().getDataBuffer();
+ width = bufferedImage.getWidth();
+ height = bufferedImage.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 = 2;
+ break;
+
+ case 'g':
+ offset = 1;
+ break;
+
+ case 'b':
+ offset = 0;
+ break;
+
+ case 't':
+ offset = 3;
+ break;
+
+ case 's':
+ return 0.0;
+
+ default:
+ return 0.0;
+ }
+
+ return buffer.getElemDouble(y * width * 3 + x * 3 + offset);
+ }
+
+ public int getWidth() {
+ return width;
+ }
+
+ public int getHeight() {
+ return height;
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/Pixelle.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/Pixelle.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/Pixelle.java 2008-06-18 02:36:40 UTC (rev 11)
@@ -0,0 +1,33 @@
+/*
+ * 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.Rectangle;
+
+import com.mebigfatguy.pixelle.utils.GuiUtils;
+
+public class Pixelle {
+
+ public static void main(String[] args) {
+ PixelleFrame pf = new PixelleFrame();
+ Rectangle bounds = GuiUtils.getScreenBounds();
+ pf.setBounds(bounds);
+ pf.setVisible(true);
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/Pixelle.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2008-06-18 02:36:40 UTC (rev 11)
@@ -0,0 +1,68 @@
+/*
+ * 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.util.ResourceBundle;
+
+public class PixelleBundle {
+
+ public static final String OK = "ok";
+ public static final String CANCEL = "cancel";
+ public static final String TITLE = "pixelle.title";
+ public static final String FILE_MENU = "menu.file.title";
+ public static final String NEW_ITEM = "menu.file.new";
+ public static final String OPEN_ITEM = "menu.file.open";
+ public static final String CLOSE_ITEM = "menu.file.close";
+ public static final String SAVE_ITEM = "menu.file.save";
+ public static final String SAVEAS_ITEM = "menu.file.saveas";
+ public static final String PAGESETUP_ITEM = "menu.file.pagesetup";
+ public static final String PRINT_ITEM = "menu.file.print";
+ public static final String QUIT_ITEM = "menu.file.quit";
+ public static final String VIEW_MENU = "menu.view.title";
+ public static final String ONEEIGHT_ITEM = "menu.view.one_eighth";
+ public static final String ONEFOURTH_ITEM = "menu.view.one_fourth";
+ public static final String ONEHALF_ITEM = "menu.view.one_half";
+ public static final String FULLSIZE_ITEM = "menu.view.full_size";
+ public static final String DOUBLE_ITEM = "menu.view.double";
+ public static final String FOURTIMES_ITEM = "menu.view.four_times";
+ 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 TRANSFORM_ITEM = "menu.transform.transform";
+ public static final String RED_FORMULA = "formula.red";
+ public static final String GREEN_FORMULA = "formula.green";
+ public static final String BLUE_FORMULA = "formula.blue";
+ public static final String TRANSPARENCY_FORMULA = "formula.transparency";
+ public static final String SELECTION_FORMULA = "formula.selection";
+ public static final String RED_LABEL = "label.red";
+ public static final String GREEN_LABEL = "label.green";
+ public static final String BLUE_LABEL = "label.blue";
+ public static final String TRANSPARENCY_LABEL = "label.transparency";
+ public static final String SELECTION_LABEL = "label.selection";
+
+ private static ResourceBundle rb = ResourceBundle.getBundle("com/mebigfatguy/pixelle/pixelle");
+
+ private PixelleBundle()
+ {
+ }
+
+ public static String getString(String key) {
+ return rb.getString(key);
+ }
+}
\ No newline at end of file
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleClassLoader.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleClassLoader.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleClassLoader.java 2008-06-18 02:36:40 UTC (rev 11)
@@ -0,0 +1,29 @@
+/*
+ * 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 class PixelleClassLoader extends ClassLoader {
+ public PixelleClassLoader(ClassLoader parent) {
+ super(parent);
+ }
+
+ public void addClass(String name, byte[] byteCode) {
+ defineClass(name, byteCode, 0, byteCode.length);
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleClassLoader.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpr.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpr.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpr.java 2008-06-18 02:36:40 UTC (rev 11)
@@ -0,0 +1,23 @@
+/*
+ * 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 interface PixelleExpr {
+ double eval(PixelEval e, int x, int y);
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpr.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpressionDialog.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpressionDialog.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpressionDialog.java 2008-06-18 02:36:40 UTC (rev 11)
@@ -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);
+ initComponents();
+ initListeners();
+ }
+
+ public boolean isOK() {
+ 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());
+ 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);
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpressionDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java 2008-06-18 02:36:40 UTC (rev 11)
@@ -0,0 +1,244 @@
+/*
+ * 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.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;
+
+import javax.imageio.ImageIO;
+import javax.swing.ButtonGroup;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.SwingUtilities;
+
+import com.mebigfatguy.pixelle.actions.CloseFileAction;
+import com.mebigfatguy.pixelle.actions.NewFileAction;
+import com.mebigfatguy.pixelle.actions.OpenFileAction;
+import com.mebigfatguy.pixelle.actions.PageSetupAction;
+import com.mebigfatguy.pixelle.actions.PrintAction;
+import com.mebigfatguy.pixelle.actions.QuitAction;
+import com.mebigfatguy.pixelle.actions.SaveFileAction;
+import com.mebigfatguy.pixelle.actions.SaveFileAsAction;
+import com.mebigfatguy.pixelle.actions.TransformAction;
+import com.mebigfatguy.pixelle.actions.ZoomAction;
+import com.mebigfatguy.pixelle.utils.ZoomLevel;
+
+public class PixelleFrame extends JFrame {
+ private static final long serialVersionUID = 6867461092986841877L;
+
+ JMenu fileMenu;
+ JMenuItem newItem;
+ JMenuItem openItem;
+ JMenuItem closeItem;
+ JMenuItem saveItem;
+ JMenuItem saveAsItem;
+ JMenuItem pageSetupItem;
+ JMenuItem printItem;
+ JMenuItem quitItem;
+
+ JMenu viewMenu;
+ JCheckBoxMenuItem oneEighthItem;
+ JCheckBoxMenuItem oneFourthItem;
+ JCheckBoxMenuItem oneHalfItem;
+ JCheckBoxMenuItem fullSizeItem;
+ JCheckBoxMenuItem twoTimesItem;
+ JCheckBoxMenuItem fourTimesItem;
+ JCheckBoxMenuItem eightTimesItem;
+ JCheckBoxMenuItem fitToWindowItem;
+
+ JMenu transformMenu;
+ JMenuItem transformItem;
+
+ ResourceBundle rb = ResourceBundle.getBundle("com.mebigfatguy.pixelle.pixelle");
+ JScrollPane scroll;
+ ImagePanel panel = new ImagePanel();
+ BufferedImage image;
+
+ public PixelleFrame() {
+ initComponents();
+ setTitle(rb.getString("pixelle.title"));
+ }
+
+ private void initComponents() {
+ JMenuBar mb = new JMenuBar();
+
+ fileMenu = new JMenu(PixelleBundle.getString(PixelleBundle.FILE_MENU));
+ newItem = new JMenuItem(new NewFileAction());
+ fileMenu.add(newItem);
+ openItem = new JMenuItem(new OpenFileAction(this));
+ fileMenu.add(openItem);
+ fileMenu.addSeparator();
+ closeItem = new JMenuItem(new CloseFileAction(this));
+ fileMenu.add(closeItem);
+ fileMenu.addSeparator();
+ saveItem = new JMenuItem(new SaveFileAction(this));
+ fileMenu.add(saveItem);
+ saveAsItem = new JMenuItem(new SaveFileAsAction(this));
+ fileMenu.add(saveAsItem);
+ fileMenu.addSeparator();
+ pageSetupItem = new JMenuItem(new PageSetupAction(this));
+ fileMenu.add(pageSetupItem);
+ printItem = new JMenuItem(new PrintAction(this));
+ fileMenu.add(printItem);
+ fileMenu.addSeparator();
+ quitItem = new JMenuItem(new QuitAction());
+ fileMenu.add(quitItem);
+
+ mb.add(fileMenu);
+
+ viewMenu = new JMenu(rb.getString(PixelleBundle.VIEW_MENU));
+ oneEighthItem = new JCheckBoxMenuItem(new ZoomAction(this, ZoomLevel.OneEighth));
+ viewMenu.add(oneEighthItem);
+ oneFourthItem = new JCheckBoxMenuItem(new ZoomAction(this, ZoomLevel.OneFourth));
+ viewMenu.add(oneFourthItem);
+ oneHalfItem = new JCheckBoxMenuItem(new ZoomAction(this, ZoomLevel.OneHalf));
+ viewMenu.add(oneHalfItem);
+ fullSizeItem = new JCheckBoxMenuItem(new ZoomAction(this, ZoomLevel.FullSize));
+ viewMenu.add(fullSizeItem);
+ twoTimesItem = new JCheckBoxMenuItem(new ZoomAction(this, ZoomLevel.Double));
+ viewMenu.add(twoTimesItem);
+ fourTimesItem = new JCheckBoxMenuItem(new ZoomAction(this, ZoomLevel.FourTimes));
+ viewMenu.add(fourTimesItem);
+ eightTimesItem = new JCheckBoxMenuItem(new ZoomAction(this, ZoomLevel.EightTimes));
+ viewMenu.add(eightTimesItem);
+ viewMenu.addSeparator();
+ fitToWindowItem = new JCheckBoxMenuItem(new ZoomAction(this, ZoomLevel.FitToWindow));
+ viewMenu.add(fitToWindowItem);
+
+ ButtonGroup bg = new ButtonGroup();
+ bg.add(oneEighthItem);
+ bg.add(oneFourthItem);
+ bg.add(oneHalfItem);
+ bg.add(fullSizeItem);
+ bg.add(twoTimesItem);
+ bg.add(fourTimesItem);
+ bg.add(eightTimesItem);
+ bg.add(fitToWindowItem);
+
+ fitToWindowItem.setSelected(true);
+
+ mb.add(viewMenu);
+
+ transformMenu = new JMenu(rb.getString(PixelleBundle.TRANSFORM_MENU));
+ transformItem = new JMenuItem(new TransformAction(this));
+ transformMenu.add(transformItem);
+
+ mb.add(transformMenu);
+
+ setJMenuBar(mb);
+
+ FrameMgr.getInstance().add(this);
+
+ Container cp = getContentPane();
+ cp.setLayout(new BorderLayout());
+ }
+
+ public BufferedImage getImage() {
+ return image;
+ }
+
+ public void openFile(File f) {
+ setTitle(f.getName());
+ try {
+ image = ImageIO.read(f);
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ Container cp = getContentPane();
+ cp.removeAll();
+ setZoom(ZoomLevel.FitToWindow);
+ scroll = new JScrollPane(panel);
+ cp.add(scroll, BorderLayout.CENTER);
+ invalidate();
+ validate();
+ repaint();
+ }
+ });
+
+ } catch (IOException e) {
+ JOptionPane.showMessageDialog(this, e.getMessage());
+ }
+ }
+
+ public void setZoom(final ZoomLevel zoom) {
+ if (image == null)
+ return;
+
+ double zoomFactor = zoom.getZoom();
+ final int h = (int)(image.getHeight() * zoomFactor);
+ final int w = (int)(image.getWidth() * zoomFactor);
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ int width = w;
+ int height = h;
+ if ((h == 0) || (w == 0)) {
+ Container cp = PixelleFrame.this.getContentPane();
+ height = cp.getHeight();
+ width = cp.getWidth();
+ int imageH = image.getHeight();
+ int imageW = image.getWidth();
+ double divH = (double)height / (double)imageH;
+ double divW = (double)width / (double)imageW;
+ double div = Math.min(divH, divW);
+ height = (int)(div * imageH);
+ width = (int)(div * imageW);
+ }
+ panel.setSize(width, height);
+ panel.setImageDim(new Dimension(width, height));
+ invalidate();
+ validate();
+ repaint();
+ }
+ });
+ }
+
+ public class ImagePanel extends JPanel {
+ private static final long serialVersionUID = -1572146409734928935L;
+ Dimension dim = new Dimension(10, 10);
+
+ @Override
+ public void paintComponent(Graphics g) {
+ super.paintComponent(g);
+ if (image != null) {
+ g.drawImage(image, 0, 0, dim.width, dim.height, Color.WHITE, null);
+ }
+ }
+
+ public void setImageDim(Dimension d) {
+ dim = d;
+ }
+
+ @Override
+ public Dimension getPreferredSize() {
+ return getSize();
+ }
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-06-18 02:36:40 UTC (rev 11)
@@ -0,0 +1,112 @@
+/*
+ * 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;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Map;
+
+import org.antlr.runtime.ANTLRStringStream;
+import org.antlr.runtime.CharStream;
+import org.antlr.runtime.CommonTokenStream;
+
+import com.mebigfatguy.pixelle.antlr.PixelleLexer;
+import com.mebigfatguy.pixelle.antlr.PixelleParser;
+
+public class PixelleTransformer {
+
+ private BufferedImage srcImage;
+ private Map<PixelComponent, String> algorithms = null;
+
+ public PixelleTransformer(BufferedImage image, Map<PixelComponent, String> algos) {
+ srcImage = image;
+ algorithms = algos;
+ }
+
+ public BufferedImage transform() {
+ try {
+ PixelEval pe = new PixelEval(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()) {
+ CharStream cs = new ANTLRStringStream(entry.getValue());
+ PixelleLexer pl = new PixelleLexer(cs);
+ CommonTokenStream tokens = new CommonTokenStream();
+ tokens.setTokenSource(pl);
+
+ String clsName = "com.mebigfatguy.pixelle.asm.PixelleExpr" + entry.getKey().name();
+ PixelleParser pp = new PixelleParser(tokens, clsName);
+ pp.pixelle();
+
+ byte[] bytes = pp.getClassBytes();
+ dump(bytes, clsName + ".class");
+
+ pcl.addClass(clsName, bytes);
+ Class<?> cl = pcl.loadClass(clsName);
+ PixelleExpr expr = (PixelleExpr)cl.newInstance();
+
+ DataBuffer buffer = srcImage.getRaster().getDataBuffer();
+ int width = srcImage.getWidth();
+ int height = srcImage.getHeight();
+ 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);
+ }
+ }
+ }
+ return null;
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ /** for debugging */
+ private static void dump(byte[] byteCode, String name)
+ {
+ FileOutputStream fos = null;
+ try
+ {
+ fos = new FileOutputStream("c:\\temp\\" + name);
+ fos.write(byteCode);
+ fos.flush();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ try {
+ if (fos != null)
+ fos.close();
+ } catch (IOException ioe) {
+ }
+ }
+ }
+
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/CloseFileAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/CloseFileAction.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/CloseFileAction.java 2008-06-18 02:36:40 UTC (rev 11)
@@ -0,0 +1,43 @@
+/*
+ * 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.FrameMgr;
+import com.mebigfatguy.pixelle.PixelleBundle;
+import com.mebigfatguy.pixelle.PixelleFrame;
+
+public class CloseFileAction extends AbstractAction {
+
+ private static final long serialVersionUID = -6860345801345095089L;
+ PixelleFrame frame;
+
+ public CloseFileAction(PixelleFrame pf) {
+ super(PixelleBundle.getString(PixelleBundle.CLOSE_ITEM));
+ frame = pf;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ frame.dispose();
+ FrameMgr.getInstance().remove(frame);
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/CloseFileAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/NewFileAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/NewFileAction.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/NewFileAction.java 2008-06-18 02:36:40 UTC (rev 11)
@@ -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.actions;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+import com.mebigfatguy.pixelle.FrameMgr;
+import com.mebigfatguy.pixelle.PixelleBundle;
+import com.mebigfatguy.pixelle.PixelleFrame;
+import com.mebigfatguy.pixelle.utils.GuiUtils;
+
+public class NewFileAction extends AbstractAction {
+
+ private static final long serialVersionUID = 7977411917585137527L;
+
+ public NewFileAction() {
+ super(PixelleBundle.getString(PixelleBundle.NEW_ITEM));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ PixelleFrame pf = new PixelleFrame();
+ pf.setBounds(GuiUtils.getScreenBounds());
+ pf.setVisible(true);
+ FrameMgr.getInstance().add(pf);
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/NewFileAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OpenFileAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OpenFileAction.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OpenFileAction.java 2008-06-18 02:36:40 UTC (rev 11)
@@ -0,0 +1,70 @@
+/*
+ * 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 java.io.File;
+
+import javax.swing.AbstractAction;
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileFilter;
+
+import com.mebigfatguy.pixelle.PixelleBundle;
+import com.mebigfatguy.pixelle.PixelleFrame;
+
+public class OpenFileAction extends AbstractAction {
+
+ private static final long serialVersionUID = -143429629947905056L;
+ PixelleFrame frame;
+ File lastDir = null;
+
+ public OpenFileAction(PixelleFrame pf) {
+ super(PixelleBundle.getString(PixelleBundle.OPEN_ITEM));
+ frame = pf;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ JFileChooser jf = new JFileChooser(lastDir);
+ jf.setFileFilter(new FileFilter() {
+
+ @Override
+ public boolean accept(File f) {
+ if (f.isDirectory())
+ return true;
+
+ String path = f.getPath();
+ return (path.endsWith(".gif") || path.endsWith(".jpg"));
+ }
+
+ @Override
+ public String getDescription() {
+ return "Graphic Files";
+ }
+ });
+
+ jf.setFileSelectionMode(JFileChooser.FILES_ONLY);
+ jf.showOpenDialog(frame);
+ File f = jf.getSelectedFile();
+ if (f != null) {
+ frame.openFile(f);
+ lastDir = f.getParentFile();
+ }
+
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/OpenFileAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/PageSetupAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/PageSetupAction.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/PageSetupAction.java 2008-06-18 02:36:40 UTC (rev 11)
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+public class PageSetupAction extends AbstractAction {
+
+ private static final long serialVersionUID = -3397949264743769800L;
+
+ public PageSetupAction(PixelleFrame pf) {
+ super(PixelleBundle.getString(PixelleBundle.PAGESETUP_ITEM));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/PageSetupAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/PrintAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/PrintAction.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/PrintAction.java 2008-06-18 02:36:40 UTC (rev 11)
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+public class PrintAction extends AbstractAction {
+
+ private static final long serialVersionUID = 5826553084556182790L;
+
+ public PrintAction(PixelleFrame pf) {
+ super(PixelleBundle.getString(PixelleBundle.PRINT_ITEM));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/PrintAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/QuitAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/QuitAction.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/QuitAction.java 2008-06-18 02:36:40 UTC (rev 11)
@@ -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 java.util.Set;
+
+import javax.swing.AbstractAction;
+import javax.swing.JFrame;
+
+import com.mebigfatguy.pixelle.FrameMgr;
+import com.mebigfatguy.pixelle.PixelleBundle;
+
+public class QuitAction extends AbstractAction {
+
+ private static final long serialVersionUID = -8604632433532502563L;
+
+ public QuitAction() {
+ super(PixelleBundle.getString(PixelleBundle.QUIT_ITEM));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ Set<JFrame> frames = FrameMgr.getInstance().getFrames();
+ for (JFrame f : frames) {
+ f.dispose();
+ FrameMgr.getInstance().remove(f);
+ }
+ System.exit(0);
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/QuitAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/SaveFileAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/SaveFileAction.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/SaveFileAction.java 2008-06-18 02:36:40 UTC (rev 11)
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+public class SaveFileAction extends AbstractAction {
+
+ private static final long serialVersionUID = 4019520448443204442L;
+
+ public SaveFileAction(PixelleFrame pf) {
+ super(PixelleBundle.getString(PixelleBundle.SAVE_ITEM));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/SaveFileAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/SaveFileAsAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/SaveFileAsAction.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/SaveFileAsAction.java 2008-06-18 02:36:40 UTC (rev 11)
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+public class SaveFileAsAction extends AbstractAction {
+
+ private static final long serialVersionUID = -5814929763886809475L;
+
+ public SaveFileAsAction(PixelleFrame pf) {
+ super(PixelleBundle.getString(PixelleBundle.SAVEAS_ITEM));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/SaveFileAsAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java 2008-06-18 02:36:40 UTC (rev 11)
@@ -0,0 +1,52 @@
+/*
+ * 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 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.PixelleTransformer;
+
+public class TransformAction extends AbstractAction {
+
+ private static final long serialVersionUID = 3609590839274864129L;
+ PixelleFrame frame;
+
+ public TransformAction(PixelleFrame pf) {
+ super(PixelleBundle.getString(PixelleBundle.TRANSFORM_ITEM));
+ frame = pf;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ PixelleExpressionDialog d = new PixelleExpressionDialog(frame);
+ d.setLocationRelativeTo(frame);
+ d.setModal(true);
+ d.setVisible(true);
+ if (d.isOK()) {
+ PixelleTransformer transformer = new PixelleTransformer(frame.getImage(), d.getAlgorithms());
+ BufferedImage dstImage = transformer.transform();
+ frame.repaint();
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/ZoomAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/ZoomAction.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/ZoomAction.java 2008-06-18 02:36:40 UTC (rev 11)
@@ -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.actions;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+import com.mebigfatguy.pixelle.PixelleBundle;
+import com.mebigfatguy.pixelle.PixelleFrame;
+import com.mebigfatguy.pixelle.utils.ZoomLevel;
+
+public class ZoomAction extends AbstractAction {
+
+ private static final long serialVersionUID = -4154911527858500196L;
+ PixelleFrame frame;
+ ZoomLevel zoom;
+
+ public ZoomAction(PixelleFrame pf, ZoomLevel level) {
+ super(PixelleBundle.getString(level.getKey()));
+ frame = pf;
+ zoom = level;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ frame.setZoom(zoom);
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/ZoomAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/pixelle.properties
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/pixelle.properties (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/pixelle.properties 2008-06-18 02:36:40 UTC (rev 11)
@@ -0,0 +1,58 @@
+/*
+ * 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
+ */
+
+ok = OK
+cancel = CANCEL
+
+pixelle.title = Pixelle
+
+menu.file.title = File
+menu.file.new = New
+menu.file.open = Open
+menu.file.close = Close
+menu.file.save = Save
+menu.file.saveas = Save As
+menu.file.pagesetup = Page Setup
+menu.file.print = Print
+menu.file.quit = Quit
+
+menu.view.title = View
+menu.view.one_eighth = 12.5%
+menu.view.one_fourth = 25%
+menu.view.one_half = 50%
+menu.view.full_size = 100%
+menu.view.double = 200%
+menu.view.four_times = 400%
+menu.view.eight_times = 800%
+menu.view.fit_to_window = Fit to Window
+
+menu.transform.title = Transform
+menu.transform.transform = Transform
+
+formula.red = p[x,y].r
+formula.green = p[x,y].g
+formula.blue = p[x,y].b
+formula.transparency = p[x,y].t
+formula.selection = p[x,y].s
+
+label.red = (Red)
+label.green = (Green)
+label.blue = (Blue)
+label.transparency = (Transparency)
+label.selection = (Selection)
\ No newline at end of file
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/pixelle.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/utils/GuiUtils.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/utils/GuiUtils.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/utils/GuiUtils.java 2008-06-18 02:36:40 UTC (rev 11)
@@ -0,0 +1,76 @@
+/*
+ * 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.utils;
+
+import java.awt.Dimension;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.Rectangle;
+
+import javax.swing.JComponent;
+
+public class GuiUtils {
+ public enum Sizing {Width, Height, Both};
+
+ ...
[truncated message content] |