[Pixelle-commit] SF.net SVN: pixelle: [73] trunk/pixelle/src/com/mebigfatguy/pixelle/ PixelleEval.j
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2008-06-25 03:08:04
|
Revision: 73
http://pixelle.svn.sourceforge.net/pixelle/?rev=73&view=rev
Author: dbrosius
Date: 2008-06-24 20:08:13 -0700 (Tue, 24 Jun 2008)
Log Message:
-----------
javadoc
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java 2008-06-25 02:51:52 UTC (rev 72)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java 2008-06-25 03:08:13 UTC (rev 73)
@@ -21,6 +21,10 @@
import java.awt.Color;
import java.awt.image.DataBuffer;
+/**
+ * an abstract class for evaluation pixels in arbitrary images by enforcing a
+ * template pattern that derived classes implement per image format.
+ */
public abstract class PixelleEval {
protected PixelleImage srcImage;
@@ -30,6 +34,12 @@
protected OutOfBoundsOption oobOption;
private int selectionByte;
+ /**
+ * create an evaluator for a specific image and options
+ *
+ * @param image the image to evaluate
+ * @param option the out of bounds pixels option to use
+ */
public PixelleEval(PixelleImage image, OutOfBoundsOption option) {
srcImage = image;
buffer = image.getBuffer();
@@ -38,11 +48,49 @@
oobOption = option;
}
+ /**
+ * template method to get the red value at a specific x and y
+ *
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @return the pixel red value at the given coordinate
+ */
public abstract double getRedValue(int x, int y);
+
+ /**
+ * template method to get the green value at a specific x and y
+ *
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @return the pixel green value at the given coordinate
+ */
public abstract double getGreenValue(int x, int y);
+
+ /**
+ * template method to get the blue value at a specific x and y
+ *
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @return the pixel blue value at the given coordinate
+ */
public abstract double getBlueValue(int x, int y);
+
+ /**
+ * template method to get the transparency value at a specific x and y
+ *
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @return the pixel transparency value at the given coordinate
+ */
public abstract double getTransparencyValue(int x, int y);
+ /**
+ * retrieves the value at a specific index for a specific color, transparency or selection
+ *
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @return the pixel value at the given coordinate for the pixel specification
+ */
public double getValue(int x, int y, char pixelSpec) {
/* in the future, allow customization of out of bounds indices */
@@ -103,14 +151,31 @@
}
}
+ /**
+ * gets the width of the source image
+ *
+ * @return the width of the image
+ */
public int getWidth() {
return width;
}
+ /**
+ * gets the height of the source image
+ *
+ * @return the height of the image
+ */
public int getHeight() {
return height;
}
+ /**
+ * gets the selection value at specific index
+ *
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @return the selection value either 0 or 1
+ */
private double getSelectionValue(int x, int y) {
if ((x & 0x07) == 0) {
selectionByte = srcImage.getSelectionByte(x >> 3, y);
@@ -120,6 +185,12 @@
return ((selectionByte & bitOffset) == 0) ? 0 : 1;
}
+ /**
+ * sets the selection value at a specific index
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @param value the selection value to use where 0 is off
+ */
protected void setSelectionValue(int x, int y, double value) {
if ((x & 0x07) == 0) {
selectionByte = 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|