566
|
1 /* ImageInput-- digilib image input interface.
|
|
2
|
|
3 Digital Image Library servlet components
|
|
4
|
|
5 Copyright (C) 2010 Robert Casties (robcast@mail.berlios.de)
|
|
6
|
|
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
|
|
9 Free Software Foundation; either version 2 of the License, or (at your
|
|
10 option) any later version.
|
|
11
|
|
12 Please read license.txt for the full details. A copy of the GPL
|
|
13 may be found at http://www.gnu.org/copyleft/lgpl.html
|
|
14
|
|
15 You should have received a copy of the GNU General Public License
|
|
16 along with this program; if not, write to the Free Software
|
|
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
18
|
|
19 * Created on 20.12.2010
|
|
20 */
|
|
21
|
|
22 package digilib.io;
|
|
23
|
|
24 import digilib.image.ImageSize;
|
|
25
|
568
|
26 public abstract class ImageInput {
|
|
27
|
|
28 // mime file type
|
|
29 protected String mimetype = null;
|
|
30 // image size in pixels
|
|
31 protected ImageSize pixelSize = null;
|
|
32
|
566
|
33 /**
|
|
34 * @return ImageSize
|
|
35 */
|
568
|
36 public ImageSize getSize() {
|
|
37 return pixelSize;
|
|
38 }
|
566
|
39
|
|
40 /**
|
|
41 * Sets the imageSize.
|
|
42 * @param imageSize The imageSize to set
|
|
43 */
|
568
|
44 public void setSize(ImageSize imageSize) {
|
|
45 this.pixelSize = imageSize;
|
|
46 }
|
|
47
|
|
48 /**
|
|
49 * @return String
|
|
50 */
|
|
51 public String getMimetype() {
|
|
52 return mimetype;
|
|
53 }
|
566
|
54
|
|
55 /**
|
|
56 * Sets the mimetype.
|
|
57 * @param mimetype The mimetype to set
|
|
58 */
|
568
|
59 public void setMimetype(String filetype) {
|
|
60 this.mimetype = filetype;
|
|
61 }
|
566
|
62
|
|
63 /** returns if this image has been checked
|
581
|
64 * (i.e. has size and mimetype)
|
|
65 * TODO: deprecated
|
566
|
66 * @return boolean
|
|
67 */
|
568
|
68 public boolean isChecked() {
|
|
69 return (pixelSize != null);
|
|
70 }
|
|
71
|
566
|
72 /** Returns the aspect ratio of the image (width/height).
|
|
73 *
|
|
74 * @return
|
|
75 */
|
568
|
76 public float getAspect() {
|
|
77 return (pixelSize != null) ? pixelSize.getAspect() : 0;
|
|
78 }
|
566
|
79
|
|
80 } |