comparison servlet/src/digilib/image/DocuImageImpl.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 a32e8c80e2f2
comparison
equal deleted inserted replaced
85:4e6757e8ccd4 86:997ba69afb81
18 18
19 */ 19 */
20 20
21 package digilib.image; 21 package digilib.image;
22 22
23 import java.awt.Dimension;
23 import java.awt.Rectangle; 24 import java.awt.Rectangle;
24 import java.io.File; 25 import java.io.File;
26 import java.io.IOException;
25 27
26 import digilib.Utils; 28 import digilib.Utils;
29 import digilib.io.DocuFile;
27 import digilib.io.FileOpException; 30 import digilib.io.FileOpException;
31 import digilib.io.FileOps;
28 32
29 /** Simple abstract implementation of the <code>DocuImage</code> interface. 33 /** Simple abstract implementation of the <code>DocuImage</code> interface.
30 * 34 *
31 * This implementation provides basic functionality for the utility methods like 35 * This implementation provides basic functionality for the utility methods like
32 * <code>SetUtils</code>, and <code>getKnownFileTypes</code>. Image methods like 36 * <code>SetUtils</code>, and <code>getKnownFileTypes</code>. Image methods like
40 protected Utils util = null; 44 protected Utils util = null;
41 45
42 /** Interpolation quality. */ 46 /** Interpolation quality. */
43 protected int quality = 0; 47 protected int quality = 0;
44 48
45 // epsilon for float comparisons 49 /** epsilon for float comparisons. */
46 public final double epsilon = 1e-5; 50 public final double epsilon = 1e-5;
51
52 /** image mime-type */
53 protected String mimeType = null;
47 54
48 /** Default constructor. */ 55 /** Default constructor. */
49 public DocuImageImpl() { 56 public DocuImageImpl() {
50 util = new Utils(); 57 util = new Utils();
51 } 58 }
114 setQuality(qual); 121 setQuality(qual);
115 crop(x_off, y_off, width, height); 122 crop(x_off, y_off, width, height);
116 scale(scale); 123 scale(scale);
117 } 124 }
118 125
126 /* this is a rather stupid implementation, eventually loading the whole file. */
127 public boolean checkFile(DocuFile f) throws IOException {
128 loadImage(f.getFile());
129 int w = getWidth();
130 int h = getHeight();
131 Dimension s = new Dimension(w, h);
132 f.setSize(s);
133 String m = FileOps.mimeForFile(f.getFile());
134 mimeType = m;
135 f.setMimetype(m);
136 return true;
137 }
138
139 public String getMimetype() {
140 return mimeType;
141 }
142
119 public void rotate(double angle) throws ImageOpException { 143 public void rotate(double angle) throws ImageOpException {
120 // just a do-nothing implementation 144 // just a do-nothing implementation
121 } 145 }
122 146
123 public void mirror(double angle) throws ImageOpException { 147 public void mirror(double angle) throws ImageOpException {
124 // just a do-nothing implementation 148 // just a do-nothing implementation
125 } 149 }
126 150
127 public void enhance(double mult, double add) throws ImageOpException { 151 public void enhance(float mult, float add) throws ImageOpException {
128 // just a do-nothing implementation 152 // just a do-nothing implementation
129 } 153 }
130 154
131 public void preloadImage(File f) throws FileOpException {
132 // just a do-nothing implementation
133 }
134
135 public boolean isPreloadSupported() {
136 // preload per default not supported
137 return false;
138 }
139
140 public boolean isSubimageSupported() { 155 public boolean isSubimageSupported() {
141 // partial loading per default not supported 156 // partial loading not supported per default
142 return false; 157 return false;
143 } 158 }
144 159
145 public void loadSubimage(File f, Rectangle region, int subsample) 160 public void loadSubimage(File f, Rectangle region, int subsample)
146 throws FileOpException { 161 throws FileOpException {
147 // empty implementation 162 // empty implementation
148 } 163 }
149 164
165 public void enhanceRGB(float[] rgbm, float[] rgba)
166 throws ImageOpException {
167 // emtpy implementation
168 }
169
150 } 170 }