Mercurial > hg > digilib-old
comparison servlet/src/digilib/image/JIMIDocuImage.java @ 149:04ad64b2137a
Servlet version 1.14b1
- better performance with thumbnails (really, this time :-)
- new DocuInfo class
- new Directory class
- DocuFile uses String and Directory as data members
- parameter rearrangements
author | robcast |
---|---|
date | Tue, 26 Aug 2003 22:28:43 +0200 |
parents | 63c8186455c1 |
children | e743b853efca |
comparison
equal
deleted
inserted
replaced
148:837a633a0407 | 149:04ad64b2137a |
---|---|
21 package digilib.image; | 21 package digilib.image; |
22 | 22 |
23 import java.awt.image.FilteredImageSource; | 23 import java.awt.image.FilteredImageSource; |
24 import java.awt.image.ImageFilter; | 24 import java.awt.image.ImageFilter; |
25 import java.awt.image.ImageProducer; | 25 import java.awt.image.ImageProducer; |
26 import java.io.File; | |
27 import java.io.OutputStream; | 26 import java.io.OutputStream; |
28 | 27 |
29 import com.sun.jimi.core.Jimi; | 28 import com.sun.jimi.core.Jimi; |
30 import com.sun.jimi.core.JimiException; | 29 import com.sun.jimi.core.JimiException; |
31 import com.sun.jimi.core.filters.AreaAverageScaleFilter; | 30 import com.sun.jimi.core.filters.AreaAverageScaleFilter; |
32 import com.sun.jimi.core.filters.ReplicatingScaleFilter; | 31 import com.sun.jimi.core.filters.ReplicatingScaleFilter; |
33 import com.sun.jimi.core.raster.JimiRasterImage; | 32 import com.sun.jimi.core.raster.JimiRasterImage; |
34 | 33 |
35 import digilib.Utils; | 34 import digilib.Utils; |
35 import digilib.io.DocuFile; | |
36 import digilib.io.FileOpException; | 36 import digilib.io.FileOpException; |
37 | 37 |
38 /** Implementation of DocuImage using the JIMI image Library. */ | 38 /** Implementation of DocuImage using the JIMI image Library. */ |
39 public class JIMIDocuImage extends DocuImageImpl { | 39 public class JIMIDocuImage extends DocuImageImpl { |
40 | 40 |
51 } | 51 } |
52 | 52 |
53 /** | 53 /** |
54 * load image file | 54 * load image file |
55 */ | 55 */ |
56 public void loadImage(File f) throws FileOpException { | 56 public void loadImage(DocuFile f) throws FileOpException { |
57 System.gc(); | 57 System.gc(); |
58 try { | 58 try { |
59 img = Jimi.getRasterImage(f.toURL()); | 59 img = Jimi.getRasterImage(f.getFile().toURL()); |
60 } catch (java.net.MalformedURLException e) { | 60 } catch (java.net.MalformedURLException e) { |
61 util.dprintln(3, "ERROR(loadImage): MalformedURLException"); | 61 util.dprintln(3, "ERROR(loadImage): MalformedURLException"); |
62 } catch (JimiException e) { | 62 } catch (JimiException e) { |
63 util.dprintln(3, "ERROR(loadImage): JIMIException"); | 63 util.dprintln(3, "ERROR(loadImage): JIMIException"); |
64 throw new FileOpException("Unable to load File!" + e); | 64 throw new FileOpException("Unable to load File!" + e); |
92 | 92 |
93 public int getHeight() { | 93 public int getHeight() { |
94 return imgHeight; | 94 return imgHeight; |
95 } | 95 } |
96 | 96 |
97 public void scale(double scale) throws ImageOpException { | 97 public void scale(double scale, double scaleY) throws ImageOpException { |
98 | 98 |
99 ImageFilter scaleFilter; | 99 ImageFilter scaleFilter; |
100 int destWidth = (int) (scale * (float) imgWidth); | 100 int destWidth = (int) (scale * (float) imgWidth); |
101 int destHeight = (int) (scale * (float) imgHeight); | 101 int destHeight = (int) (scale * (float) imgHeight); |
102 | 102 |