Class BufferedImageBuilder
- java.lang.Object
-
- net.coobird.thumbnailator.builders.BufferedImageBuilder
-
public final class BufferedImageBuilder extends java.lang.ObjectA builder for creatingBufferedImagewith specified parameters.
-
-
Field Summary
Fields Modifier and Type Field Description private static intDEFAULT_TYPEThe default image type of theBufferedImages to be created by this builder.private intheightThe height to use for theBufferedImagethat is to be created.private intimageTypeThe image type to use for theBufferedImagethat is to be created.private intwidthThe width to use for theBufferedImagethat is to be created.
-
Constructor Summary
Constructors Constructor Description BufferedImageBuilder(int width, int height)Instantiates aBufferedImageBuilderwith the specified size, and the default image type.BufferedImageBuilder(int width, int height, int imageType)Instantiates aBufferedImageBuilderwith the specified size and image type.BufferedImageBuilder(java.awt.Dimension size)Instantiates aBufferedImageBuilderwith the specified size, and the default image type.BufferedImageBuilder(java.awt.Dimension size, int imageType)Instantiates aBufferedImageBuilderwith the specified size and image type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.image.BufferedImagebuild()Generates a newBufferedImage.BufferedImageBuilderheight(int height)Sets the height for theBufferedImage.BufferedImageBuilderimageType(int imageType)Sets the type of the image of theBufferedImage.BufferedImageBuildersize(int width, int height)Sets the size for theBufferedImage.BufferedImageBuilderwidth(int width)Sets the width for theBufferedImage.
-
-
-
Field Detail
-
DEFAULT_TYPE
private static final int DEFAULT_TYPE
The default image type of theBufferedImages to be created by this builder.- See Also:
- Constant Field Values
-
imageType
private int imageType
The image type to use for theBufferedImagethat is to be created.
-
width
private int width
The width to use for theBufferedImagethat is to be created.
-
height
private int height
The height to use for theBufferedImagethat is to be created.
-
-
Constructor Detail
-
BufferedImageBuilder
public BufferedImageBuilder(java.awt.Dimension size)
Instantiates aBufferedImageBuilderwith the specified size, and the default image type.- Parameters:
size- The size of theBufferedImageto build.
-
BufferedImageBuilder
public BufferedImageBuilder(java.awt.Dimension size, int imageType)Instantiates aBufferedImageBuilderwith the specified size and image type.- Parameters:
size- The size of theBufferedImageto build.imageType- The image type of theBufferedImageto build.
-
BufferedImageBuilder
public BufferedImageBuilder(int width, int height)Instantiates aBufferedImageBuilderwith the specified size, and the default image type.- Parameters:
width- The width of theBufferedImageto build.height- The height of theBufferedImageto build.
-
BufferedImageBuilder
public BufferedImageBuilder(int width, int height, int imageType)Instantiates aBufferedImageBuilderwith the specified size and image type.- Parameters:
width- The width of theBufferedImageto build.height- The height of theBufferedImageto build.imageType- The image type of theBufferedImageto build.
-
-
Method Detail
-
build
public java.awt.image.BufferedImage build()
Generates a newBufferedImage.- Returns:
- Returns a newly created
BufferedImagefrom the parameters set in theBufferedImageBuilder.
-
imageType
public BufferedImageBuilder imageType(int imageType)
Sets the type of the image of theBufferedImage.- Parameters:
imageType- The image type to use. IfBufferedImage.TYPE_CUSTOMis used, it be substituted byBufferedImage.TYPE_INT_ARGB.- Returns:
- This
BufferedImageBuilderinstance.
-
size
public BufferedImageBuilder size(int width, int height)
Sets the size for theBufferedImage.- Parameters:
width- The width of the image to create.height- The height of the image to create.- Returns:
- This
BufferedImageBuilderinstance.
-
width
public BufferedImageBuilder width(int width)
Sets the width for theBufferedImage.- Parameters:
width- The width of the image to create.- Returns:
- This
BufferedImageBuilderinstance.
-
height
public BufferedImageBuilder height(int height)
Sets the height for theBufferedImage.- Parameters:
height- The height of the image to create.- Returns:
- This
BufferedImageBuilderinstance.
-
-