comparison servlet/src/digilib/image/DocuImage.java @ 86:997ba69afb81

New version 1.8b1. With directory and file information cache. With enhanceRGB method for color correction.
author robcast
date Sun, 09 Mar 2003 21:37:27 +0100
parents 4e6757e8ccd4
children 78f52a1876fe
comparison
equal deleted inserted replaced
85:4e6757e8ccd4 86:997ba69afb81
20 20
21 package digilib.image; 21 package digilib.image;
22 22
23 import java.awt.Rectangle; 23 import java.awt.Rectangle;
24 import java.io.File; 24 import java.io.File;
25 import java.io.IOException;
25 import java.io.OutputStream; 26 import java.io.OutputStream;
26 27
28 import digilib.io.DocuFile;
27 import digilib.io.FileOpException; 29 import digilib.io.FileOpException;
28 30
29 /** The basic class for the representation of a digilib image. 31 /** The basic class for the representation of a digilib image.
30 * 32 *
31 * The actual image object is hidden in the class, only methods for loading, 33 * The actual image object is hidden in the class, only methods for loading,
62 * @throws FileOpException 64 * @throws FileOpException
63 */ 65 */
64 public void loadSubimage(File f, Rectangle region, int subsample) 66 public void loadSubimage(File f, Rectangle region, int subsample)
65 throws FileOpException; 67 throws FileOpException;
66 68
67 /** This DocuImage support the preloadImage operation for getWidth/getHeight. 69 /** Checks the size and type of the DocuFile f.
68 * 70 *
69 * @return boolean 71 * The image size and type of the DocuFile f is determined and stored in
70 */ 72 * the DocuFile object. Returns true if successfull.
71 public boolean isPreloadSupported(); 73 *
72 74 * @param f DocuFile to be checked.
73 /** Preload image file into a state to use getWidth/getHeight. 75 * @return boolean true if check was successfull.
74 * 76 * @throws FileOpException Exception thrown on error.
75 * @param f 77 */
76 * @throws FileOpException 78 public boolean checkFile(DocuFile f) throws IOException;
77 */
78 public void preloadImage(File f) throws FileOpException;
79 79
80 /** Writes the current image to a ServletResponse. 80 /** Writes the current image to a ServletResponse.
81 * 81 *
82 * The image is encoded to the mime-type <code>mt</code> and sent to the output 82 * The image is encoded to the mime-type <code>mt</code> and sent to the output
83 * stream of the <code>ServletResponse</code> <code>res</code>. 83 * stream of the <code>ServletResponse</code> <code>res</code>.
100 /** The height of the current image in pixel. 100 /** The height of the current image in pixel.
101 * 101 *
102 * @return Image height in pixels. 102 * @return Image height in pixels.
103 */ 103 */
104 public int getHeight(); 104 public int getHeight();
105
106 /** The mime-type of the current image.
107 *
108 * @return String the mime-type of this image.
109 */
110 public String getMimetype();
105 111
106 /** Crops the current image. 112 /** Crops the current image.
107 * 113 *
108 * Cuts out a region of the size <code>width</code> x <code>height</code> at 114 * Cuts out a region of the size <code>width</code> x <code>height</code> at
109 * the offset <code>xoff</code>, <code>yoff</code> from the current image 115 * the offset <code>xoff</code>, <code>yoff</code> from the current image
173 * @param angle angle of mirror axis 179 * @param angle angle of mirror axis
174 * @throws ImageOpException 180 * @throws ImageOpException
175 */ 181 */
176 public void mirror(double angle) throws ImageOpException; 182 public void mirror(double angle) throws ImageOpException;
177 183
178 /** Enhaces brightness and contrast of the current image. 184 /** Enhances brightness and contrast of the current image.
179 * 185 *
180 * Replaces the current image with a brightness and contrast enhanced image. 186 * Replaces the current image with a brightness and contrast enhanced image.
181 * Contrast is enhanced by multiplying the pixel value with the constant 187 * Contrast is enhanced by multiplying the pixel value with the constant
182 * <code>mult</code>. Brightness is enhanced by adding the constant 188 * <code>mult</code>. Brightness is enhanced by adding the constant
183 * <code>add</code> to the pixel value. Operation: p1 = (p0*mult)+add. 189 * <code>add</code> to the pixel value. Operation: p1 = (p0*mult)+add.
184 * 190 *
185 * @param mult multiplicative constant for contrast enhancement 191 * @param mult multiplicative constant for contrast enhancement
186 * @param add additive constant for brightness enhancement 192 * @param add additive constant for brightness enhancement
187 * @throws ImageOpException 193 * @throws ImageOpException
188 */ 194 */
189 public void enhance(double mult, double add) throws ImageOpException; 195 public void enhance(float mult, float add) throws ImageOpException;
196
197 /** Manipulates the colors of the current image.
198 *
199 * Replaces the current image with a color modified image.
200 * For the red, green and blue color channels all pixel values are multiplied
201 * by the constant
202 * <code>m</code> and added to the constant
203 * <code>a</code>. Operation: p1 = (p0*m)+a.
204 *
205 * @param rgbm multiplicative constants for red, green, blue
206 * @param rgba additive constant for red, green, blue
207 * @throws ImageOpException
208 */
209 public void enhanceRGB(float[] rgbm, float[] rgba)
210 throws ImageOpException;
190 211
191 /** 212 /**
192 * Returns the interpolation quality. 213 * Returns the interpolation quality.
193 * @return int 214 * @return int
194 */ 215 */