- Direct Known Subclasses:
ImageVersion
-
Method Summary
Modifier and TypeMethodDescriptionGets the dimension in pixels.int
Gets the height in pixels.int
getWidth()
Gets the width in pixels.Scales this version to a different resolution, using cached version if previously scaled.Methods inherited from class com.aoapps.cdn.data.Version
equals, getContentType, getResource, hashCode, toString
-
Method Details
-
getDimension
Gets the dimension in pixels. -
getWidth
public int getWidth()Gets the width in pixels. -
getHeight
public int getHeight()Gets the height in pixels. -
scale
Scales this version to a different resolution, using cached version if previously scaled.This will typically be done on the original version, but can be performed on any version.
First searches all versions for any of this type and matching dimension. If found, returns it. Tracks which version had the highest resolution while performing this search.
Will only scale down from the biggest existing resource. A request to scale up will return the highest resolution available.
Will only perform proportional scaling. If both
width
andheight
are specified, returns the largest, possibly scaled, image that fits both the width and the height. The resulting width or height may be less than the requested scaling, but will not be more. The user interface could perform letterboxing if needing to fit into a fix proportion area.Locks the resource while performing the search. This search should be very quick, and this locking will prevent duplicate work when performing a new scaling.
Synchronizes the cluster, but only after releasing the lock. If different nodes create the same version at the same time, the cluster confict will be resolved through standard monitoring and administration.
- Parameters:
width
- The desired width ornull
for proportional scalingheight
- The desired height ornull
for proportional scaling- Returns:
- When both
width
andheight
arenull
, returnthis
. When resulting dimensions match this version, returnthis
. Otherwise return a closest-match scaled version. - Throws:
IOException
-