annotate servlet/src/digilib/io/ImageInput.java @ 574:790cbfb58b52 stream

ripping apart ImageFileSet
author robcast
date Wed, 22 Dec 2010 18:32:06 +0100
parents 34701340922e
children bb8dfc05674f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
566
50f291d808b1 starting stream support
robcast
parents:
diff changeset
1 /* ImageInput-- digilib image input interface.
50f291d808b1 starting stream support
robcast
parents:
diff changeset
2
50f291d808b1 starting stream support
robcast
parents:
diff changeset
3 Digital Image Library servlet components
50f291d808b1 starting stream support
robcast
parents:
diff changeset
4
50f291d808b1 starting stream support
robcast
parents:
diff changeset
5 Copyright (C) 2010 Robert Casties (robcast@mail.berlios.de)
50f291d808b1 starting stream support
robcast
parents:
diff changeset
6
50f291d808b1 starting stream support
robcast
parents:
diff changeset
7 This program is free software; you can redistribute it and/or modify it
50f291d808b1 starting stream support
robcast
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
50f291d808b1 starting stream support
robcast
parents:
diff changeset
9 Free Software Foundation; either version 2 of the License, or (at your
50f291d808b1 starting stream support
robcast
parents:
diff changeset
10 option) any later version.
50f291d808b1 starting stream support
robcast
parents:
diff changeset
11
50f291d808b1 starting stream support
robcast
parents:
diff changeset
12 Please read license.txt for the full details. A copy of the GPL
50f291d808b1 starting stream support
robcast
parents:
diff changeset
13 may be found at http://www.gnu.org/copyleft/lgpl.html
50f291d808b1 starting stream support
robcast
parents:
diff changeset
14
50f291d808b1 starting stream support
robcast
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
50f291d808b1 starting stream support
robcast
parents:
diff changeset
16 along with this program; if not, write to the Free Software
50f291d808b1 starting stream support
robcast
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
50f291d808b1 starting stream support
robcast
parents:
diff changeset
18
50f291d808b1 starting stream support
robcast
parents:
diff changeset
19 * Created on 20.12.2010
50f291d808b1 starting stream support
robcast
parents:
diff changeset
20 */
50f291d808b1 starting stream support
robcast
parents:
diff changeset
21
50f291d808b1 starting stream support
robcast
parents:
diff changeset
22 package digilib.io;
50f291d808b1 starting stream support
robcast
parents:
diff changeset
23
50f291d808b1 starting stream support
robcast
parents:
diff changeset
24 import digilib.image.ImageSize;
50f291d808b1 starting stream support
robcast
parents:
diff changeset
25
568
34701340922e more starting stream support
robcast
parents: 566
diff changeset
26 public abstract class ImageInput {
34701340922e more starting stream support
robcast
parents: 566
diff changeset
27
34701340922e more starting stream support
robcast
parents: 566
diff changeset
28 // mime file type
34701340922e more starting stream support
robcast
parents: 566
diff changeset
29 protected String mimetype = null;
34701340922e more starting stream support
robcast
parents: 566
diff changeset
30 // image size in pixels
34701340922e more starting stream support
robcast
parents: 566
diff changeset
31 protected ImageSize pixelSize = null;
34701340922e more starting stream support
robcast
parents: 566
diff changeset
32
566
50f291d808b1 starting stream support
robcast
parents:
diff changeset
33 /**
50f291d808b1 starting stream support
robcast
parents:
diff changeset
34 * @return ImageSize
50f291d808b1 starting stream support
robcast
parents:
diff changeset
35 */
568
34701340922e more starting stream support
robcast
parents: 566
diff changeset
36 public ImageSize getSize() {
34701340922e more starting stream support
robcast
parents: 566
diff changeset
37 return pixelSize;
34701340922e more starting stream support
robcast
parents: 566
diff changeset
38 }
566
50f291d808b1 starting stream support
robcast
parents:
diff changeset
39
50f291d808b1 starting stream support
robcast
parents:
diff changeset
40 /**
50f291d808b1 starting stream support
robcast
parents:
diff changeset
41 * Sets the imageSize.
50f291d808b1 starting stream support
robcast
parents:
diff changeset
42 * @param imageSize The imageSize to set
50f291d808b1 starting stream support
robcast
parents:
diff changeset
43 */
568
34701340922e more starting stream support
robcast
parents: 566
diff changeset
44 public void setSize(ImageSize imageSize) {
34701340922e more starting stream support
robcast
parents: 566
diff changeset
45 this.pixelSize = imageSize;
34701340922e more starting stream support
robcast
parents: 566
diff changeset
46 }
34701340922e more starting stream support
robcast
parents: 566
diff changeset
47
34701340922e more starting stream support
robcast
parents: 566
diff changeset
48 /**
34701340922e more starting stream support
robcast
parents: 566
diff changeset
49 * @return String
34701340922e more starting stream support
robcast
parents: 566
diff changeset
50 */
34701340922e more starting stream support
robcast
parents: 566
diff changeset
51 public String getMimetype() {
34701340922e more starting stream support
robcast
parents: 566
diff changeset
52 return mimetype;
34701340922e more starting stream support
robcast
parents: 566
diff changeset
53 }
566
50f291d808b1 starting stream support
robcast
parents:
diff changeset
54
50f291d808b1 starting stream support
robcast
parents:
diff changeset
55 /**
50f291d808b1 starting stream support
robcast
parents:
diff changeset
56 * Sets the mimetype.
50f291d808b1 starting stream support
robcast
parents:
diff changeset
57 * @param mimetype The mimetype to set
50f291d808b1 starting stream support
robcast
parents:
diff changeset
58 */
568
34701340922e more starting stream support
robcast
parents: 566
diff changeset
59 public void setMimetype(String filetype) {
34701340922e more starting stream support
robcast
parents: 566
diff changeset
60 this.mimetype = filetype;
34701340922e more starting stream support
robcast
parents: 566
diff changeset
61 }
566
50f291d808b1 starting stream support
robcast
parents:
diff changeset
62
50f291d808b1 starting stream support
robcast
parents:
diff changeset
63 /** returns if this image has been checked
50f291d808b1 starting stream support
robcast
parents:
diff changeset
64 * (i.e. has size and mimetype)
50f291d808b1 starting stream support
robcast
parents:
diff changeset
65 * @return boolean
50f291d808b1 starting stream support
robcast
parents:
diff changeset
66 */
568
34701340922e more starting stream support
robcast
parents: 566
diff changeset
67 public boolean isChecked() {
34701340922e more starting stream support
robcast
parents: 566
diff changeset
68 return (pixelSize != null);
34701340922e more starting stream support
robcast
parents: 566
diff changeset
69 }
34701340922e more starting stream support
robcast
parents: 566
diff changeset
70
566
50f291d808b1 starting stream support
robcast
parents:
diff changeset
71 /** Returns the aspect ratio of the image (width/height).
50f291d808b1 starting stream support
robcast
parents:
diff changeset
72 *
50f291d808b1 starting stream support
robcast
parents:
diff changeset
73 * @return
50f291d808b1 starting stream support
robcast
parents:
diff changeset
74 */
568
34701340922e more starting stream support
robcast
parents: 566
diff changeset
75 public float getAspect() {
34701340922e more starting stream support
robcast
parents: 566
diff changeset
76 return (pixelSize != null) ? pixelSize.getAspect() : 0;
34701340922e more starting stream support
robcast
parents: 566
diff changeset
77 }
566
50f291d808b1 starting stream support
robcast
parents:
diff changeset
78
50f291d808b1 starting stream support
robcast
parents:
diff changeset
79 }