Package com.cloudinary
Class Transformation<T extends Transformation>
- java.lang.Object
-
- com.cloudinary.Transformation<T>
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
EagerTransformation
public class Transformation<T extends Transformation> extends java.lang.Object implements java.io.Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.Object
defaultDPR
protected static boolean
defaultIsResponsive
protected boolean
hiDPI
protected java.lang.String
htmlHeight
protected java.lang.String
htmlWidth
protected boolean
isResponsive
protected static java.util.Map
responsiveWidthTransformation
protected java.util.Map
transformation
protected java.util.List<java.util.Map>
transformations
static java.lang.String
VAR_NAME_RE
-
Constructor Summary
Constructors Constructor Description Transformation()
Transformation(Transformation transformation)
Transformation(java.util.List<java.util.Map> transformations)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description T
angle(int value)
T
angle(java.lang.String... value)
T
aspectRatio(double value)
T
aspectRatio(int nom, int denom)
T
aspectRatio(java.lang.String value)
T
audioCodec(java.lang.String value)
T
audioFrequency(int value)
T
audioFrequency(java.lang.String value)
T
background(java.lang.String value)
T
bitRate(int value)
T
bitRate(java.lang.String value)
T
border(int width, java.lang.String color)
T
border(java.lang.String value)
T
chain()
T
chainWith(Transformation transformation)
T
color(java.lang.String value)
T
colorSpace(java.lang.String value)
T
crop(java.lang.String value)
T
customFunction(CustomFunction action)
Set a custom action, such as a call to a lambda function or a web-assembly function.T
customPreFunction(CustomFunction action)
Set a custom pre-function, such as a call to a lambda function or a web-assembly function.T
defaultImage(java.lang.String value)
T
delay(java.lang.Object value)
T
density(java.lang.Object value)
T
dpr(float value)
T
dpr(int value)
T
dpr(java.lang.String value)
T
duration(double value)
T
duration(float value)
T
duration(java.lang.String value)
T
durationPercent(double value)
T
durationPercent(float value)
T
effect(java.lang.String value)
T
effect(java.lang.String effect, java.lang.Object param)
T
endIf()
T
endOffset(double value)
T
endOffset(float value)
T
endOffset(java.lang.String value)
T
endOffsetPercent(double value)
T
endOffsetPercent(float value)
T
fetchFormat(java.lang.String value)
T
flags(java.lang.String... value)
T
fps(double value)
fps (frames per second) parameter for videoT
fps(int value)
fps (frames per second) parameter for videoT
fps(java.lang.Object rangeStart, java.lang.Object rangeEnd)
fps (frames per second) parameter for videoT
fps(java.lang.String value)
fps (frames per second) parameter for videojava.lang.String
generate()
Serialize this transformation object as a stringjava.lang.String
generate(java.lang.Iterable<java.util.Map> optionsList)
java.lang.String
generate(java.util.Map options)
java.lang.String
getHtmlHeight()
java.lang.String
getHtmlWidth()
T
gravity(java.lang.String value)
T
height(java.lang.Object value)
Condition
ifCondition()
Start defining a condition, which will be completed with a callCondition.then()
T
ifCondition(Condition condition)
Define a conditional transformationT
ifCondition(Expression expression)
Define a conditional transformationT
ifCondition(java.lang.String condition)
Define a conditional transformation defined by the condition stringT
ifElse()
boolean
isHiDPI()
boolean
isResponsive()
T
keyframeInterval(float value)
Set the keyframe interval parameterT
keyframeInterval(java.lang.String value)
Set the keyframe interval parameterT
named(java.lang.String... value)
T
offset(double[] value)
T
offset(float[] value)
T
offset(java.lang.Number[] value)
T
offset(java.lang.String value)
T
offset(java.lang.String[] value)
T
opacity(java.lang.Object value)
T
overlay(AbstractLayer<?> value)
T
overlay(java.lang.String value)
T
page(java.lang.Object value)
T
param(java.lang.String key, java.lang.Object value)
T
params(java.util.Map transformation)
T
prefix(java.lang.String value)
T
quality(java.lang.Object value)
T
radius(java.lang.Object value)
Add rounding transformation.T
radius(java.lang.Object[] cornerRadiuses)
Add rounding transformation.T
radius(java.lang.Object topLeftBottomRight, java.lang.Object topRightBottomLeft)
Add rounding transformation.T
radius(java.lang.Object topLeft, java.lang.Object topRightBottomLeft, java.lang.Object bottomRight)
Add rounding transformation.T
radius(java.lang.Object topLeft, java.lang.Object topRight, java.lang.Object bottomRight, java.lang.Object bottomLeft)
Add rounding transformation.T
rawTransformation(java.lang.String value)
T
responsiveWidth(boolean value)
static void
setDefaultDPR(java.lang.Object dpr)
static void
setDefaultIsResponsive(boolean isResponsive)
static void
setResponsiveWidthTransformation(java.util.Map transformation)
T
startOffset(double value)
T
startOffset(float value)
T
startOffset(java.lang.String value)
T
startOffsetPercent(double value)
T
startOffsetPercent(float value)
T
streamingProfile(java.lang.String value)
java.lang.String
toString()
T
underlay(AbstractLayer<?> value)
T
underlay(java.lang.String value)
T
variable(java.lang.String name, java.lang.Object value)
Add a variable assignment.T
variables(Expression... variables)
Add a sequence of variable assignments.T
videoCodec(java.lang.String value)
T
videoCodec(java.util.Map<java.lang.String,java.lang.String> value)
T
videoSampling(java.lang.String value)
T
videoSamplingFrames(int value)
T
videoSamplingSeconds(double value)
T
videoSamplingSeconds(float value)
T
videoSamplingSeconds(int value)
T
videoSamplingSeconds(java.lang.Number value)
T
width(java.lang.Object value)
T
x(java.lang.Object value)
T
y(java.lang.Object value)
T
zoom(double value)
T
zoom(float value)
T
zoom(java.lang.String value)
-
-
-
Field Detail
-
VAR_NAME_RE
public static final java.lang.String VAR_NAME_RE
- See Also:
- Constant Field Values
-
transformation
protected java.util.Map transformation
-
transformations
protected java.util.List<java.util.Map> transformations
-
htmlWidth
protected java.lang.String htmlWidth
-
htmlHeight
protected java.lang.String htmlHeight
-
hiDPI
protected boolean hiDPI
-
isResponsive
protected boolean isResponsive
-
defaultIsResponsive
protected static boolean defaultIsResponsive
-
defaultDPR
protected static java.lang.Object defaultDPR
-
responsiveWidthTransformation
protected static java.util.Map responsiveWidthTransformation
-
-
Constructor Detail
-
Transformation
public Transformation(Transformation transformation)
-
Transformation
public Transformation(java.util.List<java.util.Map> transformations)
-
Transformation
public Transformation()
-
-
Method Detail
-
width
public T width(java.lang.Object value)
-
height
public T height(java.lang.Object value)
-
named
public T named(java.lang.String... value)
-
crop
public T crop(java.lang.String value)
-
background
public T background(java.lang.String value)
-
color
public T color(java.lang.String value)
-
effect
public T effect(java.lang.String value)
-
effect
public T effect(java.lang.String effect, java.lang.Object param)
-
angle
public T angle(int value)
-
angle
public T angle(java.lang.String... value)
-
border
public T border(java.lang.String value)
-
border
public T border(int width, java.lang.String color)
-
x
public T x(java.lang.Object value)
-
y
public T y(java.lang.Object value)
-
radius
public T radius(java.lang.Object value)
Add rounding transformation.Radius can be specified either as value in pixels or expression. Specify 0 to keep corner untouched.
- Parameters:
value
- rounding radius for all four corners- Returns:
- updated transformation instance for chaining
-
radius
public T radius(java.lang.Object topLeftBottomRight, java.lang.Object topRightBottomLeft)
Add rounding transformation.Radius can be specified either as value in pixels or expression. Specify 0 to keep corner untouched.
- Parameters:
topLeftBottomRight
- rounding radius for top-left and bottom-right cornerstopRightBottomLeft
- rounding radius for top-right and bottom-left corners- Returns:
- updated transformation instance for chaining
-
radius
public T radius(java.lang.Object topLeft, java.lang.Object topRightBottomLeft, java.lang.Object bottomRight)
Add rounding transformation.Radius can be specified either as value in pixels or expression. Specify 0 to keep corner untouched.
- Parameters:
topLeft
- rounding radius for top-left cornertopRightBottomLeft
- rounding radius for top-right and bottom-left cornersbottomRight
- rounding radius for bottom-right corner- Returns:
- updated transformation instance for chaining
-
radius
public T radius(java.lang.Object topLeft, java.lang.Object topRight, java.lang.Object bottomRight, java.lang.Object bottomLeft)
Add rounding transformation.Radius can be specified either as value in pixels or expression. Specify 0 to keep corner untouched.
- Parameters:
topLeft
- rounding radius for top-left cornertopRight
- rounding radius for top-right cornerbottomRight
- rounding radius for bottom-right cornerbottomLeft
- rounding radius for bottom-left corner- Returns:
- updated transformation instance for chaining
-
radius
public T radius(java.lang.Object[] cornerRadiuses)
Add rounding transformation.Radius can be specified either as value in pixels or expression. Specify 0 to keep corner untouched.
- Parameters:
cornerRadiuses
- rounding radiuses for corners as array- Returns:
- updated transformation instance for chaining
-
quality
public T quality(java.lang.Object value)
-
defaultImage
public T defaultImage(java.lang.String value)
-
gravity
public T gravity(java.lang.String value)
-
keyframeInterval
public T keyframeInterval(float value)
Set the keyframe interval parameter- Parameters:
value
- Interval in seconds- Returns:
- The transformation for chaining
-
keyframeInterval
public T keyframeInterval(java.lang.String value)
Set the keyframe interval parameter- Parameters:
value
- Interval in seconds.- Returns:
- The transformation for chaining
-
colorSpace
public T colorSpace(java.lang.String value)
-
prefix
public T prefix(java.lang.String value)
-
overlay
public T overlay(java.lang.String value)
-
overlay
public T overlay(AbstractLayer<?> value)
-
underlay
public T underlay(java.lang.String value)
-
underlay
public T underlay(AbstractLayer<?> value)
-
fetchFormat
public T fetchFormat(java.lang.String value)
-
density
public T density(java.lang.Object value)
-
page
public T page(java.lang.Object value)
-
delay
public T delay(java.lang.Object value)
-
opacity
public T opacity(java.lang.Object value)
-
rawTransformation
public T rawTransformation(java.lang.String value)
-
flags
public T flags(java.lang.String... value)
-
dpr
public T dpr(float value)
-
dpr
public T dpr(int value)
-
dpr
public T dpr(java.lang.String value)
-
duration
public T duration(java.lang.String value)
-
duration
public T duration(float value)
-
duration
public T duration(double value)
-
durationPercent
public T durationPercent(float value)
-
durationPercent
public T durationPercent(double value)
-
startOffset
public T startOffset(java.lang.String value)
-
startOffset
public T startOffset(float value)
-
startOffset
public T startOffset(double value)
-
startOffsetPercent
public T startOffsetPercent(float value)
-
startOffsetPercent
public T startOffsetPercent(double value)
-
endOffset
public T endOffset(java.lang.String value)
-
endOffset
public T endOffset(float value)
-
endOffset
public T endOffset(double value)
-
endOffsetPercent
public T endOffsetPercent(float value)
-
endOffsetPercent
public T endOffsetPercent(double value)
-
offset
public T offset(java.lang.String value)
-
offset
public T offset(java.lang.String[] value)
-
offset
public T offset(float[] value)
-
offset
public T offset(double[] value)
-
offset
public T offset(java.lang.Number[] value)
-
videoCodec
public T videoCodec(java.lang.String value)
-
videoCodec
public T videoCodec(java.util.Map<java.lang.String,java.lang.String> value)
-
audioCodec
public T audioCodec(java.lang.String value)
-
audioFrequency
public T audioFrequency(java.lang.String value)
-
audioFrequency
public T audioFrequency(int value)
-
bitRate
public T bitRate(java.lang.String value)
-
bitRate
public T bitRate(int value)
-
videoSampling
public T videoSampling(java.lang.String value)
-
videoSamplingFrames
public T videoSamplingFrames(int value)
-
videoSamplingSeconds
public T videoSamplingSeconds(java.lang.Number value)
-
videoSamplingSeconds
public T videoSamplingSeconds(int value)
-
videoSamplingSeconds
public T videoSamplingSeconds(float value)
-
videoSamplingSeconds
public T videoSamplingSeconds(double value)
-
zoom
public T zoom(java.lang.String value)
-
zoom
public T zoom(float value)
-
zoom
public T zoom(double value)
-
aspectRatio
public T aspectRatio(double value)
-
aspectRatio
public T aspectRatio(java.lang.String value)
-
aspectRatio
public T aspectRatio(int nom, int denom)
-
responsiveWidth
public T responsiveWidth(boolean value)
-
ifCondition
public Condition ifCondition()
Start defining a condition, which will be completed with a callCondition.then()
- Returns:
- condition
-
ifCondition
public T ifCondition(java.lang.String condition)
Define a conditional transformation defined by the condition string- Parameters:
condition
- a condition string- Returns:
- the transformation for chaining
-
ifCondition
public T ifCondition(Expression expression)
Define a conditional transformation- Parameters:
expression
- a condition- Returns:
- the transformation for chaining
-
ifCondition
public T ifCondition(Condition condition)
Define a conditional transformation- Parameters:
condition
- a condition- Returns:
- the transformation for chaining
-
ifElse
public T ifElse()
-
endIf
public T endIf()
-
fps
public T fps(java.lang.String value)
fps (frames per second) parameter for video- Parameters:
value
- Either a single value int or float or a range in the format<start>[-<end>]
.
For example,23-29.7
- Returns:
- the transformation for chaining
-
fps
public T fps(double value)
fps (frames per second) parameter for video- Parameters:
value
- the desired fps- Returns:
- the transformation for chaining
-
fps
public T fps(int value)
fps (frames per second) parameter for video- Parameters:
value
- the desired fps- Returns:
- the transformation for chaining
-
fps
public T fps(java.lang.Object rangeStart, java.lang.Object rangeEnd)
fps (frames per second) parameter for video- Parameters:
rangeStart
- String or Number, can be null for open range.rangeEnd
- String or Number, can be null for open range.- Returns:
- the transformation for chaining.
-
streamingProfile
public T streamingProfile(java.lang.String value)
-
isResponsive
public boolean isResponsive()
-
isHiDPI
public boolean isHiDPI()
-
params
public T params(java.util.Map transformation)
-
chain
public T chain()
-
chainWith
public T chainWith(Transformation transformation)
-
param
public T param(java.lang.String key, java.lang.Object value)
-
generate
public java.lang.String generate()
Serialize this transformation object as a stringTransformation().width(100).height(101).generate(); // produces "h_101,w_100"
- Returns:
- a String representation of the transformation
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
generate
public java.lang.String generate(java.lang.Iterable<java.util.Map> optionsList)
-
generate
public java.lang.String generate(java.util.Map options)
-
getHtmlWidth
public java.lang.String getHtmlWidth()
-
getHtmlHeight
public java.lang.String getHtmlHeight()
-
setResponsiveWidthTransformation
public static void setResponsiveWidthTransformation(java.util.Map transformation)
-
setDefaultIsResponsive
public static void setDefaultIsResponsive(boolean isResponsive)
-
setDefaultDPR
public static void setDefaultDPR(java.lang.Object dpr)
-
variable
public T variable(java.lang.String name, java.lang.Object value)
Add a variable assignment. Each call to this method will add a new variable assignments, but the order of the assignments may change. To enforce a particular order, usevariables(Expression...)
- Parameters:
name
- the name of the variablevalue
- the value to assign to the variable- Returns:
- this for chaining
-
variables
public T variables(Expression... variables)
Add a sequence of variable assignments. The order of the assignments will be honored.- Parameters:
variables
- variable expressions- Returns:
- this for chaining
-
customFunction
public T customFunction(CustomFunction action)
Set a custom action, such as a call to a lambda function or a web-assembly function.- Parameters:
action
- The custom action to perform, seeCustomFunction
.- Returns:
- The transformation for chaining
-
customPreFunction
public T customPreFunction(CustomFunction action)
Set a custom pre-function, such as a call to a lambda function or a web-assembly function.- Parameters:
action
- The custom action to perform, seeCustomFunction
.- Returns:
- The transformation for chaining
-
-