Class ThumbnailParameterBuilder

    • Field Detail

      • width

        private int width
      • height

        private int height
      • widthScalingFactor

        private double widthScalingFactor
      • heightScalingFactor

        private double heightScalingFactor
      • imageType

        private int imageType
      • keepAspectRatio

        private boolean keepAspectRatio
      • thumbnailQuality

        private float thumbnailQuality
      • thumbnailFormat

        private java.lang.String thumbnailFormat
      • thumbnailFormatType

        private java.lang.String thumbnailFormatType
      • sourceRegion

        private Region sourceRegion
      • fitWithinDimensions

        private boolean fitWithinDimensions
      • useExifOrientation

        private boolean useExifOrientation
    • Method Detail

      • imageType

        public ThumbnailParameterBuilder imageType​(int type)
        Sets the image type fo the thumbnail.
        Parameters:
        type - The image type of the thumbnail.
        Returns:
        A reference to this object.
      • size

        public ThumbnailParameterBuilder size​(java.awt.Dimension size)
        Sets the size of the thumbnail.
        Parameters:
        size - The dimensions of the thumbnail.
        Returns:
        A reference to this object.
      • size

        public ThumbnailParameterBuilder size​(int width,
                                              int height)
        Sets the size of the thumbnail.
        Parameters:
        width - The width of the thumbnail.
        height - The height of the thumbnail.
        Returns:
        A reference to this object.
        Throws:
        java.lang.IllegalArgumentException - If the widht or height is less than 0.
      • scale

        public ThumbnailParameterBuilder scale​(double scalingFactor)
        Sets the scaling factor of the thumbnail.
        Parameters:
        scalingFactor - The scaling factor of the thumbnail.
        Returns:
        A reference to this object.
        Throws:
        java.lang.IllegalArgumentException - If the scaling factor is not a rational number, or if it is less than 0.0.
      • scale

        public ThumbnailParameterBuilder scale​(double widthScalingFactor,
                                               double heightScalingFactor)
        Sets the scaling factor of the thumbnail.
        Parameters:
        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.
        Returns:
        A reference to this object.
        Throws:
        java.lang.IllegalArgumentException - If the scaling factor is not a rational number, or if it is less than 0.0.
        Since:
        0.3.10
      • region

        public ThumbnailParameterBuilder region​(Region sourceRegion)
        Sets the region of the source image to use when creating a thumbnail.
        Parameters:
        sourceRegion - The region of the source image to use when creating a thumbnail.
        Returns:
        A reference to this object.
        Since:
        0.3.4
      • keepAspectRatio

        public ThumbnailParameterBuilder keepAspectRatio​(boolean keep)
        Sets whether or not the thumbnail is to maintain the aspect ratio of the original image.
        Parameters:
        keep - true if the aspect ratio of the original image is to be maintained in the thumbnail, false otherwise.
        Returns:
        A reference to this object.
      • quality

        public ThumbnailParameterBuilder quality​(float quality)
        Sets the compression quality setting of the thumbnail.

        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.

        Parameters:
        quality - The compression quality setting of the thumbnail.
        Returns:
        A reference to this object.
      • format

        public ThumbnailParameterBuilder format​(java.lang.String format)
        Sets the output format of the thumbnail.
        Parameters:
        format - The output format of the thumbnail.
        Returns:
        A reference to this object.
      • formatType

        public ThumbnailParameterBuilder formatType​(java.lang.String formatType)
        Sets the output format type of the thumbnail.
        Parameters:
        formatType - The output format type of the thumbnail.
        Returns:
        A reference to this object.
      • filters

        public ThumbnailParameterBuilder filters​(java.util.List<ImageFilter> filters)
        Sets the ImageFilters to apply to the thumbnail.

        These filters will be applied after the original image is resized.

        Parameters:
        filters - The output format type of the thumbnail.
        Returns:
        A reference to this object.
      • fitWithinDimensions

        public ThumbnailParameterBuilder fitWithinDimensions​(boolean fit)
        Sets whether or not the thumbnail should fit within the specified dimensions.
        Parameters:
        fit - true if the thumbnail should be sized to fit within the specified dimensions, if the thumbnail is going to exceed those dimensions.
        Returns:
        A reference to this object.
        Since:
        0.4.0
      • useExifOrientation

        public ThumbnailParameterBuilder useExifOrientation​(boolean use)
        Sets whether or not the Exif metadata should be used to determine the orientation of the thumbnail.
        Parameters:
        use - true if the Exif metadata should be used to determine the orientation of the thumbnail, false otherwise.
        Returns:
        A reference to this object.
        Since:
        0.4.3
      • build

        public ThumbnailParameter build()
        Returns a ThumbnailParameter from the parameters which are currently set.

        This method will throw a IllegalArgumentException required parameters for the ThumbnailParameter have not been set.

        Returns:
        A ThumbnailParameter with parameters set through the use of this builder.
        Throws:
        java.lang.IllegalStateException - If neither the size nor the scaling factor has been set.