[Pixelle-commit] SF.net SVN: pixelle:[297] trunk/pixelle/src/com/mebigfatguy/pixelle
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2009-07-22 06:02:49
|
Revision: 297
http://pixelle.svn.sourceforge.net/pixelle/?rev=297&view=rev
Author: dbrosius
Date: 2009-07-22 06:02:47 +0000 (Wed, 22 Jul 2009)
Log Message:
-----------
separate the selection bits from the outline used for display
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleImage.java
trunk/pixelle/src/com/mebigfatguy/pixelle/SelectionOutliner.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleImage.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleImage.java 2009-07-22 05:53:08 UTC (rev 296)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleImage.java 2009-07-22 06:02:47 UTC (rev 297)
@@ -34,7 +34,8 @@
public class PixelleImage {
private final BufferedImage image;
- private BufferedImage selection;
+ private final BufferedImage selection;
+ private final BufferedImage selectionOutline;
private final Composite composite;
public PixelleImage() {
@@ -52,7 +53,10 @@
Graphics g = selection.getGraphics();
g.setColor(Color.WHITE);
g.fillRect(0, 0, getWidth(), getHeight());
- }
+ selectionOutline = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_BYTE_BINARY, model);
+ g = selectionOutline.getGraphics();
+ g.setColor(Color.WHITE);
+ g.fillRect(0, 0, getWidth(), getHeight()); }
public BufferedImage getSaveImage() {
return image;
@@ -81,7 +85,7 @@
Composite saveComposite = g2d.getComposite();
try {
g2d.setComposite(composite);
- g.drawImage(selection, left, top, width, height, null);
+ g.drawImage(selectionOutline, left, top, width, height, null);
} finally {
g2d.setComposite(saveComposite);
}
@@ -102,6 +106,6 @@
public void finishImage() {
SelectionOutliner so = new SelectionOutliner();
- selection = so.createOutline(selection);
+ so.createOutline(selection, selectionOutline);
}
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/SelectionOutliner.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/SelectionOutliner.java 2009-07-22 05:53:08 UTC (rev 296)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/SelectionOutliner.java 2009-07-22 06:02:47 UTC (rev 297)
@@ -19,18 +19,15 @@
package com.mebigfatguy.pixelle;
import java.awt.image.BufferedImage;
-import java.awt.image.IndexColorModel;
import java.awt.image.WritableRaster;
public class SelectionOutliner {
- public BufferedImage createOutline(BufferedImage selectionImage) {
- BufferedImage outlineSelection = new BufferedImage(selectionImage.getWidth(), selectionImage.getHeight(), BufferedImage.TYPE_BYTE_BINARY, (IndexColorModel)selectionImage.getColorModel());
-
+ public void createOutline(BufferedImage selectionImage, BufferedImage selectionOutline) {
int width = selectionImage.getWidth();
int height = selectionImage.getHeight();
- WritableRaster outRaster = outlineSelection.getRaster();
+ WritableRaster outRaster = selectionOutline.getRaster();
WritableRaster inRaster = selectionImage.getRaster();
double[] pixel = new double[9];
@@ -63,6 +60,5 @@
}
}
}
- return outlineSelection;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|