|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.coobird.thumbnailator.builders.ThumbnailParameterBuilder
public final class ThumbnailParameterBuilder
A builder for generating ThumbnailParameter
.
The default values assigned to the ThumbnailParameter
created by
the ThumbnailParameterBuilder
are as follows:
size(int, int)
method.size(int, int)
method.scale(double)
method or
scale(double, double)
method.ThumbnailParameter.DEFAULT_IMAGE_TYPE
. Same as
BufferedImage.TYPE_INT_ARGB
.ThumbnailParameter.DEFAULT_QUALITY
.ThumbnailParameter.ORIGINAL_FORMAT
. Maintains the same
image format as the original image.ThumbnailParameter.DEFAULT_FORMAT_TYPE
. Uses the default
format type of the codec used to create the thumbnail image.DefaultResizerFactory
is used.Resizer
returned by the ResizerFactory
.
Constructor Summary | |
---|---|
ThumbnailParameterBuilder()
Creates an instance of a ThumbnailParameterBuilder . |
Method Summary | |
---|---|
ThumbnailParameter |
build()
Returns a ThumbnailParameter from the parameters which are
currently set. |
ThumbnailParameterBuilder |
filters(List<ImageFilter> filters)
Sets the ImageFilter s to apply to the thumbnail. |
ThumbnailParameterBuilder |
fitWithinDimensions(boolean fit)
Sets whether or not the thumbnail should fit within the specified dimensions. |
ThumbnailParameterBuilder |
format(String format)
Sets the output format of the thumbnail. |
ThumbnailParameterBuilder |
formatType(String formatType)
Sets the output format type of the thumbnail. |
ThumbnailParameterBuilder |
imageType(int type)
Sets the image type fo the thumbnail. |
ThumbnailParameterBuilder |
keepAspectRatio(boolean keep)
Sets whether or not the thumbnail is to maintain the aspect ratio of the original image. |
ThumbnailParameterBuilder |
quality(float quality)
Sets the compression quality setting of the thumbnail. |
ThumbnailParameterBuilder |
region(Region sourceRegion)
Sets the region of the source image to use when creating a thumbnail. |
ThumbnailParameterBuilder |
resizer(Resizer resizer)
Sets the Resizer to use when performing the resizing operation
to create the thumbnail. |
ThumbnailParameterBuilder |
resizerFactory(ResizerFactory resizerFactory)
Sets the ResizerFactory to use to obtain a Resizer when
performing the resizing operation to create the thumbnail. |
ThumbnailParameterBuilder |
scale(double scalingFactor)
Sets the scaling factor of the thumbnail. |
ThumbnailParameterBuilder |
scale(double widthScalingFactor,
double heightScalingFactor)
Sets the scaling factor of the thumbnail. |
ThumbnailParameterBuilder |
size(Dimension size)
Sets the size of the thumbnail. |
ThumbnailParameterBuilder |
size(int width,
int height)
Sets the size of the thumbnail. |
ThumbnailParameterBuilder |
useExifOrientation(boolean use)
Sets whether or not the Exif metadata should be used to determine the orientation of the thumbnail. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ThumbnailParameterBuilder()
ThumbnailParameterBuilder
.
Method Detail |
---|
public ThumbnailParameterBuilder imageType(int type)
type
- The image type of the thumbnail.
public ThumbnailParameterBuilder size(Dimension size)
size
- The dimensions of the thumbnail.
public ThumbnailParameterBuilder size(int width, int height)
width
- The width of the thumbnail.height
- The height of the thumbnail.
IllegalArgumentException
- If the widht or height is less than 0.public ThumbnailParameterBuilder scale(double scalingFactor)
scalingFactor
- The scaling factor of the thumbnail.
IllegalArgumentException
- If the scaling factor is not a
rational number, or if it is less
than 0.0
.public ThumbnailParameterBuilder scale(double widthScalingFactor, double heightScalingFactor)
widthScalingFactor
- The scaling factor to use for the width
when creating the thumbnail.heightScalingFactor
- The scaling factor to use for the height
when creating the thumbnail.
IllegalArgumentException
- If the scaling factor is not a
rational number, or if it is less
than 0.0
.public ThumbnailParameterBuilder region(Region sourceRegion)
sourceRegion
- The region of the source image to use when
creating a thumbnail.
public ThumbnailParameterBuilder keepAspectRatio(boolean keep)
keep
- true
if the aspect ratio of the original image
is to be maintained in the thumbnail, false
otherwise.
public ThumbnailParameterBuilder quality(float quality)
An acceptable value is in the range of 0.0f
to 1.0f
,
where 0.0f
is for the lowest quality setting and 1.0f
for
the highest quality setting.
If the default compression quality is to be used, then the value
ThumbnailParameter.DEFAULT_QUALITY
should be used.
quality
- The compression quality setting of the thumbnail.
public ThumbnailParameterBuilder format(String format)
format
- The output format of the thumbnail.
public ThumbnailParameterBuilder formatType(String formatType)
formatType
- The output format type of the thumbnail.
public ThumbnailParameterBuilder filters(List<ImageFilter> filters)
ImageFilter
s to apply to the thumbnail.
These filters will be applied after the original image is resized.
filters
- The output format type of the thumbnail.
public ThumbnailParameterBuilder resizer(Resizer resizer)
Resizer
to use when performing the resizing operation
to create the thumbnail.
Calling this method after resizerFactory(ResizerFactory)
will
cause the ResizerFactory
used by the resulting
ThumbnailParameter
to only return the specified Resizer
.
resizer
- The Resizer
to use when creating the
thumbnail.
public ThumbnailParameterBuilder resizerFactory(ResizerFactory resizerFactory)
ResizerFactory
to use to obtain a Resizer
when
performing the resizing operation to create the thumbnail.
Calling this method after resizer(Resizer)
could result in
Resizer
s not specified in the resizer
method to be used
when creating thumbnails.
resizerFactory
- The ResizerFactory
to use when obtaining
a Resizer
to create the thumbnail.
public ThumbnailParameterBuilder fitWithinDimensions(boolean fit)
fit
- true
if the thumbnail should be sized to fit
within the specified dimensions, if the thumbnail
is going to exceed those dimensions.
public ThumbnailParameterBuilder useExifOrientation(boolean use)
use
- true
if the Exif metadata should be used
to determine the orientation of the thumbnail,
false
otherwise.
public ThumbnailParameter build()
ThumbnailParameter
from the parameters which are
currently set.
This method will throw a IllegalArgumentException
required
parameters for the ThumbnailParameter
have not been set.
ThumbnailParameter
with parameters set through
the use of this builder.
IllegalStateException
- If neither the size nor the scaling
factor has been set.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |