[Pixelle-commit] SF.net SVN: pixelle: [24] trunk/pixelle/src/com/mebigfatguy/pixelle
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2008-06-18 04:11:53
|
Revision: 24
http://pixelle.svn.sourceforge.net/pixelle/?rev=24&view=rev
Author: dbrosius
Date: 2008-06-17 21:12:01 -0700 (Tue, 17 Jun 2008)
Log Message:
-----------
start hooking up the color components
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelComponent.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelComponent.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelComponent.java 2008-06-18 04:00:36 UTC (rev 23)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelComponent.java 2008-06-18 04:12:01 UTC (rev 24)
@@ -20,19 +20,25 @@
public enum PixelComponent {
- RED('r'),
- GREEN('g'),
- BLUE('b'),
- TRANSPARENCY('t'),
- SELECTION('s');
+ RED('r', 0),
+ GREEN('g', 1),
+ BLUE('b', 2),
+ TRANSPARENCY('t', 3),
+ SELECTION('s', -1);
private char pixelSpec;
+ private int compOffset;
- PixelComponent(char c) {
+ PixelComponent(char c, int offset) {
pixelSpec = c;
+ compOffset = offset;
}
public char getPixelSpec() {
return pixelSpec;
}
+
+ public int getComponentOffset() {
+ return compOffset;
+ }
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java 2008-06-18 04:00:36 UTC (rev 23)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelEval.java 2008-06-18 04:12:01 UTC (rev 24)
@@ -42,7 +42,7 @@
int offset;
switch (pixelSpec) {
case 'r':
- offset = 2;
+ offset = 0;
break;
case 'g':
@@ -50,7 +50,7 @@
break;
case 'b':
- offset = 0;
+ offset = 2;
break;
case 't':
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-06-18 04:00:36 UTC (rev 23)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleTransformer.java 2008-06-18 04:12:01 UTC (rev 24)
@@ -72,10 +72,11 @@
DataBuffer buffer = srcImage.getRaster().getDataBuffer();
int width = srcImage.getWidth();
int height = srcImage.getHeight();
+ int offset = entry.getKey().getComponentOffset();
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
double value = expr.eval(pe, x, y);
- buffer.setElemDouble(y * width * 3 + x * 3 + 2, value);
+ buffer.setElemDouble(y * width * 3 + x * 3 + offset, value);
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|