public class SizeRequest extends Object
| Constructor and Description |
|---|
SizeRequest()
Create a size request for the full native resolution of the image region.
|
SizeRequest(BigDecimal percentage)
Create a size request that scaled both dimensions according to a fixed percentage, maintaining the aspect ratio.
|
SizeRequest(boolean isMax)
Create a size request for the maximum supported size of the image region, if isMax is true.
|
SizeRequest(Integer width,
Integer height)
Create a size request for a given width or height.
|
SizeRequest(int width,
int height,
boolean bestFit)
Create a size request for a given width and height and signal that the server can decide to render smaller resolutions as it deems neccessary.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
static SizeRequest |
fromString(String str)
Parse an IIIF Image API compliant size request string
|
String |
getCanonicalForm(Dimension nativeSize,
ImageApiProfile profile)
Get the canonical form of this request.
|
Integer |
getHeight()
Get the requested height
|
BigDecimal |
getPercentage()
Get the requested percentage to be used for scaling
|
Integer |
getWidth()
Get the requested width
|
int |
hashCode() |
boolean |
isBestFit()
Return whether the server can decide to render smaller resolutions than desired.
|
boolean |
isMax()
Return whether the maximum resolution was requested.
|
Dimension |
resolve(Dimension nativeSize,
ImageApiProfile profile) |
Dimension |
resolve(Dimension nativeSize,
List<Dimension> availableSizes,
ImageApiProfile profile)
Resolve the request to dimensions that can be used for scaling, based on the native size of the image region and the available profile.
|
Dimension |
resolve(Rectangle region,
ImageApiProfile profile)
Like
resolve(Dimension, ImageApiProfile), but can be used with a Rectangle, e.g. |
String |
toString()
Create an IIIF Image API compliant size request string
|
public SizeRequest()
Create a size request for the full native resolution of the image region.
public SizeRequest(boolean isMax)
Create a size request for the maximum supported size of the image region, if isMax is true. If isMax is false, ise it behaves identically to the default constructor.
public SizeRequest(Integer width, Integer height) throws ResolvingException
Create a size request for a given width or height.
One of both can be null (the other value will be determined based on the aspect ratio of the image region), but not both at once.
ResolvingException - if neither width nor height are specifiedpublic SizeRequest(int width,
int height,
boolean bestFit)
throws ResolvingException
Create a size request for a given width and height and signal that the server can decide to render smaller resolutions as it deems neccessary.
ResolvingExceptionpublic SizeRequest(BigDecimal percentage) throws ResolvingException
Create a size request that scaled both dimensions according to a fixed percentage, maintaining the aspect ratio.
ResolvingException - if the percentage is not between 0 and 100public static SizeRequest fromString(String str) throws ResolvingException
Parse an IIIF Image API compliant size request string
ResolvingException - if the request string is malformedpublic boolean isMax()
Return whether the maximum resolution was requested.
public boolean isBestFit()
Return whether the server can decide to render smaller resolutions than desired.
public Integer getWidth()
Get the requested width
public Integer getHeight()
Get the requested height
public BigDecimal getPercentage()
Get the requested percentage to be used for scaling
public String getCanonicalForm(Dimension nativeSize, ImageApiProfile profile) throws ResolvingException
Get the canonical form of this request.
ResolvingExceptionhttp://iiif.io/api/image/2.1/#canonical-uri-syntaxpublic Dimension resolve(Dimension nativeSize, ImageApiProfile profile) throws ResolvingException
ResolvingExceptionpublic Dimension resolve(Dimension nativeSize, List<Dimension> availableSizes, ImageApiProfile profile) throws ResolvingException
Resolve the request to dimensions that can be used for scaling, based on the native size of the image region and the available profile.
ResolvingExceptionpublic Dimension resolve(Rectangle region, ImageApiProfile profile) throws ResolvingException
Like resolve(Dimension, ImageApiProfile), but can be used with a Rectangle, e.g. as returned from RegionRequest.resolve(Dimension).
ResolvingExceptionpublic String toString()
Create an IIIF Image API compliant size request string
Copyright © 2018. All rights reserved.