pixelle-commit Mailing List for pixelle (Page 5)
Brought to you by:
dbrosius
You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(129) |
Jul
(39) |
Aug
|
Sep
|
Oct
|
Nov
(63) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(1) |
Feb
(24) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(41) |
Aug
(1) |
Sep
(7) |
Oct
|
Nov
|
Dec
(5) |
| 2010 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2012 |
Jan
(2) |
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <dbr...@us...> - 2008-11-22 06:01:08
|
Revision: 222
http://pixelle.svn.sourceforge.net/pixelle/?rev=222&view=rev
Author: dbrosius
Date: 2008-11-22 06:00:59 +0000 (Sat, 22 Nov 2008)
Log Message:
-----------
add indexed cm handling
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java 2008-11-22 06:00:16 UTC (rev 221)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEvalFactory.java 2008-11-22 06:00:59 UTC (rev 222)
@@ -24,6 +24,7 @@
import com.mebigfatguy.pixelle.eval.PixelleEval4ByteABGR;
import com.mebigfatguy.pixelle.eval.PixelleEvalByteGray;
import com.mebigfatguy.pixelle.eval.PixelleEvalCustom;
+import com.mebigfatguy.pixelle.eval.PixelleEvalIndexed;
import com.mebigfatguy.pixelle.eval.PixelleEvalIntARGB;
import com.mebigfatguy.pixelle.eval.PixelleEvalIntBGR;
import com.mebigfatguy.pixelle.eval.PixelleEvalIntRGB;
@@ -76,7 +77,7 @@
throw new IllegalArgumentException("Image type: " + image.getType() + " (Byte Binary) is not supported yet.");
case BufferedImage.TYPE_BYTE_INDEXED:
- throw new IllegalArgumentException("Image type: " + image.getType() + " (Byte Indexed) is not supported yet.");
+ return new PixelleEvalIndexed(image, ioobOption, coobOption);
case BufferedImage.TYPE_BYTE_GRAY:
return new PixelleEvalByteGray(image, ioobOption, coobOption);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-22 06:00:20
|
Revision: 221
http://pixelle.svn.sourceforge.net/pixelle/?rev=221&view=rev
Author: dbrosius
Date: 2008-11-22 06:00:16 +0000 (Sat, 22 Nov 2008)
Log Message:
-----------
an evaluator for indexed bitmaps
Added Paths:
-----------
trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalIndexed.java
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalIndexed.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalIndexed.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalIndexed.java 2008-11-22 06:00:16 UTC (rev 221)
@@ -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.eval;
+
+import java.awt.image.ColorModel;
+
+import com.mebigfatguy.pixelle.ColorOutOfBoundsOption;
+import com.mebigfatguy.pixelle.IndexOutOfBoundsOption;
+import com.mebigfatguy.pixelle.PixelleEval;
+import com.mebigfatguy.pixelle.PixelleImage;
+
+public class PixelleEvalIndexed extends PixelleEval {
+ static final int[] bitsPerPixelMask = { 0, 1, 3, 0, 15, 0, 0, 0, 255 };
+
+ ColorModel model;
+ int bitsPerPixel;
+ int pixelsPerByte;
+
+ public PixelleEvalIndexed(PixelleImage srcImage, IndexOutOfBoundsOption iOption, ColorOutOfBoundsOption cOption) {
+ super(srcImage, iOption, cOption);
+ model = srcImage.getSaveImage().getColorModel();
+ bitsPerPixel = model.getPixelSize();
+ pixelsPerByte = 8 / bitsPerPixel;
+ }
+
+ @Override
+ public double getTransparencyValue(int x, int y) {
+ int px = getPixelIndex(x, y);
+
+ return model.getAlpha(px);
+ }
+
+ @Override
+ public double getBlueValue(int x, int y) {
+ int px = getPixelIndex(x, y);
+
+ return model.getBlue(px);
+ }
+
+ @Override
+ public double getGreenValue(int x, int y) {
+ int px = getPixelIndex(x, y);
+
+ return model.getGreen(px);
+ }
+
+ @Override
+ public double getRedValue(int x, int y) {
+ int px = getPixelIndex(x, y);
+
+ return model.getRed(px);
+ }
+
+ private int getPixelIndex(int x, int y) {
+ int px = buffer.getElem((y * width / pixelsPerByte) + (x / pixelsPerByte));
+ int shift = x & (pixelsPerByte-1);
+ px = (px >> shift) & bitsPerPixelMask[bitsPerPixel];
+ return px;
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalIndexed.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-22 04:01:18
|
Revision: 220
http://pixelle.svn.sourceforge.net/pixelle/?rev=220&view=rev
Author: dbrosius
Date: 2008-11-22 04:01:13 +0000 (Sat, 22 Nov 2008)
Log Message:
-----------
more docs
Modified Paths:
--------------
trunk/pixelle/htdocs/index.html
Modified: trunk/pixelle/htdocs/index.html
===================================================================
--- trunk/pixelle/htdocs/index.html 2008-11-22 03:55:26 UTC (rev 219)
+++ trunk/pixelle/htdocs/index.html 2008-11-22 04:01:13 UTC (rev 220)
@@ -119,7 +119,8 @@
<p>As of November 14, a pixel inspector window has been added, which helps determine input for the transformations</p>
- <p>As of November 21, transformations can be done to grayscale. Prototypical example is color separations.</p>
+ <p>As of November 21, transformations can be done to grayscale. Prototypical example is color separations. Also
+ The output size can be specified in the transform dialog</p>
<p>Still to be done is recognition of more image types, working with multiple
input sources, creating non ABGR images, more options handling such as fractional pixels,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-22 03:55:36
|
Revision: 219
http://pixelle.svn.sourceforge.net/pixelle/?rev=219&view=rev
Author: dbrosius
Date: 2008-11-22 03:55:26 +0000 (Sat, 22 Nov 2008)
Log Message:
-----------
respect output size from transform dialog
Modified Paths:
--------------
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
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java 2008-11-22 01:59:03 UTC (rev 218)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java 2008-11-22 03:55:26 UTC (rev 219)
@@ -103,7 +103,7 @@
boolean doNewWindow;
public PixelleFrame() throws PixelleTransformException {
- this(new PixelleTransformer(new PixelleImage(), PixelleTransformer.getSampleTransform(), ImageType.RGB).transform(), false);
+ this(new PixelleTransformer(new PixelleImage(), PixelleTransformer.getSampleTransform(), ImageType.RGB, new Point(400, 400)).transform(), false);
}
public PixelleFrame(PixelleImage srcImage) {
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-11-22 01:59:03 UTC (rev 218)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-11-22 03:55:26 UTC (rev 219)
@@ -18,6 +18,7 @@
*/
package com.mebigfatguy.pixelle;
+import java.awt.Point;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
@@ -44,16 +45,19 @@
private final PixelleImage srcImage;
private Map<PixelleComponent, String> algorithms = null;
private final ImageType outputImageType;
+ private final Point dimension;
/**
* constructions a transformer given a source bitmap and algorithms
* @param image the source image
* @param algos the algorithms for the color components
+ * @param newDimension TODO
*/
- public PixelleTransformer(PixelleImage image, Map<PixelleComponent, String> algos, ImageType imageType) {
+ public PixelleTransformer(PixelleImage image, Map<PixelleComponent, String> algos, ImageType imageType, Point newDimension) {
srcImage = image;
algorithms = algos;
outputImageType = imageType;
+ dimension = newDimension;
}
/**
@@ -85,15 +89,14 @@
String currentAlgorithm = "";
try {
- /** eventually allow for gui to set width/height */
PixelleImage destImage;
PixelleEval destPE;
if (outputImageType == ImageType.RGB) {
- destImage = new PixelleImage(new BufferedImage(srcImage.getWidth(), srcImage.getHeight(), BufferedImage.TYPE_4BYTE_ABGR));
+ destImage = new PixelleImage(new BufferedImage(dimension.x, dimension.y, BufferedImage.TYPE_4BYTE_ABGR));
destPE = new PixelleEval4ByteABGR(destImage, PixelleEvalFactory.getIndexOutOfBoundsOption(), PixelleEvalFactory.getColorOutOfBoundsOption());
} else {
- destImage = new PixelleImage(new BufferedImage(srcImage.getWidth(), srcImage.getHeight(), BufferedImage.TYPE_BYTE_GRAY));
+ destImage = new PixelleImage(new BufferedImage(dimension.x, dimension.y, BufferedImage.TYPE_BYTE_GRAY));
destPE = new PixelleEvalByteGray(destImage, PixelleEvalFactory.getIndexOutOfBoundsOption(), PixelleEvalFactory.getColorOutOfBoundsOption());
}
PixelleEval srcPE = PixelleEvalFactory.create(srcImage);
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java 2008-11-22 01:59:03 UTC (rev 218)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java 2008-11-22 03:55:26 UTC (rev 219)
@@ -52,7 +52,7 @@
d.setVisible(true);
if (d.isOK()) {
ImageType imageType = d.getImageType();
- PixelleTransformer transformer = new PixelleTransformer(frame.getImage(), d.getAlgorithms(imageType), imageType);
+ PixelleTransformer transformer = new PixelleTransformer(frame.getImage(), d.getAlgorithms(imageType), imageType, d.getOutputSize());
PixelleImage dstImage = transformer.transform();
if (dstImage != null) {
if (frame.createNewWindow()) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-22 01:59:13
|
Revision: 218
http://pixelle.svn.sourceforge.net/pixelle/?rev=218&view=rev
Author: dbrosius
Date: 2008-11-22 01:59:03 +0000 (Sat, 22 Nov 2008)
Log Message:
-----------
put in output sizing controls in the transform dialog (not hooked up yet)
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2008-11-22 01:56:50 UTC (rev 217)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2008-11-22 01:59:03 UTC (rev 218)
@@ -89,6 +89,8 @@
public static final String INSPECTOR_TOOLTIP = "tooltip.inspector";
public static final String RGB = "label.rgb";
public static final String GRAYSCALE = "label.grayscale";
+ public static final String WIDTH ="label.width";
+ public static final String HEIGHT = "label.height";
private static ResourceBundle rb = ResourceBundle.getBundle("com/mebigfatguy/pixelle/resources/pixelle");
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-11-22 01:56:50 UTC (rev 217)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-11-22 01:59:03 UTC (rev 218)
@@ -21,6 +21,7 @@
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.GridLayout;
+import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@@ -41,6 +42,7 @@
import javax.swing.JPopupMenu;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
+import javax.swing.border.EtchedBorder;
import com.mebigfatguy.pixelle.AlgorithmArchiver;
import com.mebigfatguy.pixelle.ImageType;
@@ -48,6 +50,8 @@
import com.mebigfatguy.pixelle.PixelleComponent;
import com.mebigfatguy.pixelle.PixelleFrame;
import com.mebigfatguy.pixelle.utils.GuiUtils;
+import com.mebigfatguy.pixelle.utils.IntegerDocument;
+import com.mebigfatguy.pixelle.utils.GuiUtils.Sizing;
public class PixelleExpressionDialog extends JDialog {
@@ -105,6 +109,8 @@
JTextField selectedGSAlgorithm;
JPopupMenu savedGSAlgorithms;
JTabbedPane tabbedPane;
+ JTextField widthField;
+ JTextField heightField;
JButton save;
JButton delete;
@@ -133,6 +139,10 @@
return algorithms;
}
+ public Point getOutputSize() {
+ return new Point(Integer.parseInt(widthField.getText()), Integer.parseInt(heightField.getText()));
+ }
+
private void initComponents() {
Container cp = getContentPane();
@@ -145,33 +155,76 @@
cp.setLayout(new BorderLayout(4, 4));
+ JPanel centerPanel = new JPanel();
+ centerPanel.setLayout(new BorderLayout(4, 4));
+ cp.add(centerPanel, BorderLayout.CENTER);
+
tabbedPane = new JTabbedPane();
- cp.add(tabbedPane, BorderLayout.CENTER);
+ centerPanel.add(tabbedPane, BorderLayout.CENTER);
tabbedPane.add(PixelleBundle.getString(PixelleBundle.RGB), buildRGBPane());
tabbedPane.add(PixelleBundle.getString(PixelleBundle.GRAYSCALE), buildGrayscalePanel());
- {
- JPanel ctlPanel = new JPanel();
- ctlPanel.setLayout(new BoxLayout(ctlPanel, BoxLayout.X_AXIS));
- ctlPanel.add(Box.createHorizontalStrut(10));
- ctlPanel.add(reset);
- ctlPanel.add(Box.createHorizontalStrut(10));
- ctlPanel.add(save);
- ctlPanel.add(Box.createHorizontalStrut(10));
- ctlPanel.add(delete);
- ctlPanel.add(Box.createHorizontalGlue());
- ctlPanel.add(ok);
- ctlPanel.add(Box.createHorizontalStrut(10));
- ctlPanel.add(cancel);
- ctlPanel.add(Box.createHorizontalStrut(10));
- ctlPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
- cp.add(ctlPanel, BorderLayout.SOUTH);
- }
+ centerPanel.add(buildSizingPanel(), BorderLayout.SOUTH);
+ cp.add(buildCtrlPanel(), BorderLayout.SOUTH);
+
pack();
}
+ private JPanel buildSizingPanel() {
+ JPanel panel = new JPanel();
+ panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
+
+ JLabel wl = new JLabel(PixelleBundle.getString(PixelleBundle.WIDTH));
+ JLabel hl = new JLabel(PixelleBundle.getString(PixelleBundle.HEIGHT));
+ GuiUtils.sizeUniformly(Sizing.Both, wl, hl);
+
+ widthField = new JTextField(new IntegerDocument(), "", 6);
+ heightField = new JTextField(new IntegerDocument(), "", 6);
+ GuiUtils.sizeUniformly(Sizing.Both, widthField, heightField);
+
+ wl.setLabelFor(widthField);
+ hl.setLabelFor(heightField);
+
+ widthField.setText(String.valueOf(frame.getImage().getWidth()));
+ heightField.setText(String.valueOf(frame.getImage().getHeight()));
+
+ panel.add(Box.createHorizontalStrut(20));
+ panel.add(wl);
+ panel.add(Box.createHorizontalStrut(10));
+ panel.add(widthField);
+ panel.add(Box.createHorizontalStrut(20));
+ panel.add(hl);
+ panel.add(Box.createHorizontalStrut(10));
+ panel.add(heightField);
+ panel.add(Box.createHorizontalGlue());
+
+ panel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED),
+ BorderFactory.createEmptyBorder(5, 2, 5, 2)));
+
+ return panel;
+ }
+
+ private JPanel buildCtrlPanel() {
+ JPanel ctlPanel = new JPanel();
+ ctlPanel.setLayout(new BoxLayout(ctlPanel, BoxLayout.X_AXIS));
+ ctlPanel.add(Box.createHorizontalStrut(10));
+ ctlPanel.add(reset);
+ ctlPanel.add(Box.createHorizontalStrut(10));
+ ctlPanel.add(save);
+ ctlPanel.add(Box.createHorizontalStrut(10));
+ ctlPanel.add(delete);
+ ctlPanel.add(Box.createHorizontalGlue());
+ ctlPanel.add(ok);
+ ctlPanel.add(Box.createHorizontalStrut(10));
+ ctlPanel.add(cancel);
+ ctlPanel.add(Box.createHorizontalStrut(10));
+ ctlPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
+
+ return ctlPanel;
+ }
+
private JPanel buildRGBPane() {
JPanel rgbPanel = new JPanel();
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties 2008-11-22 01:56:50 UTC (rev 217)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties 2008-11-22 01:59:03 UTC (rev 218)
@@ -85,11 +85,14 @@
label.save_overwrite = The file "{0}" already exists, do you want to overwrite it?
-label.x = x:
-label.y = y:
-label.color = color:
+label.x = x
+label.y = y
+label.color = color
tooltip.inspector = Click in the frame's window to freeze the inspector value, and click again to unfreeze
label.rgb = RGB
-label.grayscale = Gray scale
\ No newline at end of file
+label.grayscale = Gray scale
+
+label.width = Width
+label.height = Height
\ 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-11-22 01:56:55
|
Revision: 217
http://pixelle.svn.sourceforge.net/pixelle/?rev=217&view=rev
Author: dbrosius
Date: 2008-11-22 01:56:50 +0000 (Sat, 22 Nov 2008)
Log Message:
-----------
a swing document to inforce integer entry
Added Paths:
-----------
trunk/pixelle/src/com/mebigfatguy/pixelle/utils/IntegerDocument.java
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/utils/IntegerDocument.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/utils/IntegerDocument.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/utils/IntegerDocument.java 2008-11-22 01:56:50 UTC (rev 217)
@@ -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.utils;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.swing.text.AttributeSet;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.PlainDocument;
+
+
+public class IntegerDocument extends PlainDocument
+{
+ private static final long serialVersionUID = -4300414460486882975L;
+
+ private static final Pattern INTEGERPATTERN = Pattern.compile("-?[0-9]*");
+
+ @Override
+ public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
+ String start = getText(0, offs);
+ String end = getText(offs, this.getLength() - offs);
+ String newIntegerString = (start + str + end).trim();
+
+ Matcher m = INTEGERPATTERN.matcher(newIntegerString);
+ if (m.matches()) {
+ super.insertString(offs, str, a);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/utils/IntegerDocument.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-22 01:38:41
|
Revision: 216
http://pixelle.svn.sourceforge.net/pixelle/?rev=216&view=rev
Author: dbrosius
Date: 2008-11-22 01:34:48 +0000 (Sat, 22 Nov 2008)
Log Message:
-----------
quell warnings
Modified Paths:
--------------
trunk/pixelle/etc/Pixelle.g
Modified: trunk/pixelle/etc/Pixelle.g
===================================================================
--- trunk/pixelle/etc/Pixelle.g 2008-11-21 06:19:53 UTC (rev 215)
+++ trunk/pixelle/etc/Pixelle.g 2008-11-22 01:34:48 UTC (rev 216)
@@ -376,11 +376,11 @@
}
| 'e' '(' ')'
{
- mv.visitLdcInsn(Math.E);
+ mv.visitLdcInsn(Double.valueOf(Math.E));
}
| 'pi' '(' ')'
{
- mv.visitLdcInsn(Math.PI);
+ mv.visitLdcInsn(Double.valueOf(Math.PI));
}
| 'random'
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-21 06:19:54
|
Revision: 215
http://pixelle.svn.sourceforge.net/pixelle/?rev=215&view=rev
Author: dbrosius
Date: 2008-11-21 06:19:53 +0000 (Fri, 21 Nov 2008)
Log Message:
-----------
more doc
Modified Paths:
--------------
trunk/pixelle/htdocs/index.html
Modified: trunk/pixelle/htdocs/index.html
===================================================================
--- trunk/pixelle/htdocs/index.html 2008-11-21 06:16:27 UTC (rev 214)
+++ trunk/pixelle/htdocs/index.html 2008-11-21 06:19:53 UTC (rev 215)
@@ -119,6 +119,8 @@
<p>As of November 14, a pixel inspector window has been added, which helps determine input for the transformations</p>
+ <p>As of November 21, transformations can be done to grayscale. Prototypical example is color separations.</p>
+
<p>Still to be done is recognition of more image types, working with multiple
input sources, creating non ABGR images, more options handling such as fractional pixels,
a bunch of bugs, and a bunch of stuff I have yet to think about.</p>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-21 06:16:32
|
Revision: 214
http://pixelle.svn.sourceforge.net/pixelle/?rev=214&view=rev
Author: dbrosius
Date: 2008-11-21 06:16:27 +0000 (Fri, 21 Nov 2008)
Log Message:
-----------
support transforming to grayscale
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleComponent.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval4ByteABGR.java
trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalByteGray.java
trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xml
trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xsd
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleComponent.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleComponent.java 2008-11-21 05:44:09 UTC (rev 213)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleComponent.java 2008-11-21 06:16:27 UTC (rev 214)
@@ -55,10 +55,9 @@
}
public static Set<PixelleComponent> gsValues() {
- Set<PixelleComponent> components = EnumSet.<PixelleComponent>allOf(PixelleComponent.class);
- components.remove(PixelleComponent.RED);
- components.remove(PixelleComponent.GREEN);
- components.remove(PixelleComponent.BLUE);
+ Set<PixelleComponent> components = EnumSet.<PixelleComponent>noneOf(PixelleComponent.class);
+ components.add(PixelleComponent.BLACK);
+ components.add(PixelleComponent.SELECTION);
return components;
}
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java 2008-11-21 05:44:09 UTC (rev 213)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java 2008-11-21 06:16:27 UTC (rev 214)
@@ -153,6 +153,17 @@
return 0.0;
}
}
+
+ /**
+ * sets the pixel value at the specified x, y
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @param pixelSpec the component to set
+ * @param value the value to set
+ */
+ public void setValue(int x, int y, char pixelSpec, double value) {
+ //Overridden in classes that are uses for output images
+ }
/**
* gets the width of the source image
@@ -221,7 +232,7 @@
case Roll: {
int ival = (int)(value + 0.49) % 256;
- return (double)ival;
+ return ival;
}
case Wave: {
@@ -239,7 +250,7 @@
else
ival = 256 - ival & 0x00FF;
}
- return (double)ival;
+ return ival;
}
case Clip:
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-11-21 05:44:09 UTC (rev 213)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-11-21 06:16:27 UTC (rev 214)
@@ -34,6 +34,7 @@
import com.mebigfatguy.pixelle.antlr.PixelleLexer;
import com.mebigfatguy.pixelle.antlr.PixelleParser;
import com.mebigfatguy.pixelle.eval.PixelleEval4ByteABGR;
+import com.mebigfatguy.pixelle.eval.PixelleEvalByteGray;
/**
* transforms one bitmap into another based on the algorithms defined by the user.
@@ -80,19 +81,22 @@
*/
public PixelleImage transform() throws PixelleTransformException {
- if (outputImageType == ImageType.Grayscale) {
- throw new PixelleTransformException("Transforming to Grayscale not implemented yet");
- }
-
String currentComponent = "";
String currentAlgorithm = "";
try {
/** eventually allow for gui to set width/height */
- PixelleImage destImage = new PixelleImage(new BufferedImage(srcImage.getWidth(), srcImage.getHeight(), BufferedImage.TYPE_4BYTE_ABGR));
+ PixelleImage destImage;
+ PixelleEval destPE;
+ if (outputImageType == ImageType.RGB) {
+ destImage = new PixelleImage(new BufferedImage(srcImage.getWidth(), srcImage.getHeight(), BufferedImage.TYPE_4BYTE_ABGR));
+ destPE = new PixelleEval4ByteABGR(destImage, PixelleEvalFactory.getIndexOutOfBoundsOption(), PixelleEvalFactory.getColorOutOfBoundsOption());
+ } else {
+ destImage = new PixelleImage(new BufferedImage(srcImage.getWidth(), srcImage.getHeight(), BufferedImage.TYPE_BYTE_GRAY));
+ destPE = new PixelleEvalByteGray(destImage, PixelleEvalFactory.getIndexOutOfBoundsOption(), PixelleEvalFactory.getColorOutOfBoundsOption());
+ }
PixelleEval srcPE = PixelleEvalFactory.create(srcImage);
- PixelleEval4ByteABGR destPE = new PixelleEval4ByteABGR(destImage, PixelleEvalFactory.getIndexOutOfBoundsOption(), PixelleEvalFactory.getColorOutOfBoundsOption());
PixelleClassLoader pcl = AccessController.doPrivileged(new PrivilegedAction<PixelleClassLoader>() {
public PixelleClassLoader run() {
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval4ByteABGR.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval4ByteABGR.java 2008-11-21 05:44:09 UTC (rev 213)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEval4ByteABGR.java 2008-11-21 06:16:27 UTC (rev 214)
@@ -31,24 +31,25 @@
@Override
public double getTransparencyValue(int x, int y) {
- return (double)buffer.getElem(y * width * 4 + x * 4);
+ return 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);
+ return 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);
+ return 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);
+ return buffer.getElem(y * width * 4 + x * 4 + 3);
}
+ @Override
public void setValue(int x, int y, char pixelSpec, double value) {
value = adjustColor(value);
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalByteGray.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalByteGray.java 2008-11-21 05:44:09 UTC (rev 213)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/eval/PixelleEvalByteGray.java 2008-11-21 06:16:27 UTC (rev 214)
@@ -50,7 +50,23 @@
}
private double getValue(int x, int y) {
- return (double)buffer.getElem(y * width + x);
+ return buffer.getElem(y * width + x);
}
+
+ @Override
+ public void setValue(int x, int y, char pixelSpec, double value) {
+
+ value = adjustColor(value);
+
+ switch (pixelSpec) {
+ case 'k':
+ buffer.setElem(y * width + x, (int)(value + 0.49));
+ break;
+
+ case 's':
+ setSelectionValue(x, y, value);
+ break;
+ }
+ }
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xml
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xml 2008-11-21 05:44:09 UTC (rev 213)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xml 2008-11-21 06:16:27 UTC (rev 214)
@@ -48,9 +48,6 @@
<component name="black">
(255 - p[x,y].r) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
</component>
- <component name="transparency">
- 255
- </component>
<component name="selection">
0
</component>
@@ -59,9 +56,6 @@
<component name="black">
(255 - p[x,y].g) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
</component>
- <component name="transparency">
- 255
- </component>
<component name="selection">
0
</component>
@@ -70,9 +64,6 @@
<component name="black">
(255 - p[x,y].b) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
</component>
- <component name="transparency">
- 255
- </component>
<component name="selection">
0
</component>
@@ -81,9 +72,6 @@
<component name="black">
min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
</component>
- <component name="transparency">
- 255
- </component>
<component name="selection">
0
</component>
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xsd
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xsd 2008-11-21 05:44:09 UTC (rev 213)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xsd 2008-11-21 06:16:27 UTC (rev 214)
@@ -42,6 +42,7 @@
<xsd:enumeration value="blue"/>
<xsd:enumeration value="selection"/>
<xsd:enumeration value="green"/>
+ <xsd:enumeration value="black"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="algorithms" type="AlgorithmsClass"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-21 05:44:11
|
Revision: 213
http://pixelle.svn.sourceforge.net/pixelle/?rev=213&view=rev
Author: dbrosius
Date: 2008-11-21 05:44:09 +0000 (Fri, 21 Nov 2008)
Log Message:
-----------
don't write the class bytes to file (debugging)
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-11-20 07:54:57 UTC (rev 212)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-11-21 05:44:09 UTC (rev 213)
@@ -115,7 +115,7 @@
pp.pixelle();
byte[] bytes = pp.getClassBytes();
- dump(bytes, clsName.substring(clsName.lastIndexOf('.') + 1) + ".class");
+ //dump(bytes, clsName.substring(clsName.lastIndexOf('.') + 1) + ".class");
pcl.addClass(clsName, bytes);
Class<?> cl = pcl.loadClass(clsName);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-20 07:54:59
|
Revision: 212
http://pixelle.svn.sourceforge.net/pixelle/?rev=212&view=rev
Author: dbrosius
Date: 2008-11-20 07:54:57 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
use EnumMap
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-11-20 07:51:05 UTC (rev 211)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-11-20 07:54:57 UTC (rev 212)
@@ -67,8 +67,8 @@
private final Map<ImageType, Map<String, Map<String, Map<PixelleComponent, String>>>> userAlgorithms;
private AlgorithmArchiver() {
- systemAlgorithms = new HashMap<ImageType, Map<String, Map<String, Map<PixelleComponent, String>>>>();
- userAlgorithms = new HashMap<ImageType, Map<String, Map<String, Map<PixelleComponent, String>>>>();
+ systemAlgorithms = new EnumMap<ImageType, Map<String, Map<String, Map<PixelleComponent, String>>>>(ImageType.class);
+ userAlgorithms = new EnumMap<ImageType, Map<String, Map<String, Map<PixelleComponent, String>>>>(ImageType.class);
loadSystemAlgorithms();
loadUserAlgorithms();
}
@@ -151,7 +151,7 @@
type.put(groupName, group);
}
- group.put(algorithmName, new HashMap<PixelleComponent, String>(algorithm));
+ group.put(algorithmName, new EnumMap<PixelleComponent, String>(algorithm));
}
public void setCurrent(ImageType imageType, Map<PixelleComponent, String> algorithm) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-20 07:51:08
|
Revision: 211
http://pixelle.svn.sourceforge.net/pixelle/?rev=211&view=rev
Author: dbrosius
Date: 2008-11-20 07:51:05 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
use the right array for sizing
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-11-20 07:48:18 UTC (rev 210)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-11-20 07:51:05 UTC (rev 211)
@@ -222,8 +222,8 @@
algoPanel.setLayout(new GridLayout(5, 1));
GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, rgbLHS.values().toArray(new JComponent[rgbLHS.size()]));
- GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, rgbEditor.values().toArray(new JComponent[rgbLHS.size()]));
- GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, rgbLabels.values().toArray(new JComponent[rgbLHS.size()]));
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, rgbEditor.values().toArray(new JComponent[rgbEditor.size()]));
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, rgbLabels.values().toArray(new JComponent[rgbLabels.size()]));
for (PixelleComponent comp : PixelleComponent.rgbValues()) {
JPanel p = new JPanel();
@@ -291,8 +291,8 @@
algoPanel.setLayout(new GridLayout(5, 1));
GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, gsLHS.values().toArray(new JComponent[gsLHS.size()]));
- GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, gsEditor.values().toArray(new JComponent[gsLHS.size()]));
- GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, gsLabels.values().toArray(new JComponent[gsLHS.size()]));
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, gsEditor.values().toArray(new JComponent[gsEditor.size()]));
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, gsLabels.values().toArray(new JComponent[gsLabels.size()]));
for (PixelleComponent comp : PixelleComponent.gsValues()) {
JPanel p = new JPanel();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-20 07:48:19
|
Revision: 210
http://pixelle.svn.sourceforge.net/pixelle/?rev=210&view=rev
Author: dbrosius
Date: 2008-11-20 07:48:18 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
@Override
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/SaveAlgorithmDialog.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/SaveAlgorithmDialog.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/SaveAlgorithmDialog.java 2008-11-20 07:47:16 UTC (rev 209)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/SaveAlgorithmDialog.java 2008-11-20 07:48:18 UTC (rev 210)
@@ -44,7 +44,7 @@
public class SaveAlgorithmDialog extends JDialog {
private static final long serialVersionUID = -6991592080722431427L;
- private JLabel[] labels = new JLabel[] {
+ private final JLabel[] labels = new JLabel[] {
new JLabel(PixelleBundle.getString(PixelleBundle.PIXEL_GROUP)),
new JLabel(PixelleBundle.getString(PixelleBundle.PIXEL_ALGORITHM))
};
@@ -69,6 +69,7 @@
return (String)groupBox.getSelectedItem();
}
+ @Override
public String getName() {
return nameField.getText();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-20 07:47:19
|
Revision: 209
http://pixelle.svn.sourceforge.net/pixelle/?rev=209&view=rev
Author: dbrosius
Date: 2008-11-20 07:47:16 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
show message that gs isn't supported yet
Modified Paths:
--------------
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
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java 2008-11-20 07:45:14 UTC (rev 208)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java 2008-11-20 07:47:16 UTC (rev 209)
@@ -103,7 +103,7 @@
boolean doNewWindow;
public PixelleFrame() throws PixelleTransformException {
- this(new PixelleTransformer(new PixelleImage(), PixelleTransformer.getSampleTransform()).transform(), false);
+ this(new PixelleTransformer(new PixelleImage(), PixelleTransformer.getSampleTransform(), ImageType.RGB).transform(), false);
}
public PixelleFrame(PixelleImage srcImage) {
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-11-20 07:45:14 UTC (rev 208)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-11-20 07:47:16 UTC (rev 209)
@@ -42,15 +42,17 @@
private final PixelleImage srcImage;
private Map<PixelleComponent, String> algorithms = null;
+ private final ImageType outputImageType;
/**
* constructions a transformer given a source bitmap and algorithms
* @param image the source image
* @param algos the algorithms for the color components
*/
- public PixelleTransformer(PixelleImage image, Map<PixelleComponent, String> algos) {
+ public PixelleTransformer(PixelleImage image, Map<PixelleComponent, String> algos, ImageType imageType) {
srcImage = image;
algorithms = algos;
+ outputImageType = imageType;
}
/**
@@ -78,6 +80,10 @@
*/
public PixelleImage transform() throws PixelleTransformException {
+ if (outputImageType == ImageType.Grayscale) {
+ throw new PixelleTransformException("Transforming to Grayscale not implemented yet");
+ }
+
String currentComponent = "";
String currentAlgorithm = "";
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java 2008-11-20 07:45:14 UTC (rev 208)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java 2008-11-20 07:47:16 UTC (rev 209)
@@ -25,6 +25,7 @@
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
+import com.mebigfatguy.pixelle.ImageType;
import com.mebigfatguy.pixelle.PixelleBundle;
import com.mebigfatguy.pixelle.PixelleFrame;
import com.mebigfatguy.pixelle.PixelleImage;
@@ -50,7 +51,8 @@
d.setModal(true);
d.setVisible(true);
if (d.isOK()) {
- PixelleTransformer transformer = new PixelleTransformer(frame.getImage(), d.getAlgorithms(d.getImageType()));
+ ImageType imageType = d.getImageType();
+ PixelleTransformer transformer = new PixelleTransformer(frame.getImage(), d.getAlgorithms(imageType), imageType);
PixelleImage dstImage = transformer.transform();
if (dstImage != null) {
if (frame.createNewWindow()) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-20 07:45:16
|
Revision: 208
http://pixelle.svn.sourceforge.net/pixelle/?rev=208&view=rev
Author: dbrosius
Date: 2008-11-20 07:45:14 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
add standard ctor
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformException.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformException.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformException.java 2008-11-20 07:41:28 UTC (rev 207)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformException.java 2008-11-20 07:45:14 UTC (rev 208)
@@ -21,6 +21,10 @@
public class PixelleTransformException extends Exception {
private static final long serialVersionUID = -7209029044223677078L;
+ public PixelleTransformException(String message) {
+ super(message);
+ }
+
public PixelleTransformException(String message, Throwable initCause) {
super(message, initCause);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-20 07:41:36
|
Revision: 207
http://pixelle.svn.sourceforge.net/pixelle/?rev=207&view=rev
Author: dbrosius
Date: 2008-11-20 07:41:28 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
fix up the algorithms picker event handler
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-11-20 07:21:06 UTC (rev 206)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-11-20 07:41:28 UTC (rev 207)
@@ -297,6 +297,8 @@
currentAlgorithm = null;
} else if (GROUP.equals(localName)) {
currentGroup = null;
+ } else if (TYPE.equals(localName)) {
+ currentType = null;
}
}
});
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-11-20 07:21:06 UTC (rev 206)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-11-20 07:41:28 UTC (rev 207)
@@ -128,7 +128,7 @@
public Map<PixelleComponent, String> getAlgorithms(ImageType imageType) {
Map<PixelleComponent, String> algorithms = new EnumMap<PixelleComponent, String>(PixelleComponent.class);
for (PixelleComponent comp : (imageType == ImageType.RGB) ? PixelleComponent.rgbValues() : PixelleComponent.gsValues()) {
- algorithms.put(comp, rgbEditor.get(comp).getText());
+ algorithms.put(comp, (imageType == ImageType.RGB) ? rgbEditor.get(comp).getText() : gsEditor.get(comp).getText());
}
return algorithms;
}
@@ -323,6 +323,15 @@
}
});
+ selectedGSAlgorithm.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mousePressed(MouseEvent me) {
+ savedGSAlgorithms.setSize(selectedGSAlgorithm.getSize());
+ savedGSAlgorithms.show(selectedGSAlgorithm, 0, 0);
+ }
+ });
+
save.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
SaveAlgorithmDialog dialog = new SaveAlgorithmDialog(frame);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-20 07:21:07
|
Revision: 206
http://pixelle.svn.sourceforge.net/pixelle/?rev=206&view=rev
Author: dbrosius
Date: 2008-11-20 07:21:06 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
fix xml
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-11-20 07:18:44 UTC (rev 205)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-11-20 07:21:06 UTC (rev 206)
@@ -227,7 +227,7 @@
pw.println(" xsi:schemaLocation='/com/mebigfatguy/pixelle/resources/algorithms.xsd'>");
for (Map.Entry<ImageType, Map<String, Map<String, Map<PixelleComponent, String>>>> type : algorithms.entrySet()) {
- pw.println(" <type name'" + type.getKey() + "'>");
+ pw.println(" <type name='" + type.getKey() + "'>");
for (Map.Entry<String, Map<String, Map<PixelleComponent, String>>> group : type.getValue().entrySet()) {
pw.println(" <group name='" + group.getKey() + "'>");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-20 07:18:47
|
Revision: 205
http://pixelle.svn.sourceforge.net/pixelle/?rev=205&view=rev
Author: dbrosius
Date: 2008-11-20 07:18:44 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
Get the tabbed panes marginally working with a single PixelleComponent
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleComponent.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xml
trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xsd
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-11-20 06:39:17 UTC (rev 204)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-11-20 07:18:44 UTC (rev 205)
@@ -51,23 +51,24 @@
private static final String SYSTEM_ALGO_XML_PATH = "/com/mebigfatguy/pixelle/resources/algorithms.xml";
private static final String SYSTEM_ALGO_XSD_PATH = "/com/mebigfatguy/pixelle/resources/algorithms.xsd";
+ public static final String TYPE = "type";
public static final String GROUP = "group";
public static final String CURRENT = "current_";
public static final String ALGORITHM = "algorithm";
public static final String COMPONENT = "component";
public static final String NAME = "name";
- public static final String PIXELLE = "pixelle";
+ public static final String PIXELLE = ".pixelle";
public static final String ALGORITHMS_FILE = "algorithms.xml";
private static AlgorithmArchiver archiver = new AlgorithmArchiver();
- private final Map<String, Map<String, Map<RGBPixelleComponent, String>>> systemAlgorithms;
- private final Map<String, Map<String, Map<RGBPixelleComponent, String>>> userAlgorithms;
+ private final Map<ImageType, Map<String, Map<String, Map<PixelleComponent, String>>>> systemAlgorithms;
+ private final Map<ImageType, Map<String, Map<String, Map<PixelleComponent, String>>>> userAlgorithms;
private AlgorithmArchiver() {
- systemAlgorithms = new HashMap<String, Map<String, Map<RGBPixelleComponent, String>>>();
- userAlgorithms = new HashMap<String, Map<String, Map<RGBPixelleComponent, String>>>();
+ systemAlgorithms = new HashMap<ImageType, Map<String, Map<String, Map<PixelleComponent, String>>>>();
+ userAlgorithms = new HashMap<ImageType, Map<String, Map<String, Map<PixelleComponent, String>>>>();
loadSystemAlgorithms();
loadUserAlgorithms();
}
@@ -76,44 +77,54 @@
return archiver;
}
- public JPopupMenu getAlgorithmDisplayPopup(ImageType type, ActionListener l) {
+ public JPopupMenu getAlgorithmDisplayPopup(ImageType imageType, ActionListener l) {
JPopupMenu m = new JPopupMenu(PixelleBundle.getString(PixelleBundle.PIXEL_ALGORITHM));
- populateMenuAlgorithms(m, systemAlgorithms, l);
- populateMenuAlgorithms(m, userAlgorithms, l);
+ populateMenuAlgorithms(m, systemAlgorithms.get(imageType), l);
+ populateMenuAlgorithms(m, userAlgorithms.get(imageType), l);
return m;
}
- private void populateMenuAlgorithms(JPopupMenu menu, Map<String, Map<String, Map<RGBPixelleComponent, String>>> algorithms, ActionListener l) {
- for (final Map.Entry<String, Map<String, Map<RGBPixelleComponent, String>>> entry : algorithms.entrySet()) {
- String groupName = entry.getKey();
- if (!CURRENT.equals(groupName)) {
- JMenu group = new JMenu(groupName);
- menu.add(group);
- for (final String algos : entry.getValue().keySet()) {
- JMenuItem algoItem = new JMenuItem(algos);
- algoItem.putClientProperty(NAME, groupName);
- algoItem.addActionListener(l);
- group.add(algoItem);
+ private void populateMenuAlgorithms(JPopupMenu menu, Map<String, Map<String, Map<PixelleComponent, String>>> algorithms, ActionListener l) {
+ if (algorithms != null) {
+ for (final Map.Entry<String, Map<String, Map<PixelleComponent, String>>> entry : algorithms.entrySet()) {
+ String groupName = entry.getKey();
+ if (!CURRENT.equals(groupName)) {
+ JMenu group = new JMenu(groupName);
+ menu.add(group);
+ for (final String algos : entry.getValue().keySet()) {
+ JMenuItem algoItem = new JMenuItem(algos);
+ algoItem.putClientProperty(NAME, groupName);
+ algoItem.addActionListener(l);
+ group.add(algoItem);
+ }
}
}
}
}
- public Map<? extends Enum, String> getAlgorithm(ImageType type, String groupName, String algorithmName) {
- Map<String, Map<RGBPixelleComponent, String>> group = systemAlgorithms.get(groupName);
- if (group != null) {
- Map<RGBPixelleComponent, String> algo = group.get(algorithmName);
- if (algo != null)
- return algo;
+ public Map<PixelleComponent, String> getAlgorithm(ImageType imageType, String groupName, String algorithmName) {
+ Map<String, Map<String, Map<PixelleComponent, String>>> type = systemAlgorithms.get(imageType);
+ if (type != null) {
+ Map<String, Map<PixelleComponent, String>> group = type.get(groupName);
+ if (group != null) {
+ Map<PixelleComponent, String> algo = group.get(algorithmName);
+ if (algo != null)
+ return algo;
+ }
}
- group = userAlgorithms.get(groupName);
+ type = userAlgorithms.get(imageType);
+ if (type == null) {
+ throw new IllegalArgumentException("Unknown type name " + imageType.name());
+ }
+
+ Map<String, Map<PixelleComponent, String>> group = type.get(groupName);
if (group == null) {
throw new IllegalArgumentException("Unknown group name " + groupName);
}
- Map<RGBPixelleComponent, String> algo = group.get(algorithmName);
+ Map<PixelleComponent, String> algo = group.get(algorithmName);
if (algo == null) {
throw new IllegalArgumentException("Unknown algorithm name " + algorithmName);
}
@@ -126,28 +137,38 @@
return userAlgorithms.keySet().toArray(new String[userAlgorithms.size()]);
}
- public void addAlgorithm(String groupName, String algorithmName, Map<RGBPixelleComponent, String> algorithm) {
- Map<String, Map<RGBPixelleComponent, String>> group = userAlgorithms.get(groupName);
+ public void addAlgorithm(ImageType imageType, String groupName, String algorithmName, Map<PixelleComponent, String> algorithm) {
+ Map<String, Map<String, Map<PixelleComponent, String>>> type = userAlgorithms.get(imageType);
+ if (type == null) {
+ type = new HashMap<String, Map<String, Map<PixelleComponent, String>>>();
+ userAlgorithms.put(imageType, type);
+ }
+
+
+ Map<String, Map<PixelleComponent, String>> group = type.get(groupName);
if (group == null) {
- group = new HashMap<String, Map<RGBPixelleComponent, String>>();
- userAlgorithms.put(groupName, group);
+ group = new HashMap<String, Map<PixelleComponent, String>>();
+ type.put(groupName, group);
}
- group.put(algorithmName, new HashMap<RGBPixelleComponent, String>(algorithm));
+ group.put(algorithmName, new HashMap<PixelleComponent, String>(algorithm));
}
- public void setCurrent(Map<RGBPixelleComponent, String> algorithm) {
- addAlgorithm(AlgorithmArchiver.CURRENT, AlgorithmArchiver.CURRENT, algorithm);
+ public void setCurrent(ImageType imageType, Map<PixelleComponent, String> algorithm) {
+ addAlgorithm(imageType, AlgorithmArchiver.CURRENT, AlgorithmArchiver.CURRENT, algorithm);
}
- public Map<? extends Enum, String> getCurrent(ImageType type) {
- return getAlgorithm(type, AlgorithmArchiver.CURRENT, AlgorithmArchiver.CURRENT);
+ public Map<PixelleComponent, String> getCurrent(ImageType imageType) {
+ return getAlgorithm(imageType, AlgorithmArchiver.CURRENT, AlgorithmArchiver.CURRENT);
}
- public void removeAlgorithm(String group, String name) {
- Map<String, Map<RGBPixelleComponent, String>> algoGroup = userAlgorithms.get(group);
- if (algoGroup != null) {
- algoGroup.remove(name);
+ public void removeAlgorithm(ImageType imageType, String group, String name) {
+ Map<String, Map<String, Map<PixelleComponent, String>>> type = userAlgorithms.get(imageType);
+ if (type != null) {
+ Map<String, Map<PixelleComponent, String>> algoGroup = type.get(group);
+ if (algoGroup != null) {
+ algoGroup.remove(name);
+ }
}
}
@@ -197,7 +218,7 @@
}
- private void writeAlgorithms(OutputStream is, Map<String, Map<String, Map<RGBPixelleComponent, String>>> algorithms) throws IOException {
+ private void writeAlgorithms(OutputStream is, Map<ImageType, Map<String, Map<String, Map<PixelleComponent, String>>>> algorithms) throws IOException {
PrintWriter pw = null;
try {
pw = new PrintWriter(new OutputStreamWriter(is));
@@ -205,20 +226,24 @@
pw.println(" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'");
pw.println(" xsi:schemaLocation='/com/mebigfatguy/pixelle/resources/algorithms.xsd'>");
- for (Map.Entry<String, Map<String, Map<RGBPixelleComponent, String>>> group : algorithms.entrySet()) {
- pw.println(" <group name='" + group.getKey() + "'>");
-
- for (Map.Entry<String, Map<RGBPixelleComponent, String>> algorithm : group.getValue().entrySet()) {
- pw.println(" <algorithm name='" + algorithm.getKey() + "'>");
+ for (Map.Entry<ImageType, Map<String, Map<String, Map<PixelleComponent, String>>>> type : algorithms.entrySet()) {
+ pw.println(" <type name'" + type.getKey() + "'>");
+ for (Map.Entry<String, Map<String, Map<PixelleComponent, String>>> group : type.getValue().entrySet()) {
+ pw.println(" <group name='" + group.getKey() + "'>");
- for (Map.Entry<RGBPixelleComponent, String> component : algorithm.getValue().entrySet()) {
- pw.println(" <component name='" + component.getKey().name().toLowerCase() + "'>");
- pw.println(" " + component.getValue());
- pw.println(" </component>");
+ for (Map.Entry<String, Map<PixelleComponent, String>> algorithm : group.getValue().entrySet()) {
+ pw.println(" <algorithm name='" + algorithm.getKey() + "'>");
+
+ for (Map.Entry<PixelleComponent, String> component : algorithm.getValue().entrySet()) {
+ pw.println(" <component name='" + component.getKey().name().toLowerCase() + "'>");
+ pw.println(" " + component.getValue());
+ pw.println(" </component>");
+ }
+ pw.println(" </algorithm>");
}
- pw.println(" </algorithm>");
+ pw.println(" </group>");
}
- pw.println(" </group>");
+ pw.println(" </type>");
}
pw.println("</algorithms>");
pw.flush();
@@ -228,21 +253,25 @@
}
}
- private void parseAlgorithms(InputStream is, final Map<String, Map<String, Map<RGBPixelleComponent, String>>> algorithms) throws IOException, SAXException {
+ private void parseAlgorithms(InputStream is, final Map<ImageType, Map<String, Map<String, Map<PixelleComponent, String>>>> algorithms) throws IOException, SAXException {
XMLReader r = XMLReaderFactory.createXMLReader();
r.setContentHandler(new DefaultHandler() {
- Map<String, Map<RGBPixelleComponent, String>> currentGroup = null;
- Map<RGBPixelleComponent, String> currentAlgorithm = null;
+ Map<String, Map<String, Map<PixelleComponent, String>>> currentType = null;
+ Map<String, Map<PixelleComponent, String>> currentGroup = null;
+ Map<PixelleComponent, String> currentAlgorithm = null;
String currentComponentName = null;
StringBuilder algorithmText = null;
@Override
public void startElement(String uri, String localName, String qName, Attributes atts) {
- if (GROUP.equals(localName)) {
- currentGroup = new HashMap<String, Map<RGBPixelleComponent, String>>();
- algorithms.put(atts.getValue(NAME), currentGroup);
+ if (TYPE.equals(localName)) {
+ currentType = new HashMap<String, Map<String, Map<PixelleComponent, String>>>();
+ algorithms.put(ImageType.valueOf(atts.getValue(NAME)), currentType);
+ } else if (GROUP.equals(localName)) {
+ currentGroup = new HashMap<String, Map<PixelleComponent, String>>();
+ currentType.put(atts.getValue(NAME), currentGroup);
} else if (ALGORITHM.equals(localName)) {
- currentAlgorithm = new EnumMap<RGBPixelleComponent, String>(RGBPixelleComponent.class);
+ currentAlgorithm = new EnumMap<PixelleComponent, String>(PixelleComponent.class);
currentGroup.put(atts.getValue(NAME), currentAlgorithm);
} else if (COMPONENT.equals(localName)) {
currentComponentName = atts.getValue(NAME);
@@ -260,7 +289,7 @@
@Override
public void endElement(String uri, String localName, String qName) {
if (COMPONENT.equals(localName)) {
- RGBPixelleComponent pc = RGBPixelleComponent.valueOf(currentComponentName.toUpperCase());
+ PixelleComponent pc = PixelleComponent.valueOf(currentComponentName.toUpperCase());
currentAlgorithm.put(pc, algorithmText.toString().trim());
algorithmText = null;
currentComponentName = null;
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleComponent.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleComponent.java 2008-11-20 06:39:17 UTC (rev 204)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleComponent.java 2008-11-20 07:18:44 UTC (rev 205)
@@ -18,6 +18,9 @@
*/
package com.mebigfatguy.pixelle;
+import java.util.EnumSet;
+import java.util.Set;
+
/**
* an enum that represents a part of an rgb bitmap
*/
@@ -44,4 +47,18 @@
public char getPixelSpec() {
return pixelSpec;
}
+
+ public static Set<PixelleComponent> rgbValues() {
+ Set<PixelleComponent> components = EnumSet.<PixelleComponent>allOf(PixelleComponent.class);
+ components.remove(PixelleComponent.BLACK);
+ return components;
+ }
+
+ public static Set<PixelleComponent> gsValues() {
+ Set<PixelleComponent> components = EnumSet.<PixelleComponent>allOf(PixelleComponent.class);
+ components.remove(PixelleComponent.RED);
+ components.remove(PixelleComponent.GREEN);
+ components.remove(PixelleComponent.BLUE);
+ return components;
+ }
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-11-20 06:39:17 UTC (rev 204)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-11-20 07:18:44 UTC (rev 205)
@@ -41,14 +41,14 @@
public class PixelleTransformer {
private final PixelleImage srcImage;
- private Map<RGBPixelleComponent, String> algorithms = null;
+ private Map<PixelleComponent, String> algorithms = null;
/**
* constructions a transformer given a source bitmap and algorithms
* @param image the source image
* @param algos the algorithms for the color components
*/
- public PixelleTransformer(PixelleImage image, Map<RGBPixelleComponent, String> algos) {
+ public PixelleTransformer(PixelleImage image, Map<PixelleComponent, String> algos) {
srcImage = image;
algorithms = algos;
}
@@ -58,13 +58,13 @@
*
* @return a set of transformation algorithms
*/
- public static Map<RGBPixelleComponent, String> getSampleTransform() {
- Map<RGBPixelleComponent, String> algorithms = new EnumMap<RGBPixelleComponent, String>(RGBPixelleComponent.class);
- algorithms.put(RGBPixelleComponent.RED, "x");
- algorithms.put(RGBPixelleComponent.GREEN, "y");
- algorithms.put(RGBPixelleComponent.BLUE, "abs((width/2) - x)");
- algorithms.put(RGBPixelleComponent.TRANSPARENCY, "((x < 10) || (x >= (width - 10)) || (y < 10) || (y >= (height - 10))) ? 180 : 255");
- algorithms.put(RGBPixelleComponent.SELECTION, "0");
+ public static Map<PixelleComponent, String> getSampleTransform() {
+ Map<PixelleComponent, String> algorithms = new EnumMap<PixelleComponent, String>(PixelleComponent.class);
+ algorithms.put(PixelleComponent.RED, "x");
+ algorithms.put(PixelleComponent.GREEN, "y");
+ algorithms.put(PixelleComponent.BLUE, "abs((width/2) - x)");
+ algorithms.put(PixelleComponent.TRANSPARENCY, "((x < 10) || (x >= (width - 10)) || (y < 10) || (y >= (height - 10))) ? 180 : 255");
+ algorithms.put(PixelleComponent.SELECTION, "0");
return algorithms;
}
/**
@@ -94,7 +94,7 @@
}
});
- for (Map.Entry<RGBPixelleComponent, String> entry : algorithms.entrySet()) {
+ for (Map.Entry<PixelleComponent, String> entry : algorithms.entrySet()) {
currentComponent = entry.getKey().name();
currentAlgorithm = entry.getValue();
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java 2008-11-20 06:39:17 UTC (rev 204)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/TransformAction.java 2008-11-20 07:18:44 UTC (rev 205)
@@ -50,7 +50,7 @@
d.setModal(true);
d.setVisible(true);
if (d.isOK()) {
- PixelleTransformer transformer = new PixelleTransformer(frame.getImage(), d.getAlgorithms());
+ PixelleTransformer transformer = new PixelleTransformer(frame.getImage(), d.getAlgorithms(d.getImageType()));
PixelleImage dstImage = transformer.transform();
if (dstImage != null) {
if (frame.createNewWindow()) {
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-11-20 06:39:17 UTC (rev 204)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-11-20 07:18:44 UTC (rev 205)
@@ -43,55 +43,54 @@
import javax.swing.JTextField;
import com.mebigfatguy.pixelle.AlgorithmArchiver;
-import com.mebigfatguy.pixelle.GrayscalePixelleComponent;
import com.mebigfatguy.pixelle.ImageType;
import com.mebigfatguy.pixelle.PixelleBundle;
+import com.mebigfatguy.pixelle.PixelleComponent;
import com.mebigfatguy.pixelle.PixelleFrame;
-import com.mebigfatguy.pixelle.RGBPixelleComponent;
import com.mebigfatguy.pixelle.utils.GuiUtils;
public class PixelleExpressionDialog extends JDialog {
private static final long serialVersionUID = -4273352119079307059L;
- private final Map<RGBPixelleComponent, JLabel> rgbLHS = new EnumMap<RGBPixelleComponent, JLabel>(RGBPixelleComponent.class);
+ private final Map<PixelleComponent, JLabel> rgbLHS = new EnumMap<PixelleComponent, JLabel>(PixelleComponent.class);
{
- for (RGBPixelleComponent comp : RGBPixelleComponent.values()) {
+ for (PixelleComponent comp : PixelleComponent.rgbValues()) {
rgbLHS.put(comp, new JLabel(PixelleBundle.getString("formula." + comp.name().toLowerCase()) + " = "));
}
};
- private final Map<RGBPixelleComponent, JTextField> rgbEditor = new EnumMap<RGBPixelleComponent, JTextField>(RGBPixelleComponent.class);
+ private final Map<PixelleComponent, JTextField> rgbEditor = new EnumMap<PixelleComponent, JTextField>(PixelleComponent.class);
{
- for (RGBPixelleComponent comp : RGBPixelleComponent.values()) {
+ for (PixelleComponent comp : PixelleComponent.rgbValues()) {
rgbEditor.put(comp, new JTextField(PixelleBundle.getString("formula." + comp.name().toLowerCase()), 50));
}
};
- private final Map<RGBPixelleComponent, JLabel> rgbLabels = new EnumMap<RGBPixelleComponent, JLabel>(RGBPixelleComponent.class);
+ private final Map<PixelleComponent, JLabel> rgbLabels = new EnumMap<PixelleComponent, JLabel>(PixelleComponent.class);
{
- for (RGBPixelleComponent comp : RGBPixelleComponent.values()) {
+ for (PixelleComponent comp : PixelleComponent.rgbValues()) {
rgbLabels.put(comp, new JLabel(PixelleBundle.getString("label." + comp.name().toLowerCase())));
}
};
- private final Map<GrayscalePixelleComponent, JLabel> gsLHS = new EnumMap<GrayscalePixelleComponent, JLabel>(GrayscalePixelleComponent.class);
+ private final Map<PixelleComponent, JLabel> gsLHS = new EnumMap<PixelleComponent, JLabel>(PixelleComponent.class);
{
- for (GrayscalePixelleComponent comp : GrayscalePixelleComponent.values()) {
+ for (PixelleComponent comp : PixelleComponent.gsValues()) {
gsLHS.put(comp, new JLabel(PixelleBundle.getString("formula." + comp.name().toLowerCase()) + " = "));
}
};
- private final Map<GrayscalePixelleComponent, JTextField> gsEditor = new EnumMap<GrayscalePixelleComponent, JTextField>(GrayscalePixelleComponent.class);
+ private final Map<PixelleComponent, JTextField> gsEditor = new EnumMap<PixelleComponent, JTextField>(PixelleComponent.class);
{
- for (GrayscalePixelleComponent comp : GrayscalePixelleComponent.values()) {
+ for (PixelleComponent comp : PixelleComponent.gsValues()) {
gsEditor.put(comp, new JTextField(PixelleBundle.getString("formula." + comp.name().toLowerCase()), 50));
}
};
- private final Map<GrayscalePixelleComponent, JLabel> gsLabels = new EnumMap<GrayscalePixelleComponent, JLabel>(GrayscalePixelleComponent.class);
+ private final Map<PixelleComponent, JLabel> gsLabels = new EnumMap<PixelleComponent, JLabel>(PixelleComponent.class);
{
- for (GrayscalePixelleComponent comp : GrayscalePixelleComponent.values()) {
+ for (PixelleComponent comp : PixelleComponent.gsValues()) {
gsLabels.put(comp, new JLabel(PixelleBundle.getString("label." + comp.name().toLowerCase())));
}
};
@@ -105,6 +104,7 @@
JPopupMenu savedRGBAlgorithms;
JTextField selectedGSAlgorithm;
JPopupMenu savedGSAlgorithms;
+ JTabbedPane tabbedPane;
JButton save;
JButton delete;
@@ -121,9 +121,13 @@
return clickedOK;
}
- public Map<RGBPixelleComponent, String> getAlgorithms() {
- Map<RGBPixelleComponent, String> algorithms = new EnumMap<RGBPixelleComponent, String>(RGBPixelleComponent.class);
- for (RGBPixelleComponent comp : RGBPixelleComponent.values()) {
+ public ImageType getImageType() {
+ return (tabbedPane.getSelectedIndex() == 0) ? ImageType.RGB : ImageType.Grayscale;
+ }
+
+ public Map<PixelleComponent, String> getAlgorithms(ImageType imageType) {
+ Map<PixelleComponent, String> algorithms = new EnumMap<PixelleComponent, String>(PixelleComponent.class);
+ for (PixelleComponent comp : (imageType == ImageType.RGB) ? PixelleComponent.rgbValues() : PixelleComponent.gsValues()) {
algorithms.put(comp, rgbEditor.get(comp).getText());
}
return algorithms;
@@ -141,7 +145,7 @@
cp.setLayout(new BorderLayout(4, 4));
- JTabbedPane tabbedPane = new JTabbedPane();
+ tabbedPane = new JTabbedPane();
cp.add(tabbedPane, BorderLayout.CENTER);
tabbedPane.add(PixelleBundle.getString(PixelleBundle.RGB), buildRGBPane());
@@ -190,16 +194,16 @@
String algorithmName = item.getText();
String groupName = (String)item.getClientProperty(AlgorithmArchiver.NAME);
selectedRGBAlgorithm.setText(algorithmName);
- Map<RGBPixelleComponent, String> algorithms = (Map<RGBPixelleComponent, String>)AlgorithmArchiver.getArchiver().getAlgorithm(ImageType.RGB, groupName, algorithmName);
- for (RGBPixelleComponent comp : RGBPixelleComponent.values()) {
+ Map<PixelleComponent, String> algorithms = AlgorithmArchiver.getArchiver().getAlgorithm(ImageType.RGB, groupName, algorithmName);
+ for (PixelleComponent comp : PixelleComponent.rgbValues()) {
rgbEditor.get(comp).setText(algorithms.get(comp));
}
}
});
try {
- Map<RGBPixelleComponent, String> algorithms = (Map<RGBPixelleComponent, String>)AlgorithmArchiver.getArchiver().getCurrent(ImageType.RGB);
+ Map<PixelleComponent, String> algorithms = AlgorithmArchiver.getArchiver().getCurrent(ImageType.RGB);
if (algorithms != null) {
- for (RGBPixelleComponent comp : RGBPixelleComponent.values()) {
+ for (PixelleComponent comp : PixelleComponent.rgbValues()) {
rgbEditor.get(comp).setText(algorithms.get(comp));
}
}
@@ -221,7 +225,7 @@
GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, rgbEditor.values().toArray(new JComponent[rgbLHS.size()]));
GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, rgbLabels.values().toArray(new JComponent[rgbLHS.size()]));
- for (RGBPixelleComponent comp : RGBPixelleComponent.values()) {
+ for (PixelleComponent comp : PixelleComponent.rgbValues()) {
JPanel p = new JPanel();
p.setLayout(new BorderLayout(10, 10));
p.add(rgbLHS.get(comp), BorderLayout.WEST);
@@ -259,16 +263,16 @@
String algorithmName = item.getText();
String groupName = (String)item.getClientProperty(AlgorithmArchiver.NAME);
selectedGSAlgorithm.setText(algorithmName);
- Map<GrayscalePixelleComponent, String> algorithms = (Map<GrayscalePixelleComponent, String>)AlgorithmArchiver.getArchiver().getAlgorithm(ImageType.Grayscale, groupName, algorithmName);
- for (GrayscalePixelleComponent comp : GrayscalePixelleComponent.values()) {
+ Map<PixelleComponent, String> algorithms = AlgorithmArchiver.getArchiver().getAlgorithm(ImageType.Grayscale, groupName, algorithmName);
+ for (PixelleComponent comp : PixelleComponent.gsValues()) {
gsEditor.get(comp).setText(algorithms.get(comp));
}
}
});
try {
- Map<GrayscalePixelleComponent, String> algorithms = (Map<GrayscalePixelleComponent, String>)AlgorithmArchiver.getArchiver().getCurrent(ImageType.Grayscale);
+ Map<PixelleComponent, String> algorithms = AlgorithmArchiver.getArchiver().getCurrent(ImageType.Grayscale);
if (algorithms != null) {
- for (GrayscalePixelleComponent comp : GrayscalePixelleComponent.values()) {
+ for (PixelleComponent comp : PixelleComponent.gsValues()) {
gsEditor.get(comp).setText(algorithms.get(comp));
}
}
@@ -290,7 +294,7 @@
GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, gsEditor.values().toArray(new JComponent[gsLHS.size()]));
GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, gsLabels.values().toArray(new JComponent[gsLHS.size()]));
- for (GrayscalePixelleComponent comp : GrayscalePixelleComponent.values()) {
+ for (PixelleComponent comp : PixelleComponent.gsValues()) {
JPanel p = new JPanel();
p.setLayout(new BorderLayout(10, 10));
p.add(gsLHS.get(comp), BorderLayout.WEST);
@@ -326,11 +330,12 @@
dialog.setModal(true);
dialog.setVisible(true);
if (dialog.isOK()) {
+ ImageType imageType = getImageType();
String group = dialog.getGroup();
String name = dialog.getName();
- Map<RGBPixelleComponent, String> algorithm = getAlgorithms();
+ Map<PixelleComponent, String> algorithm = getAlgorithms(imageType);
AlgorithmArchiver archiver = AlgorithmArchiver.getArchiver();
- archiver.addAlgorithm(group, name, algorithm);
+ archiver.addAlgorithm(imageType, group, name, algorithm);
archiver.save();
}
}
@@ -338,9 +343,10 @@
ok.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
- Map<RGBPixelleComponent, String> algorithm = getAlgorithms();
+ ImageType imageType = getImageType();
+ Map<PixelleComponent, String> algorithm = getAlgorithms(imageType);
AlgorithmArchiver archiver = AlgorithmArchiver.getArchiver();
- archiver.setCurrent(algorithm);
+ archiver.setCurrent(imageType, algorithm);
archiver.save();
clickedOK = true;
@@ -356,7 +362,7 @@
reset.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
- for (RGBPixelleComponent comp : RGBPixelleComponent.values()) {
+ for (PixelleComponent comp : PixelleComponent.gsValues()) {
rgbEditor.get(comp).setText(PixelleBundle.getString("formula." + comp.name().toLowerCase()));
}
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xml
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xml 2008-11-20 06:39:17 UTC (rev 204)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xml 2008-11-20 07:18:44 UTC (rev 205)
@@ -21,74 +21,73 @@
<algorithms xmlns="http://pixelle.mebigfatguy.com/0.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="/com/mebigfatguy/pixelle/resources/algorithms.xsd">
- <group name="Separations">
- <algorithm name="cyan">
- <component name="red">
- (255 - p[x,y].r) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
- </component>
- <component name="green">
- (255 - p[x,y].r) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
- </component>
- <component name="blue">
- (255 - p[x,y].r) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
- </component>
- <component name="transparency">
- 255
- </component>
- <component name="selection">
- 0
- </component>
- </algorithm>
- <algorithm name="magenta">
- <component name="red">
- (255 - p[x,y].g) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
- </component>
- <component name="green">
- (255 - p[x,y].g) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
- </component>
- <component name="blue">
- (255 - p[x,y].g) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
- </component>
- <component name="transparency">
- 255
- </component>
- <component name="selection">
- 0
- </component>
- </algorithm>
- <algorithm name="yellow">
- <component name="red">
- (255 - p[x,y].b) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
- </component>
- <component name="green">
- (255 - p[x,y].b) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
- </component>
- <component name="blue">
- (255 - p[x,y].b) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
- </component>
- <component name="transparency">
- 255
- </component>
- <component name="selection">
- 0
- </component>
- </algorithm>
- <algorithm name="black">
- <component name="red">
- min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
- </component>
- <component name="green">
- min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
- </component>
- <component name="blue">
- min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
- </component>
- <component name="transparency">
- 255
- </component>
- <component name="selection">
- 0
- </component>
- </algorithm>
- </group>
+ <type name="RGB">
+ <group name="Blends">
+ <algorithm name="linear">
+ <component name="red">
+ (x * 255) / width
+ </component>
+ <component name="green">
+ (y * 255) / height
+ </component>
+ <component name="blue">
+ ((width - x) * 255) / width
+ </component>
+ <component name="transparency">
+ 255
+ </component>
+ <component name="selection">
+ 0
+ </component>
+ </algorithm>
+ </group>
+ </type>
+ <type name="Grayscale">
+ <group name="Separations">
+ <algorithm name="cyan">
+ <component name="black">
+ (255 - p[x,y].r) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
+ </component>
+ <component name="transparency">
+ 255
+ </component>
+ <component name="selection">
+ 0
+ </component>
+ </algorithm>
+ <algorithm name="magenta">
+ <component name="black">
+ (255 - p[x,y].g) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
+ </component>
+ <component name="transparency">
+ 255
+ </component>
+ <component name="selection">
+ 0
+ </component>
+ </algorithm>
+ <algorithm name="yellow">
+ <component name="black">
+ (255 - p[x,y].b) - min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
+ </component>
+ <component name="transparency">
+ 255
+ </component>
+ <component name="selection">
+ 0
+ </component>
+ </algorithm>
+ <algorithm name="black">
+ <component name="black">
+ min(min(255 - p[x,y].r, 255 - p[x,y].g), 255 - p[x,y].b)
+ </component>
+ <component name="transparency">
+ 255
+ </component>
+ <component name="selection">
+ 0
+ </component>
+ </algorithm>
+ </group>
+ </type>
</algorithms>
\ No newline at end of file
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xsd
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xsd 2008-11-20 06:39:17 UTC (rev 204)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/resources/algorithms.xsd 2008-11-20 07:18:44 UTC (rev 205)
@@ -4,10 +4,22 @@
xmlns="http://pixelle.mebigfatguy.com/0.1.0"
elementFormDefault="qualified">
<xsd:complexType name="AlgorithmsClass">
+ <xsd:sequence>
+ <xsd:element maxOccurs="2" minOccurs="2" name="type" type="TypeClass"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="TypeClass">
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="group" type="GroupClass"/>
</xsd:sequence>
+ <xsd:attribute name="name" type="TypeNameClass" use="required"/>
</xsd:complexType>
+ <xsd:simpleType name="TypeNameClass">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="RGB"/>
+ <xsd:enumeration value="Grayscale"/>
+ </xsd:restriction>
+ </xsd:simpleType>
<xsd:complexType name="GroupClass">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="algorithm" type="AlgorithmClass"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-20 06:39:19
|
Revision: 204
http://pixelle.svn.sourceforge.net/pixelle/?rev=204&view=rev
Author: dbrosius
Date: 2008-11-20 06:39:17 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
Removed Paths:
-------------
trunk/pixelle/src/com/mebigfatguy/pixelle/GrayscalePixelleComponent.java
Deleted: trunk/pixelle/src/com/mebigfatguy/pixelle/GrayscalePixelleComponent.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/GrayscalePixelleComponent.java 2008-11-20 06:39:03 UTC (rev 203)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/GrayscalePixelleComponent.java 2008-11-20 06:39:17 UTC (rev 204)
@@ -1,47 +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;
-
-/**
- * an enum that represents a part of a grayscale bitmap
- */
-public enum GrayscalePixelleComponent {
- /** the black component of a pixel */
- BLACK('k', 0),
- /** the transparency component of a pixel */
- TRANSPARENCY('t', 3),
- /** the selection status of a pixel */
- SELECTION('s', -1);
-
- private char pixelSpec;
- private int compOffset;
-
- GrayscalePixelleComponent(char c, int offset) {
- pixelSpec = c;
- compOffset = offset;
- }
-
- public char getPixelSpec() {
- return pixelSpec;
- }
-
- public int getComponentOffset() {
- return compOffset;
- }
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-20 06:39:05
|
Revision: 203
http://pixelle.svn.sourceforge.net/pixelle/?rev=203&view=rev
Author: dbrosius
Date: 2008-11-20 06:39:03 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
Removed Paths:
-------------
trunk/pixelle/src/com/mebigfatguy/pixelle/RGBPixelleComponent.java
Deleted: trunk/pixelle/src/com/mebigfatguy/pixelle/RGBPixelleComponent.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/RGBPixelleComponent.java 2008-11-20 06:37:16 UTC (rev 202)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/RGBPixelleComponent.java 2008-11-20 06:39:03 UTC (rev 203)
@@ -1,51 +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;
-
-/**
- * an enum that represents a part of an rgb bitmap
- */
-public enum RGBPixelleComponent {
- /** the red component of a pixel */
- RED('r', 0),
- /** the green component of a pixel */
- GREEN('g', 1),
- /** the blue component of a pixel */
- BLUE('b', 2),
- /** the transparency component of a pixel */
- TRANSPARENCY('t', 3),
- /** the selection status of a pixel */
- SELECTION('s', -1);
-
- private char pixelSpec;
- private int compOffset;
-
- RGBPixelleComponent(char c, int offset) {
- pixelSpec = c;
- compOffset = offset;
- }
-
- public char getPixelSpec() {
- return pixelSpec;
- }
-
- public int getComponentOffset() {
- return compOffset;
- }
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-20 06:37:18
|
Revision: 202
http://pixelle.svn.sourceforge.net/pixelle/?rev=202&view=rev
Author: dbrosius
Date: 2008-11-20 06:37:16 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
go back to one PixelleComponent
Added Paths:
-----------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleComponent.java
Copied: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleComponent.java (from rev 199, trunk/pixelle/src/com/mebigfatguy/pixelle/RGBPixelleComponent.java)
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleComponent.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleComponent.java 2008-11-20 06:37:16 UTC (rev 202)
@@ -0,0 +1,47 @@
+/*
+ * 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;
+
+/**
+ * an enum that represents a part of an rgb bitmap
+ */
+public enum PixelleComponent {
+ /** the red component of a pixel */
+ RED('r'),
+ /** the green component of a pixel */
+ GREEN('g'),
+ /** the blue component of a pixel */
+ BLUE('b'),
+ /** the black component of a pixel */
+ BLACK('k'),
+ /** the transparency component of a pixel */
+ TRANSPARENCY('t'),
+ /** the selection status of a pixel */
+ SELECTION('s');
+
+ private char pixelSpec;
+
+ PixelleComponent(char c) {
+ pixelSpec = c;
+ }
+
+ public char getPixelSpec() {
+ return pixelSpec;
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-20 06:18:22
|
Revision: 201
http://pixelle.svn.sourceforge.net/pixelle/?rev=201&view=rev
Author: dbrosius
Date: 2008-11-20 06:18:19 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
split out to RGB and GS
Removed Paths:
-------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleComponent.java
Deleted: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleComponent.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleComponent.java 2008-11-20 06:16:41 UTC (rev 200)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleComponent.java 2008-11-20 06:18:19 UTC (rev 201)
@@ -1,51 +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;
-
-/**
- * an enum that represents a part of a bitmap
- */
-public enum PixelleComponent {
- /** the red component of a pixel */
- RED('r', 0),
- /** the green component of a pixel */
- GREEN('g', 1),
- /** the blue component of a pixel */
- BLUE('b', 2),
- /** the transparency component of a pixel */
- TRANSPARENCY('t', 3),
- /** the selection status of a pixel */
- 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;
- }
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-20 06:16:43
|
Revision: 200
http://pixelle.svn.sourceforge.net/pixelle/?rev=200&view=rev
Author: dbrosius
Date: 2008-11-20 06:16:41 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
initial split out of RGB and GS PixelleComponent
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-11-20 06:07:08 UTC (rev 199)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/AlgorithmArchiver.java 2008-11-20 06:16:41 UTC (rev 200)
@@ -62,12 +62,12 @@
private static AlgorithmArchiver archiver = new AlgorithmArchiver();
- private Map<String, Map<String, Map<PixelleComponent, String>>> systemAlgorithms;
- private Map<String, Map<String, Map<PixelleComponent, String>>> userAlgorithms;
+ private final Map<String, Map<String, Map<RGBPixelleComponent, String>>> systemAlgorithms;
+ private final Map<String, Map<String, Map<RGBPixelleComponent, String>>> userAlgorithms;
private AlgorithmArchiver() {
- systemAlgorithms = new HashMap<String, Map<String, Map<PixelleComponent, String>>>();
- userAlgorithms = new HashMap<String, Map<String, Map<PixelleComponent, String>>>();
+ systemAlgorithms = new HashMap<String, Map<String, Map<RGBPixelleComponent, String>>>();
+ userAlgorithms = new HashMap<String, Map<String, Map<RGBPixelleComponent, String>>>();
loadSystemAlgorithms();
loadUserAlgorithms();
}
@@ -76,7 +76,7 @@
return archiver;
}
- public JPopupMenu getAlgorithmDisplayPopup(ActionListener l) {
+ public JPopupMenu getAlgorithmDisplayPopup(ImageType type, ActionListener l) {
JPopupMenu m = new JPopupMenu(PixelleBundle.getString(PixelleBundle.PIXEL_ALGORITHM));
populateMenuAlgorithms(m, systemAlgorithms, l);
populateMenuAlgorithms(m, userAlgorithms, l);
@@ -84,8 +84,8 @@
return m;
}
- private void populateMenuAlgorithms(JPopupMenu menu, Map<String, Map<String, Map<PixelleComponent, String>>> algorithms, ActionListener l) {
- for (final Map.Entry<String, Map<String, Map<PixelleComponent, String>>> entry : algorithms.entrySet()) {
+ private void populateMenuAlgorithms(JPopupMenu menu, Map<String, Map<String, Map<RGBPixelleComponent, String>>> algorithms, ActionListener l) {
+ for (final Map.Entry<String, Map<String, Map<RGBPixelleComponent, String>>> entry : algorithms.entrySet()) {
String groupName = entry.getKey();
if (!CURRENT.equals(groupName)) {
JMenu group = new JMenu(groupName);
@@ -100,10 +100,10 @@
}
}
- public Map<PixelleComponent, String> getAlgorithm(String groupName, String algorithmName) {
- Map<String, Map<PixelleComponent, String>> group = systemAlgorithms.get(groupName);
+ public Map<? extends Enum, String> getAlgorithm(ImageType type, String groupName, String algorithmName) {
+ Map<String, Map<RGBPixelleComponent, String>> group = systemAlgorithms.get(groupName);
if (group != null) {
- Map<PixelleComponent, String> algo = group.get(algorithmName);
+ Map<RGBPixelleComponent, String> algo = group.get(algorithmName);
if (algo != null)
return algo;
}
@@ -113,7 +113,7 @@
throw new IllegalArgumentException("Unknown group name " + groupName);
}
- Map<PixelleComponent, String> algo = group.get(algorithmName);
+ Map<RGBPixelleComponent, String> algo = group.get(algorithmName);
if (algo == null) {
throw new IllegalArgumentException("Unknown algorithm name " + algorithmName);
}
@@ -126,26 +126,26 @@
return userAlgorithms.keySet().toArray(new String[userAlgorithms.size()]);
}
- public void addAlgorithm(String groupName, String algorithmName, Map<PixelleComponent, String> algorithm) {
- Map<String, Map<PixelleComponent, String>> group = userAlgorithms.get(groupName);
+ public void addAlgorithm(String groupName, String algorithmName, Map<RGBPixelleComponent, String> algorithm) {
+ Map<String, Map<RGBPixelleComponent, String>> group = userAlgorithms.get(groupName);
if (group == null) {
- group = new HashMap<String, Map<PixelleComponent, String>>();
+ group = new HashMap<String, Map<RGBPixelleComponent, String>>();
userAlgorithms.put(groupName, group);
}
- group.put(algorithmName, new HashMap<PixelleComponent, String>(algorithm));
+ group.put(algorithmName, new HashMap<RGBPixelleComponent, String>(algorithm));
}
- public void setCurrent(Map<PixelleComponent, String> algorithm) {
+ public void setCurrent(Map<RGBPixelleComponent, String> algorithm) {
addAlgorithm(AlgorithmArchiver.CURRENT, AlgorithmArchiver.CURRENT, algorithm);
}
- public Map<PixelleComponent, String> getCurrent() {
- return getAlgorithm(AlgorithmArchiver.CURRENT, AlgorithmArchiver.CURRENT);
+ public Map<? extends Enum, String> getCurrent(ImageType type) {
+ return getAlgorithm(type, AlgorithmArchiver.CURRENT, AlgorithmArchiver.CURRENT);
}
public void removeAlgorithm(String group, String name) {
- Map<String, Map<PixelleComponent, String>> algoGroup = userAlgorithms.get(group);
+ Map<String, Map<RGBPixelleComponent, String>> algoGroup = userAlgorithms.get(group);
if (algoGroup != null) {
algoGroup.remove(name);
}
@@ -197,7 +197,7 @@
}
- private void writeAlgorithms(OutputStream is, Map<String, Map<String, Map<PixelleComponent, String>>> algorithms) throws IOException {
+ private void writeAlgorithms(OutputStream is, Map<String, Map<String, Map<RGBPixelleComponent, String>>> algorithms) throws IOException {
PrintWriter pw = null;
try {
pw = new PrintWriter(new OutputStreamWriter(is));
@@ -205,13 +205,13 @@
pw.println(" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'");
pw.println(" xsi:schemaLocation='/com/mebigfatguy/pixelle/resources/algorithms.xsd'>");
- for (Map.Entry<String, Map<String, Map<PixelleComponent, String>>> group : algorithms.entrySet()) {
+ for (Map.Entry<String, Map<String, Map<RGBPixelleComponent, String>>> group : algorithms.entrySet()) {
pw.println(" <group name='" + group.getKey() + "'>");
- for (Map.Entry<String, Map<PixelleComponent, String>> algorithm : group.getValue().entrySet()) {
+ for (Map.Entry<String, Map<RGBPixelleComponent, String>> algorithm : group.getValue().entrySet()) {
pw.println(" <algorithm name='" + algorithm.getKey() + "'>");
- for (Map.Entry<PixelleComponent, String> component : algorithm.getValue().entrySet()) {
+ for (Map.Entry<RGBPixelleComponent, String> component : algorithm.getValue().entrySet()) {
pw.println(" <component name='" + component.getKey().name().toLowerCase() + "'>");
pw.println(" " + component.getValue());
pw.println(" </component>");
@@ -228,21 +228,21 @@
}
}
- private void parseAlgorithms(InputStream is, final Map<String, Map<String, Map<PixelleComponent, String>>> algorithms) throws IOException, SAXException {
+ private void parseAlgorithms(InputStream is, final Map<String, Map<String, Map<RGBPixelleComponent, String>>> algorithms) throws IOException, SAXException {
XMLReader r = XMLReaderFactory.createXMLReader();
r.setContentHandler(new DefaultHandler() {
- Map<String, Map<PixelleComponent, String>> currentGroup = null;
- Map<PixelleComponent, String> currentAlgorithm = null;
+ Map<String, Map<RGBPixelleComponent, String>> currentGroup = null;
+ Map<RGBPixelleComponent, String> currentAlgorithm = null;
String currentComponentName = null;
StringBuilder algorithmText = null;
@Override
public void startElement(String uri, String localName, String qName, Attributes atts) {
if (GROUP.equals(localName)) {
- currentGroup = new HashMap<String, Map<PixelleComponent, String>>();
+ currentGroup = new HashMap<String, Map<RGBPixelleComponent, String>>();
algorithms.put(atts.getValue(NAME), currentGroup);
} else if (ALGORITHM.equals(localName)) {
- currentAlgorithm = new EnumMap<PixelleComponent, String>(PixelleComponent.class);
+ currentAlgorithm = new EnumMap<RGBPixelleComponent, String>(RGBPixelleComponent.class);
currentGroup.put(atts.getValue(NAME), currentAlgorithm);
} else if (COMPONENT.equals(localName)) {
currentComponentName = atts.getValue(NAME);
@@ -260,7 +260,7 @@
@Override
public void endElement(String uri, String localName, String qName) {
if (COMPONENT.equals(localName)) {
- PixelleComponent pc = PixelleComponent.valueOf(currentComponentName.toUpperCase());
+ RGBPixelleComponent pc = RGBPixelleComponent.valueOf(currentComponentName.toUpperCase());
currentAlgorithm.put(pc, algorithmText.toString().trim());
algorithmText = null;
currentComponentName = null;
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2008-11-20 06:07:08 UTC (rev 199)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2008-11-20 06:16:41 UTC (rev 200)
@@ -60,6 +60,7 @@
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 BLACK_FORMULA = "formula.black";
public static final String TRANSPARENCY_FORMULA = "formula.transparency";
public static final String SELECTION_FORMULA = "formula.selection";
public static final String PIXEL_ALGORITHMS = "title.algorithms";
@@ -68,6 +69,7 @@
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 BLACK_LABEL = "label.black";
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";
@@ -85,6 +87,8 @@
public static final String Y = "label.y";
public static final String COLOR = "label.color";
public static final String INSPECTOR_TOOLTIP = "tooltip.inspector";
+ public static final String RGB = "label.rgb";
+ public static final String GRAYSCALE = "label.grayscale";
private static ResourceBundle rb = ResourceBundle.getBundle("com/mebigfatguy/pixelle/resources/pixelle");
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-11-20 06:07:08 UTC (rev 199)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-11-20 06:16:41 UTC (rev 200)
@@ -40,15 +40,15 @@
*/
public class PixelleTransformer {
- private PixelleImage srcImage;
- private Map<PixelleComponent, String> algorithms = null;
+ private final PixelleImage srcImage;
+ private Map<RGBPixelleComponent, String> algorithms = null;
/**
* constructions a transformer given a source bitmap and algorithms
* @param image the source image
* @param algos the algorithms for the color components
*/
- public PixelleTransformer(PixelleImage image, Map<PixelleComponent, String> algos) {
+ public PixelleTransformer(PixelleImage image, Map<RGBPixelleComponent, String> algos) {
srcImage = image;
algorithms = algos;
}
@@ -58,13 +58,13 @@
*
* @return a set of transformation algorithms
*/
- public static Map<PixelleComponent, String> getSampleTransform() {
- Map<PixelleComponent, String> algorithms = new EnumMap<PixelleComponent, String>(PixelleComponent.class);
- algorithms.put(PixelleComponent.RED, "x");
- algorithms.put(PixelleComponent.GREEN, "y");
- algorithms.put(PixelleComponent.BLUE, "abs((width/2) - x)");
- algorithms.put(PixelleComponent.TRANSPARENCY, "((x < 10) || (x >= (width - 10)) || (y < 10) || (y >= (height - 10))) ? 180 : 255");
- algorithms.put(PixelleComponent.SELECTION, "0");
+ public static Map<RGBPixelleComponent, String> getSampleTransform() {
+ Map<RGBPixelleComponent, String> algorithms = new EnumMap<RGBPixelleComponent, String>(RGBPixelleComponent.class);
+ algorithms.put(RGBPixelleComponent.RED, "x");
+ algorithms.put(RGBPixelleComponent.GREEN, "y");
+ algorithms.put(RGBPixelleComponent.BLUE, "abs((width/2) - x)");
+ algorithms.put(RGBPixelleComponent.TRANSPARENCY, "((x < 10) || (x >= (width - 10)) || (y < 10) || (y >= (height - 10))) ? 180 : 255");
+ algorithms.put(RGBPixelleComponent.SELECTION, "0");
return algorithms;
}
/**
@@ -94,7 +94,7 @@
}
});
- for (Map.Entry<PixelleComponent, String> entry : algorithms.entrySet()) {
+ for (Map.Entry<RGBPixelleComponent, String> entry : algorithms.entrySet()) {
currentComponent = entry.getKey().name();
currentAlgorithm = entry.getValue();
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-11-20 06:07:08 UTC (rev 199)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-11-20 06:16:41 UTC (rev 200)
@@ -39,45 +39,72 @@
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
+import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import com.mebigfatguy.pixelle.AlgorithmArchiver;
+import com.mebigfatguy.pixelle.GrayscalePixelleComponent;
+import com.mebigfatguy.pixelle.ImageType;
import com.mebigfatguy.pixelle.PixelleBundle;
-import com.mebigfatguy.pixelle.PixelleComponent;
import com.mebigfatguy.pixelle.PixelleFrame;
+import com.mebigfatguy.pixelle.RGBPixelleComponent;
import com.mebigfatguy.pixelle.utils.GuiUtils;
public class PixelleExpressionDialog extends JDialog {
private static final long serialVersionUID = -4273352119079307059L;
- private final Map<PixelleComponent, JLabel> lhs = new EnumMap<PixelleComponent, JLabel>(PixelleComponent.class);
+ private final Map<RGBPixelleComponent, JLabel> rgbLHS = new EnumMap<RGBPixelleComponent, JLabel>(RGBPixelleComponent.class);
{
- for (PixelleComponent comp : PixelleComponent.values()) {
- lhs.put(comp, new JLabel(PixelleBundle.getString("formula." + comp.name().toLowerCase()) + " = "));
+ for (RGBPixelleComponent comp : RGBPixelleComponent.values()) {
+ rgbLHS.put(comp, new JLabel(PixelleBundle.getString("formula." + comp.name().toLowerCase()) + " = "));
}
};
- private final Map<PixelleComponent, JTextField> editor = new EnumMap<PixelleComponent, JTextField>(PixelleComponent.class);
+ private final Map<RGBPixelleComponent, JTextField> rgbEditor = new EnumMap<RGBPixelleComponent, JTextField>(RGBPixelleComponent.class);
{
- for (PixelleComponent comp : PixelleComponent.values()) {
- editor.put(comp, new JTextField(PixelleBundle.getString("formula." + comp.name().toLowerCase()), 50));
+ for (RGBPixelleComponent comp : RGBPixelleComponent.values()) {
+ rgbEditor.put(comp, new JTextField(PixelleBundle.getString("formula." + comp.name().toLowerCase()), 50));
}
};
- private final Map<PixelleComponent, JLabel> labels = new EnumMap<PixelleComponent, JLabel>(PixelleComponent.class);
+ private final Map<RGBPixelleComponent, JLabel> rgbLabels = new EnumMap<RGBPixelleComponent, JLabel>(RGBPixelleComponent.class);
{
- for (PixelleComponent comp : PixelleComponent.values()) {
- labels.put(comp, new JLabel(PixelleBundle.getString("label." + comp.name().toLowerCase())));
+ for (RGBPixelleComponent comp : RGBPixelleComponent.values()) {
+ rgbLabels.put(comp, new JLabel(PixelleBundle.getString("label." + comp.name().toLowerCase())));
}
};
+ private final Map<GrayscalePixelleComponent, JLabel> gsLHS = new EnumMap<GrayscalePixelleComponent, JLabel>(GrayscalePixelleComponent.class);
+ {
+ for (GrayscalePixelleComponent comp : GrayscalePixelleComponent.values()) {
+ gsLHS.put(comp, new JLabel(PixelleBundle.getString("formula." + comp.name().toLowerCase()) + " = "));
+ }
+ };
+
+ private final Map<GrayscalePixelleComponent, JTextField> gsEditor = new EnumMap<GrayscalePixelleComponent, JTextField>(GrayscalePixelleComponent.class);
+ {
+ for (GrayscalePixelleComponent comp : GrayscalePixelleComponent.values()) {
+ gsEditor.put(comp, new JTextField(PixelleBundle.getString("formula." + comp.name().toLowerCase()), 50));
+ }
+ };
+
+ private final Map<GrayscalePixelleComponent, JLabel> gsLabels = new EnumMap<GrayscalePixelleComponent, JLabel>(GrayscalePixelleComponent.class);
+ {
+ for (GrayscalePixelleComponent comp : GrayscalePixelleComponent.values()) {
+ gsLabels.put(comp, new JLabel(PixelleBundle.getString("label." + comp.name().toLowerCase())));
+ }
+ };
+
+
PixelleFrame frame;
JButton ok;
JButton cancel;
JButton reset;
- JTextField selectedAlgorithm;
- JPopupMenu savedAlgorithms;
+ JTextField selectedRGBAlgorithm;
+ JPopupMenu savedRGBAlgorithms;
+ JTextField selectedGSAlgorithm;
+ JPopupMenu savedGSAlgorithms;
JButton save;
JButton delete;
@@ -94,10 +121,10 @@
return clickedOK;
}
- public Map<PixelleComponent, String> getAlgorithms() {
- Map<PixelleComponent, String> algorithms = new EnumMap<PixelleComponent, String>(PixelleComponent.class);
- for (PixelleComponent comp : PixelleComponent.values()) {
- algorithms.put(comp, editor.get(comp).getText());
+ public Map<RGBPixelleComponent, String> getAlgorithms() {
+ Map<RGBPixelleComponent, String> algorithms = new EnumMap<RGBPixelleComponent, String>(RGBPixelleComponent.class);
+ for (RGBPixelleComponent comp : RGBPixelleComponent.values()) {
+ algorithms.put(comp, rgbEditor.get(comp).getText());
}
return algorithms;
}
@@ -114,6 +141,38 @@
cp.setLayout(new BorderLayout(4, 4));
+ JTabbedPane tabbedPane = new JTabbedPane();
+ cp.add(tabbedPane, BorderLayout.CENTER);
+
+ tabbedPane.add(PixelleBundle.getString(PixelleBundle.RGB), buildRGBPane());
+ tabbedPane.add(PixelleBundle.getString(PixelleBundle.GRAYSCALE), buildGrayscalePanel());
+
+ {
+ JPanel ctlPanel = new JPanel();
+ ctlPanel.setLayout(new BoxLayout(ctlPanel, BoxLayout.X_AXIS));
+ ctlPanel.add(Box.createHorizontalStrut(10));
+ ctlPanel.add(reset);
+ ctlPanel.add(Box.createHorizontalStrut(10));
+ ctlPanel.add(save);
+ ctlPanel.add(Box.createHorizontalStrut(10));
+ ctlPanel.add(delete);
+ ctlPanel.add(Box.createHorizontalGlue());
+ ctlPanel.add(ok);
+ ctlPanel.add(Box.createHorizontalStrut(10));
+ ctlPanel.add(cancel);
+ ctlPanel.add(Box.createHorizontalStrut(10));
+ ctlPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
+ cp.add(ctlPanel, BorderLayout.SOUTH);
+ }
+
+ pack();
+ }
+
+ private JPanel buildRGBPane() {
+
+ JPanel rgbPanel = new JPanel();
+ rgbPanel.setLayout(new BoxLayout(rgbPanel, BoxLayout.Y_AXIS));
+
{
JPanel optionsPanel = new JPanel();
optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.X_AXIS));
@@ -121,91 +180,142 @@
JLabel l = new JLabel(PixelleBundle.getString(PixelleBundle.PIXEL_ALGORITHM));
optionsPanel.add(l);
optionsPanel.add(Box.createHorizontalStrut(10));
- selectedAlgorithm = new JTextField(PixelleBundle.getString(PixelleBundle.UNTITLED));
- selectedAlgorithm.setEditable(false);
- optionsPanel.add(selectedAlgorithm);
+ selectedRGBAlgorithm = new JTextField(PixelleBundle.getString(PixelleBundle.UNTITLED));
+ selectedRGBAlgorithm.setEditable(false);
+ optionsPanel.add(selectedRGBAlgorithm);
optionsPanel.add(Box.createHorizontalStrut(10));
- savedAlgorithms = AlgorithmArchiver.getArchiver().getAlgorithmDisplayPopup(new ActionListener() {
+ savedRGBAlgorithms = AlgorithmArchiver.getArchiver().getAlgorithmDisplayPopup(ImageType.RGB, new ActionListener() {
public void actionPerformed(ActionEvent ae) {
JMenuItem item = (JMenuItem)ae.getSource();
String algorithmName = item.getText();
String groupName = (String)item.getClientProperty(AlgorithmArchiver.NAME);
- selectedAlgorithm.setText(algorithmName);
- Map<PixelleComponent, String> algorithms = AlgorithmArchiver.getArchiver().getAlgorithm(groupName, algorithmName);
- for (PixelleComponent comp : PixelleComponent.values()) {
- editor.get(comp).setText(algorithms.get(comp));
+ selectedRGBAlgorithm.setText(algorithmName);
+ Map<RGBPixelleComponent, String> algorithms = (Map<RGBPixelleComponent, String>)AlgorithmArchiver.getArchiver().getAlgorithm(ImageType.RGB, groupName, algorithmName);
+ for (RGBPixelleComponent comp : RGBPixelleComponent.values()) {
+ rgbEditor.get(comp).setText(algorithms.get(comp));
}
}
});
try {
- Map<PixelleComponent, String> algorithms = AlgorithmArchiver.getArchiver().getCurrent();
+ Map<RGBPixelleComponent, String> algorithms = (Map<RGBPixelleComponent, String>)AlgorithmArchiver.getArchiver().getCurrent(ImageType.RGB);
if (algorithms != null) {
- for (PixelleComponent comp : PixelleComponent.values()) {
- editor.get(comp).setText(algorithms.get(comp));
+ for (RGBPixelleComponent comp : RGBPixelleComponent.values()) {
+ rgbEditor.get(comp).setText(algorithms.get(comp));
}
}
} catch (IllegalArgumentException iae) {
}
- savedAlgorithms.setInvoker(selectedAlgorithm);
- optionsPanel.add(savedAlgorithms);
+ savedRGBAlgorithms.setInvoker(selectedRGBAlgorithm);
+ optionsPanel.add(savedRGBAlgorithms);
optionsPanel.add(Box.createHorizontalGlue());
optionsPanel.setBorder(BorderFactory.createEmptyBorder(10, 4, 5, 4));
- cp.add(optionsPanel, BorderLayout.NORTH);
+ rgbPanel.add(optionsPanel);
}
{
JPanel algoPanel = new JPanel();
algoPanel.setLayout(new GridLayout(5, 1));
- GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, lhs.values().toArray(new JComponent[lhs.size()]));
- GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, editor.values().toArray(new JComponent[lhs.size()]));
- GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, labels.values().toArray(new JComponent[lhs.size()]));
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, rgbLHS.values().toArray(new JComponent[rgbLHS.size()]));
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, rgbEditor.values().toArray(new JComponent[rgbLHS.size()]));
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, rgbLabels.values().toArray(new JComponent[rgbLHS.size()]));
- for (PixelleComponent comp : PixelleComponent.values()) {
+ for (RGBPixelleComponent comp : RGBPixelleComponent.values()) {
JPanel p = new JPanel();
p.setLayout(new BorderLayout(10, 10));
- p.add(lhs.get(comp), BorderLayout.WEST);
- p.add(editor.get(comp), BorderLayout.CENTER);
- p.add(labels.get(comp), BorderLayout.EAST);
- labels.get(comp).setLabelFor(editor.get(comp));
+ p.add(rgbLHS.get(comp), BorderLayout.WEST);
+ p.add(rgbEditor.get(comp), BorderLayout.CENTER);
+ p.add(rgbLabels.get(comp), BorderLayout.EAST);
+ rgbLabels.get(comp).setLabelFor(rgbEditor.get(comp));
p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
algoPanel.add(p);
}
- cp.add(algoPanel, BorderLayout.CENTER);
+ rgbPanel.add(algoPanel);
}
- {
- JPanel ctlPanel = new JPanel();
- ctlPanel.setLayout(new BoxLayout(ctlPanel, BoxLayout.X_AXIS));
- ctlPanel.add(Box.createHorizontalStrut(10));
- ctlPanel.add(reset);
- ctlPanel.add(Box.createHorizontalStrut(10));
- ctlPanel.add(save);
- ctlPanel.add(Box.createHorizontalStrut(10));
- ctlPanel.add(delete);
- ctlPanel.add(Box.createHorizontalGlue());
- ctlPanel.add(ok);
- ctlPanel.add(Box.createHorizontalStrut(10));
- ctlPanel.add(cancel);
- ctlPanel.add(Box.createHorizontalStrut(10));
- ctlPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
- cp.add(ctlPanel, BorderLayout.SOUTH);
+ return rgbPanel;
+ }
+
+ private JPanel buildGrayscalePanel() {
+ JPanel gsPanel = new JPanel();
+ gsPanel.setLayout(new BoxLayout(gsPanel, BoxLayout.Y_AXIS));
+
+ {
+ JPanel optionsPanel = new JPanel();
+ optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.X_AXIS));
+ optionsPanel.add(Box.createHorizontalGlue());
+ JLabel l = new JLabel(PixelleBundle.getString(PixelleBundle.PIXEL_ALGORITHM));
+ optionsPanel.add(l);
+ optionsPanel.add(Box.createHorizontalStrut(10));
+ selectedGSAlgorithm = new JTextField(PixelleBundle.getString(PixelleBundle.UNTITLED));
+ selectedGSAlgorithm.setEditable(false);
+ optionsPanel.add(selectedGSAlgorithm);
+ optionsPanel.add(Box.createHorizontalStrut(10));
+ savedGSAlgorithms = AlgorithmArchiver.getArchiver().getAlgorithmDisplayPopup(ImageType.Grayscale, new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ JMenuItem item = (JMenuItem)ae.getSource();
+ String algorithmName = item.getText();
+ String groupName = (String)item.getClientProperty(AlgorithmArchiver.NAME);
+ selectedGSAlgorithm.setText(algorithmName);
+ Map<GrayscalePixelleComponent, String> algorithms = (Map<GrayscalePixelleComponent, String>)AlgorithmArchiver.getArchiver().getAlgorithm(ImageType.Grayscale, groupName, algorithmName);
+ for (GrayscalePixelleComponent comp : GrayscalePixelleComponent.values()) {
+ gsEditor.get(comp).setText(algorithms.get(comp));
+ }
+ }
+ });
+ try {
+ Map<GrayscalePixelleComponent, String> algorithms = (Map<GrayscalePixelleComponent, String>)AlgorithmArchiver.getArchiver().getCurrent(ImageType.Grayscale);
+ if (algorithms != null) {
+ for (GrayscalePixelleComponent comp : GrayscalePixelleComponent.values()) {
+ gsEditor.get(comp).setText(algorithms.get(comp));
+ }
+ }
+ } catch (IllegalArgumentException iae) {
+ }
+
+ savedGSAlgorithms.setInvoker(selectedGSAlgorithm);
+ optionsPanel.add(savedGSAlgorithms);
+ optionsPanel.add(Box.createHorizontalGlue());
+ optionsPanel.setBorder(BorderFactory.createEmptyBorder(10, 4, 5, 4));
+ gsPanel.add(optionsPanel);
}
- pack();
+ {
+ JPanel algoPanel = new JPanel();
+ algoPanel.setLayout(new GridLayout(5, 1));
+
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, gsLHS.values().toArray(new JComponent[gsLHS.size()]));
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, gsEditor.values().toArray(new JComponent[gsLHS.size()]));
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, gsLabels.values().toArray(new JComponent[gsLHS.size()]));
+
+ for (GrayscalePixelleComponent comp : GrayscalePixelleComponent.values()) {
+ JPanel p = new JPanel();
+ p.setLayout(new BorderLayout(10, 10));
+ p.add(gsLHS.get(comp), BorderLayout.WEST);
+ p.add(gsEditor.get(comp), BorderLayout.CENTER);
+ p.add(gsLabels.get(comp), BorderLayout.EAST);
+ gsLabels.get(comp).setLabelFor(gsEditor.get(comp));
+ p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
+ algoPanel.add(p);
+ }
+
+ gsPanel.add(algoPanel);
+ }
+
+ return gsPanel;
}
private void initListeners() {
getRootPane().setDefaultButton(ok);
- selectedAlgorithm.addMouseListener(new MouseAdapter() {
+ selectedRGBAlgorithm.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent me) {
- savedAlgorithms.setSize(selectedAlgorithm.getSize());
- savedAlgorithms.show(selectedAlgorithm, 0, 0);
+ savedRGBAlgorithms.setSize(selectedRGBAlgorithm.getSize());
+ savedRGBAlgorithms.show(selectedRGBAlgorithm, 0, 0);
}
});
@@ -218,7 +328,7 @@
if (dialog.isOK()) {
String group = dialog.getGroup();
String name = dialog.getName();
- Map<PixelleComponent, String> algorithm = getAlgorithms();
+ Map<RGBPixelleComponent, String> algorithm = getAlgorithms();
AlgorithmArchiver archiver = AlgorithmArchiver.getArchiver();
archiver.addAlgorithm(group, name, algorithm);
archiver.save();
@@ -228,7 +338,7 @@
ok.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
- Map<PixelleComponent, String> algorithm = getAlgorithms();
+ Map<RGBPixelleComponent, String> algorithm = getAlgorithms();
AlgorithmArchiver archiver = AlgorithmArchiver.getArchiver();
archiver.setCurrent(algorithm);
archiver.save();
@@ -246,8 +356,8 @@
reset.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
- for (PixelleComponent comp : PixelleComponent.values()) {
- editor.get(comp).setText(PixelleBundle.getString("formula." + comp.name().toLowerCase()));
+ for (RGBPixelleComponent comp : RGBPixelleComponent.values()) {
+ rgbEditor.get(comp).setText(PixelleBundle.getString("formula." + comp.name().toLowerCase()));
}
}
});
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties 2008-11-20 06:07:08 UTC (rev 199)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties 2008-11-20 06:16:41 UTC (rev 200)
@@ -55,6 +55,7 @@
formula.red = p[x,y].r
formula.green = p[x,y].g
formula.blue = p[x,y].b
+formula.black = p[x,y].k
formula.transparency = p[x,y].t
formula.selection = p[x,y].s
@@ -66,6 +67,7 @@
label.red = (Red)
label.green = (Green)
label.blue = (Blue)
+label.black = (Black)
label.transparency = (Transparency)
label.selection = (Selection)
@@ -89,3 +91,5 @@
tooltip.inspector = Click in the frame's window to freeze the inspector value, and click again to unfreeze
+label.rgb = RGB
+label.grayscale = Gray scale
\ 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-11-20 06:07:10
|
Revision: 199
http://pixelle.svn.sourceforge.net/pixelle/?rev=199&view=rev
Author: dbrosius
Date: 2008-11-20 06:07:08 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
better comment
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/RGBPixelleComponent.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/RGBPixelleComponent.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/RGBPixelleComponent.java 2008-11-20 06:06:48 UTC (rev 198)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/RGBPixelleComponent.java 2008-11-20 06:07:08 UTC (rev 199)
@@ -19,7 +19,7 @@
package com.mebigfatguy.pixelle;
/**
- * an enum that represents a part of a bitmap
+ * an enum that represents a part of an rgb bitmap
*/
public enum RGBPixelleComponent {
/** the red component of a pixel */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2008-11-20 06:06:52
|
Revision: 198
http://pixelle.svn.sourceforge.net/pixelle/?rev=198&view=rev
Author: dbrosius
Date: 2008-11-20 06:06:48 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
a pixel component spec for grayscale images
Added Paths:
-----------
trunk/pixelle/src/com/mebigfatguy/pixelle/GrayscalePixelleComponent.java
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/GrayscalePixelleComponent.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/GrayscalePixelleComponent.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/GrayscalePixelleComponent.java 2008-11-20 06:06:48 UTC (rev 198)
@@ -0,0 +1,47 @@
+/*
+ * 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;
+
+/**
+ * an enum that represents a part of a grayscale bitmap
+ */
+public enum GrayscalePixelleComponent {
+ /** the black component of a pixel */
+ BLACK('k', 0),
+ /** the transparency component of a pixel */
+ TRANSPARENCY('t', 3),
+ /** the selection status of a pixel */
+ SELECTION('s', -1);
+
+ private char pixelSpec;
+ private int compOffset;
+
+ GrayscalePixelleComponent(char c, int offset) {
+ pixelSpec = c;
+ compOffset = offset;
+ }
+
+ public char getPixelSpec() {
+ return pixelSpec;
+ }
+
+ public int getComponentOffset() {
+ return compOffset;
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/GrayscalePixelleComponent.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|