Class GradientColorStop
- java.lang.Object
-
- com.itextpdf.kernel.colors.gradients.GradientColorStop
-
public class GradientColorStop extends java.lang.ObjectThe gradient stop color structure representing the stop color configuration. The stop color consists of: -float[]rgb color array. Values should be in [0, 1] range. All values outside of this range would be adjusted to the nearest corner of the range. -doubleoffset andGradientColorStop.OffsetTypeoffset type specifies the coordinate of the stop color on the targeting gradient coordinates vector -doublehint offset andGradientColorStop.HintOffsetTypehint offset type specifies the color transition mid point offset between the current color and the next color
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGradientColorStop.HintOffsetTypeRepresents the possible hint offset typestatic classGradientColorStop.OffsetTypeRepresents the possible offset type
-
Field Summary
Fields Modifier and Type Field Description private doublehintOffsetprivate GradientColorStop.HintOffsetTypehintOffsetTypeprivate doubleoffsetprivate GradientColorStop.OffsetTypeoffsetTypeprivate floatopacityprivate float[]rgb
-
Constructor Summary
Constructors Modifier Constructor Description GradientColorStop(float[] rgb)Constructor of stop color with with specified rgb color and default (GradientColorStop.OffsetType.AUTO) offsetGradientColorStop(float[] rgb, double offset, GradientColorStop.OffsetType offsetType)Constructor of stop color with with specified rgb color and offsetprivateGradientColorStop(float[] rgb, float opacity, double offset, GradientColorStop.OffsetType offsetType)GradientColorStop(GradientColorStop gradientColorStop, double offset, GradientColorStop.OffsetType offsetType)Constructor that creates the stop with the same color as the another stop and new offset
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static float[]copyRgbArray(float[] toCopy)booleanequals(java.lang.Object o)doublegetHintOffset()Get the hint offset valueGradientColorStop.HintOffsetTypegetHintOffsetType()Get the hint offset typedoublegetOffset()Get the offset valueGradientColorStop.OffsetTypegetOffsetType()Get the offset typeprivate floatgetOpacity()Get the stop color opacity valuefloat[]getRgbArray()Get the stop color rgb valueinthashCode()private static floatnormalize(float toNormalize)GradientColorStopsetHint(double hintOffset, GradientColorStop.HintOffsetType hintOffsetType)Set the color hint specified by its value and type (more details).GradientColorStopsetOffset(double offset, GradientColorStop.OffsetType offsetType)Set the offset specified by its value and type
-
-
-
Field Detail
-
rgb
private final float[] rgb
-
opacity
private final float opacity
-
offsetType
private GradientColorStop.OffsetType offsetType
-
offset
private double offset
-
hintOffset
private double hintOffset
-
hintOffsetType
private GradientColorStop.HintOffsetType hintOffsetType
-
-
Constructor Detail
-
GradientColorStop
public GradientColorStop(float[] rgb)
Constructor of stop color with with specified rgb color and default (GradientColorStop.OffsetType.AUTO) offset- Parameters:
rgb- the color value
-
GradientColorStop
public GradientColorStop(float[] rgb, double offset, GradientColorStop.OffsetType offsetType)Constructor of stop color with with specified rgb color and offset- Parameters:
rgb- the color valueoffset- the offset value. Makes sense only if theoffsetTypeis notGradientColorStop.OffsetType.AUTOoffsetType- the offset's type
-
GradientColorStop
public GradientColorStop(GradientColorStop gradientColorStop, double offset, GradientColorStop.OffsetType offsetType)
Constructor that creates the stop with the same color as the another stop and new offset- Parameters:
gradientColorStop- the gradient stop color from which the color value would be copiedoffset- the new offset. Makes sense only if theoffsetTypeis notGradientColorStop.OffsetType.AUTOoffsetType- the new offset's type
-
GradientColorStop
private GradientColorStop(float[] rgb, float opacity, double offset, GradientColorStop.OffsetType offsetType)
-
-
Method Detail
-
getRgbArray
public float[] getRgbArray()
Get the stop color rgb value- Returns:
- the copy of stop's rgb value
-
getOpacity
private float getOpacity()
Get the stop color opacity value- Returns:
- the stop color opacity value
-
getOffsetType
public GradientColorStop.OffsetType getOffsetType()
Get the offset type- Returns:
- the offset type
-
getOffset
public double getOffset()
Get the offset value- Returns:
- the offset value
-
getHintOffset
public double getHintOffset()
Get the hint offset value- Returns:
- the hint offset value
-
getHintOffsetType
public GradientColorStop.HintOffsetType getHintOffsetType()
Get the hint offset type- Returns:
- the hint offset type
-
setOffset
public GradientColorStop setOffset(double offset, GradientColorStop.OffsetType offsetType)
Set the offset specified by its value and type- Parameters:
offset- the offset's value to be set. Makes sense only if theoffsetTypeis notGradientColorStop.OffsetType.AUTOoffsetType- the offset's type to be set- Returns:
- the current
GradientColorStopinstance
-
setHint
public GradientColorStop setHint(double hintOffset, GradientColorStop.HintOffsetType hintOffsetType)
Set the color hint specified by its value and type (more details).- Parameters:
hintOffset- the hint offset's value to be set. Makes sense only if thehintOffsetTypeis notGradientColorStop.HintOffsetType.NONEhintOffsetType- the hint offset's type to be set- Returns:
- the current
GradientColorStopinstance
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
normalize
private static float normalize(float toNormalize)
-
copyRgbArray
private static float[] copyRgbArray(float[] toCopy)
-
-