Mercurial > hg > digilib-old
comparison servlet/src/digilib/image/DocuImage.java @ 85:4e6757e8ccd4
New enhanced ImageLoader stuff.
Now uses Subsampling and image regions on read.
Now implements enhance, rotate and mirror for ImageLoader/Java2D
author | robcast |
---|---|
date | Thu, 27 Feb 2003 15:07:29 +0100 |
parents | 63c8186455c1 |
children | 997ba69afb81 |
comparison
equal
deleted
inserted
replaced
84:ed1b698b4f0a | 85:4e6757e8ccd4 |
---|---|
1 /* DocuImage -- General image interface class | 1 /* DocuImage -- General image interface class |
2 | 2 |
3 Digital Image Library servlet components | 3 Digital Image Library servlet components |
4 | 4 |
5 Copyright (C) 2001, 2002 Robert Casties (robcast@mail.berlios.de) | 5 Copyright (C) 2001, 2002, 2003 Robert Casties (robcast@mail.berlios.de) |
6 | 6 |
7 This program is free software; you can redistribute it and/or modify it | 7 This program is free software; you can redistribute it and/or modify it |
8 under the terms of the GNU General Public License as published by the | 8 under the terms of the GNU General Public License as published by the |
9 Free Software Foundation; either version 2 of the License, or (at your | 9 Free Software Foundation; either version 2 of the License, or (at your |
10 option) any later version. | 10 option) any later version. |
18 | 18 |
19 */ | 19 */ |
20 | 20 |
21 package digilib.image; | 21 package digilib.image; |
22 | 22 |
23 import java.awt.Rectangle; | |
23 import java.io.File; | 24 import java.io.File; |
24 import java.io.OutputStream; | 25 import java.io.OutputStream; |
25 | 26 |
26 import digilib.io.FileOpException; | 27 import digilib.io.FileOpException; |
27 | 28 |
45 * @param f Image File. | 46 * @param f Image File. |
46 * @throws FileOpException Exception thrown if any error occurs. | 47 * @throws FileOpException Exception thrown if any error occurs. |
47 */ | 48 */ |
48 public void loadImage(File f) throws FileOpException; | 49 public void loadImage(File f) throws FileOpException; |
49 | 50 |
51 /** This DocuImage support the loadSubImage operation. | |
52 * | |
53 * @return boolean | |
54 */ | |
55 public boolean isSubimageSupported(); | |
56 | |
57 /** Load only a subsampled region of the image file. | |
58 * | |
59 * @param f | |
60 * @param region | |
61 * @param subsample | |
62 * @throws FileOpException | |
63 */ | |
64 public void loadSubimage(File f, Rectangle region, int subsample) | |
65 throws FileOpException; | |
66 | |
67 /** This DocuImage support the preloadImage operation for getWidth/getHeight. | |
68 * | |
69 * @return boolean | |
70 */ | |
71 public boolean isPreloadSupported(); | |
72 | |
73 /** Preload image file into a state to use getWidth/getHeight. | |
74 * | |
75 * @param f | |
76 * @throws FileOpException | |
77 */ | |
78 public void preloadImage(File f) throws FileOpException; | |
79 | |
50 /** Writes the current image to a ServletResponse. | 80 /** Writes the current image to a ServletResponse. |
51 * | 81 * |
52 * 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 |
53 * stream of the <code>ServletResponse</code> <code>res</code>. | 83 * stream of the <code>ServletResponse</code> <code>res</code>. |
54 * | 84 * |
119 int width, | 149 int width, |
120 int height, | 150 int height, |
121 double scale, | 151 double scale, |
122 int qual) | 152 int qual) |
123 throws ImageOpException; | 153 throws ImageOpException; |
124 | 154 |
125 /** Rotates the current image. | 155 /** Rotates the current image. |
126 * | 156 * |
127 * Replaces the current image with a rotated image. The image is rotated | 157 * Replaces the current image with a rotated image. The image is rotated |
128 * around the center by <code>angle</code> given in degrees [0, 360] | 158 * around the point <code>x</code>,<code>y</code> by <code>angle</code> |
129 * clockwise. Image size and aspect ratio are likely to change. | 159 * given in degrees [0, 360] clockwise. |
160 * Image size and aspect ratio are likely to change. | |
130 * | 161 * |
131 * @param angle rotation angle in degree | 162 * @param angle rotation angle in degree |
132 */ | 163 */ |
133 public void rotate(double angle) throws ImageOpException; | 164 public void rotate(double angle) throws ImageOpException; |
134 | 165 |
135 /** Mirrors the current image. | 166 /** Mirrors the current image. |
136 * | 167 * |
137 * Replaces the current image with a mirrored image. The mirror axis goes | 168 * Replaces the current image with a mirrored image. The mirror axis goes |
138 * through the center of the image and is rotated by <code>angle</code> | 169 * through the center of the image and is rotated by <code>angle</code> |
139 * degrees. Currently only horizontal and vertical mirroring (0 and 90 | 170 * degrees. Currently only horizontal and vertical mirroring (0 and 90 |
141 * | 172 * |
142 * @param angle angle of mirror axis | 173 * @param angle angle of mirror axis |
143 * @throws ImageOpException | 174 * @throws ImageOpException |
144 */ | 175 */ |
145 public void mirror(double angle) throws ImageOpException; | 176 public void mirror(double angle) throws ImageOpException; |
146 | 177 |
147 /** Enhaces brightness and contrast of the current image. | 178 /** Enhaces brightness and contrast of the current image. |
148 * | 179 * |
149 * Replaces the current image with a brightness and contrast enhanced image. | 180 * Replaces the current image with a brightness and contrast enhanced image. |
150 * Contrast is enhanced by multiplying the pixel value with the constant | 181 * Contrast is enhanced by multiplying the pixel value with the constant |
151 * <code>mult</code>. Brightness is enhanced by adding the constant | 182 * <code>mult</code>. Brightness is enhanced by adding the constant |