changeset 90:8058d3b3466a

New version 1.8b4. JAIDocuImage new with enhanceRGB().
author robcast
date Mon, 17 Mar 2003 15:57:54 +0100
parents 6d35c945a5d6
children a398fc09ba71
files servlet/src/digilib/image/JAIDocuImage.java
diffstat 1 files changed, 40 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/servlet/src/digilib/image/JAIDocuImage.java	Mon Mar 17 15:28:13 2003 +0100
+++ b/servlet/src/digilib/image/JAIDocuImage.java	Mon Mar 17 15:57:54 2003 +0100
@@ -44,7 +44,7 @@
 	public JAIDocuImage() {
 	}
 
-	/** Contructor taking a utils object.
+	/** Contructor taking an utils object.
 	 * @param u utils object.
 	 */
 	public JAIDocuImage(Utils u) {
@@ -349,4 +349,43 @@
 	}
 
 
+	/* (non-Javadoc)
+	 * @see digilib.image.DocuImage#enhanceRGB(float[], float[])
+	 */
+	public void enhanceRGB(float[] rgbm, float[] rgba)
+		throws ImageOpException {
+			RenderedImage enhImg;
+			int nb = rgbm.length;
+			double[] ma = new double[nb];
+			double[] aa = new double[nb];
+			for (int i = 0; i < nb; i++) {
+				ma[i] = rgbm[i];
+				aa[i] = rgba[i];
+			}
+			// use Rescale operation
+			ParameterBlock param = new ParameterBlock();
+			param.addSource(img);
+			param.add(ma);
+			param.add(aa);
+			enhImg = JAI.create("rescale", param);
+
+			util.dprintln(
+				3,
+				"ENHANCE_RGB: *"
+					+ rgbm
+					+ ", +"
+					+ rgba
+					+ " ->"
+					+ enhImg.getWidth()
+					+ "x"
+					+ enhImg.getHeight());
+			//DEBUG
+
+			if (enhImg == null) {
+				util.dprintln(2, "ERROR(enhance): error in enhanceRGB");
+				throw new ImageOpException("Unable to enhanceRGB");
+			}
+			img = enhImg;
+	}
+
 }