Package digilib.io
Class ImageSet
java.lang.Object
digilib.io.ImageSet
- Direct Known Subclasses:
DocuImageSet
,ImageFileSet
Set of ImageInputs of the same image in different resolutions.
The images are be added in the order of higher to lower resolutions.
The first image is considered the hires "original".
- Author:
- casties
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(ImageInput f) Adds an ImageInput to this ImageSet.void
Append all ImageInputs from another ImageSet (at the end).void
get()
Gets the default Input.get
(int index) Get the ImageInput at the index.float
Returns the aspect ratio.Returns the biggest ImageInput in the set.Returns the biggest ImageInput in the set.Get an Iterator for this Fileset starting at the highest resolution image.Get an Iterator for this Fileset starting at the lowest resolution images.getNextBigger
(ImageSize size) Get the next bigger ImageInput than the given size.getNextBigger
(ImageSize size, ImageInput.InputTag tag) Get the next bigger ImageInput with the given tag than the given size.getNextBiggerPreferred
(ImageSize size, ImageInput.InputTag tag) Get the next bigger ImageInput than the given size preferring (same-size) images with the given tag.getNextSmaller
(ImageSize size) Get the next smaller ImageInput than the given size.getNextSmaller
(ImageSize size, ImageInput.InputTag tag) Get the next smaller ImageInput with the given tag than the given size.getNextSmallerPreferred
(ImageSize size, ImageInput.InputTag tag) Get the next smaller ImageInput than the given size preferring (same-size) images with the given tag.float
getResX()
float
getResY()
Returns the smallest ImageInput in the set.Returns the smallest ImageInput in the set.void
Sets the aspect ratio from an ImageSize.int
size()
The number of image files in this Fileset.
-
Field Details
-
list
list of files (ImageInput) -
aspect
protected float aspectaspect ratio (width/height) -
resX
protected float resXresolution of the biggest image (DPI) -
resY
protected float resYresolution of the biggest image (DPI)
-
-
Constructor Details
-
ImageSet
public ImageSet()Creator for empty fileset.
-
-
Method Details
-
size
public int size()The number of image files in this Fileset.- Returns:
- number of image files
-
get
Gets the default Input.- Returns:
- the ImageInput
-
get
Get the ImageInput at the index.- Parameters:
index
- the index- Returns:
- the ImageInput
-
getNextSmaller
Get the next smaller ImageInput than the given size. Returns the ImageInput from the set that has a width and height smaller or equal the given size. Returns null if there isn't any smaller image.- Parameters:
size
- the size- Returns:
- the ImageInput
-
getNextSmaller
Get the next smaller ImageInput with the given tag than the given size. Returns the ImageInput from the set that has a width and height smaller or equal the given size and has the given tag. Returns null if there isn't any smaller image with the given tag.- Parameters:
size
- the sizetag
- the tag- Returns:
- the ImageInput
-
getNextSmallerPreferred
Get the next smaller ImageInput than the given size preferring (same-size) images with the given tag. Returns the ImageInput from the set that has a width and height smaller or equal the given size. Prefers images with the given tag available at the same size. Returns null if there isn't any smaller image.- Parameters:
size
- the sizetag
- the tag- Returns:
- the ImageInput
-
getNextBigger
Get the next bigger ImageInput than the given size. Returns the ImageInput from the set that has a width or height bigger or equal the given size. Returns null if there isn't any bigger image.- Parameters:
size
- the size- Returns:
- the ImageInput
-
getNextBigger
Get the next bigger ImageInput with the given tag than the given size. Returns the ImageInput from the set that has a width or height bigger or equal the given size and has the given tag. Returns null if there isn't any bigger image with the given tag.- Parameters:
size
- the sizetag
- the tag- Returns:
- the ImageInput
-
getNextBiggerPreferred
Get the next bigger ImageInput than the given size preferring (same-size) images with the given tag. Returns the ImageInput from the set that has a width and height bigger or equal the given size. Prefers images with the given tag available at the same size. Returns null if there isn't any bigger image.- Parameters:
size
- the sizetag
- the tag- Returns:
- the ImageInput
-
getBiggest
Returns the biggest ImageInput in the set.- Returns:
- the ImageInput
-
getBiggestPreferred
Returns the biggest ImageInput in the set. Prefers inputs with given tag.- Returns:
- the ImageInput
-
getSmallest
Returns the smallest ImageInput in the set.- Returns:
- the ImageInput
-
getSmallestPreferred
Returns the smallest ImageInput in the set. Prefers inputs with the given tag.- Returns:
- the ImageInput
-
getHiresIterator
Get an Iterator for this Fileset starting at the highest resolution image.- Returns:
- the Iterator
-
getLoresIterator
Get an Iterator for this Fileset starting at the lowest resolution images. The Iterator starts at the last element, so you have to use it backwards with hasPrevious() and previous().- Returns:
- the Iterator
-
getResX
public float getResX()- Returns:
- the resX
-
getResY
public float getResY()- Returns:
- the resY
-
setAspect
Sets the aspect ratio from an ImageSize.- Parameters:
s
- the ImageSize
-
getAspect
public float getAspect()Returns the aspect ratio. Aspect ratio is (width/height). So it's <1 for portrait and >1 for landscape.- Returns:
- the aspect ratio
-
checkMeta
public void checkMeta() -
add
Adds an ImageInput to this ImageSet. The images should be added in the order of higher to lower resolutions. The first image is considered the hires "original".- Parameters:
f
- ImageInput to add- Returns:
- true (always)
-
append
Append all ImageInputs from another ImageSet (at the end). Changes the parents of the ImageInputs to this ImageSet.- Parameters:
imgs
- the ImageSet
-