Class Pipeline
- java.lang.Object
-
- net.coobird.thumbnailator.filters.Pipeline
-
- All Implemented Interfaces:
ImageFilter
public final class Pipeline extends java.lang.Object implements ImageFilter
AnImageFilterwhich will apply multipleImageFilters in a specific order.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<ImageFilter>filtersToApplyA list of image filters to apply.private java.util.List<ImageFilter>unmodifiableFiltersToApplyAn unmodifiable list of image filters to apply.
-
Constructor Summary
Constructors Constructor Description Pipeline()Instantiates a newPipelinewith no image filters to apply.Pipeline(java.util.List<ImageFilter> filters)Instantiates a newPipelinewith a list ofImageFilters to apply.Pipeline(ImageFilter... filters)Instantiates a newPipelinewith an array ofImageFilters to apply.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(ImageFilter filter)Adds anImageFilterto the pipeline.voidaddAll(java.util.List<ImageFilter> filters)Adds aListofImageFilters to the pipeline.voidaddFirst(ImageFilter filter)Adds anImageFilterto the beginning of the pipeline.java.awt.image.BufferedImageapply(java.awt.image.BufferedImage img)Applies a image filtering operation on an image.java.util.List<ImageFilter>getFilters()Returns a list ofImageFilters which will be applied by thisPipeline.
-
-
-
Field Detail
-
filtersToApply
private final java.util.List<ImageFilter> filtersToApply
A list of image filters to apply.
-
unmodifiableFiltersToApply
private final java.util.List<ImageFilter> unmodifiableFiltersToApply
An unmodifiable list of image filters to apply. Used by thegetFilters()method. This object is created by Collections.unmodifiableList which provides an unmodifiable view of the original list. Therefore, any changes to the original list will also be "visible" from this list as well.
-
-
Constructor Detail
-
Pipeline
public Pipeline()
Instantiates a newPipelinewith no image filters to apply.
-
Pipeline
public Pipeline(ImageFilter... filters)
Instantiates a newPipelinewith an array ofImageFilters to apply.- Parameters:
filters- An array ofImageFilters to apply.
-
Pipeline
public Pipeline(java.util.List<ImageFilter> filters)
Instantiates a newPipelinewith a list ofImageFilters to apply.- Parameters:
filters- A list ofImageFilters to apply.
-
-
Method Detail
-
add
public void add(ImageFilter filter)
Adds anImageFilterto the pipeline.- Parameters:
filter- AnImageFilter.
-
addFirst
public void addFirst(ImageFilter filter)
Adds anImageFilterto the beginning of the pipeline.- Parameters:
filter- AnImageFilter.
-
addAll
public void addAll(java.util.List<ImageFilter> filters)
Adds aListofImageFilters to the pipeline.- Parameters:
filters- A list of filters to add to the pipeline.
-
getFilters
public java.util.List<ImageFilter> getFilters()
Returns a list ofImageFilters which will be applied by thisPipeline.- Returns:
- A list of filters which are applied by this pipeline.
-
apply
public java.awt.image.BufferedImage apply(java.awt.image.BufferedImage img)
Description copied from interface:ImageFilterApplies a image filtering operation on an image.- Specified by:
applyin interfaceImageFilter- Parameters:
img- The image to apply the filtering on.- Returns:
- The resulting image after applying this filter.
-
-