diff options
| author | bjculkin <bjculkin@WIT-9B6XG42.wvu-ad.wvu.edu> | 2018-04-26 09:14:19 -0400 |
|---|---|---|
| committer | bjculkin <bjculkin@WIT-9B6XG42.wvu-ad.wvu.edu> | 2018-04-26 09:14:19 -0400 |
| commit | a390222aeb0c5bf6982108e6fc0b492e97e43b39 (patch) | |
| tree | c2334a2e81f08952a1c79f0356a1a7459b2f5e9c /src/bjc/imgchain/pipeline | |
| parent | 8dbfbb5c87a2fa74c5e3bf829a33fc6180430e5c (diff) | |
Fix stupid pipeline bug
Diffstat (limited to 'src/bjc/imgchain/pipeline')
| -rw-r--r-- | src/bjc/imgchain/pipeline/MutablePipeline.java | 25 | ||||
| -rw-r--r-- | src/bjc/imgchain/pipeline/stages/AbstractPixelStage.java | 7 |
2 files changed, 26 insertions, 6 deletions
diff --git a/src/bjc/imgchain/pipeline/MutablePipeline.java b/src/bjc/imgchain/pipeline/MutablePipeline.java index 6272b30..d1d228d 100644 --- a/src/bjc/imgchain/pipeline/MutablePipeline.java +++ b/src/bjc/imgchain/pipeline/MutablePipeline.java @@ -1,9 +1,18 @@ package bjc.imgchain.pipeline;
+import java.awt.GridLayout;
import java.awt.Image;
+import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
+import javax.swing.ImageIcon;
+import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
+
+import bjc.imgchain.ImgChain;
+import bjc.imgchain.utils.Utils;
+
/**
* An editable {@link Pipeline}
*
@@ -28,7 +37,7 @@ public class MutablePipeline implements Pipeline { * Create a new named mutable pipeline.
*
* @param name
- * The name of the pipeline.
+ * The name of the pipeline.
*/
public MutablePipeline(String name) {
stages = new ArrayList<>();
@@ -40,9 +49,15 @@ public class MutablePipeline implements Pipeline { public Image process(Image input) {
Image proc = input;
+ int i = 1;
+
for (PipelineStage stage : stages) {
System.out.println("Applying stage " + stage.name());
+
proc = stage.process(proc);
+
+ Utils.displayImage(proc, "Pipeline Results - " + stage.name() + " - #" + i);
+
System.out.println("Applied stage " + stage.name());
}
@@ -63,7 +78,7 @@ public class MutablePipeline implements Pipeline { * Set the name of the pipeline.
*
* @param nam
- * The name of the pipeline.
+ * The name of the pipeline.
*/
public void name(String nam) {
name = nam;
@@ -73,7 +88,7 @@ public class MutablePipeline implements Pipeline { * Append a pipeline stage to the end of this pipeline.
*
* @param stag
- * The stage to add.
+ * The stage to add.
*/
public void addStage(PipelineStage stag) {
stages.add(stag);
@@ -83,7 +98,7 @@ public class MutablePipeline implements Pipeline { * Remove a pipeline stage.
*
* @param stag
- * The stage to remove.
+ * The stage to remove.
*/
public void removeStage(PipelineStage stag) {
stages.remove(stag);
@@ -93,7 +108,7 @@ public class MutablePipeline implements Pipeline { * Remove a pipeline stage by index.
*
* @param idx
- * The index of the stage to remove.
+ * The index of the stage to remove.
*/
public void removeStage(int idx) {
stages.remove(idx);
diff --git a/src/bjc/imgchain/pipeline/stages/AbstractPixelStage.java b/src/bjc/imgchain/pipeline/stages/AbstractPixelStage.java index 44e3c60..1317c12 100644 --- a/src/bjc/imgchain/pipeline/stages/AbstractPixelStage.java +++ b/src/bjc/imgchain/pipeline/stages/AbstractPixelStage.java @@ -16,10 +16,15 @@ public abstract class AbstractPixelStage extends AbstractPipelineStage { public Image process(Image inp) {
BufferedImage buf = (BufferedImage) inp;
+ //BufferedImage res = new BufferedImage(buf.getWidth(), buf.getHeight(), BufferedImage.TYPE_INT_ARGB);
+
for (int y = 0; y < buf.getHeight(); y++) {
for (int x = 0; x < buf.getWidth(); x++) {
int[] pix = Utils.toARGBQuad(buf.getRGB(x, y));
- buf.setRGB(x, y, Utils.fromARGBQuad(pix));
+
+ int[] processedPixel = processPixel(pix);
+
+ buf.setRGB(x, y, Utils.fromARGBQuad(processedPixel));
}
}
|
