Package org.apache.poi.sl.draw
Class DrawPaint
- java.lang.Object
-
- org.apache.poi.sl.draw.DrawPaint
-
public class DrawPaint extends Object
This class handles color transformations.- See Also:
- HSL code taken from Java Tips Weblog
-
-
Field Summary
Fields Modifier and Type Field Description protected PlaceableShape<?,?>
shape
-
Constructor Summary
Constructors Constructor Description DrawPaint(PlaceableShape<?,?> shape)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Color
applyColorTransform(ColorStyle color)
Convert color transformations inColorStyle
to aColor
instanceprotected Paint
createLinearGradientPaint(PaintStyle.GradientPaint fill, Graphics2D graphics)
protected Paint
createPathGradientPaint(PaintStyle.GradientPaint fill, Graphics2D graphics)
protected Paint
createRadialGradientPaint(PaintStyle.GradientPaint fill, Graphics2D graphics)
static PaintStyle.SolidPaint
createSolidPaint(Color color)
static PaintStyle.SolidPaint
createSolidPaint(ColorStyle color)
protected Paint
getGradientPaint(PaintStyle.GradientPaint fill, Graphics2D graphics)
Paint
getPaint(Graphics2D graphics, PaintStyle paint)
Paint
getPaint(Graphics2D graphics, PaintStyle paint, PaintStyle.PaintModifier modifier)
protected Paint
getSolidPaint(PaintStyle.SolidPaint fill, Graphics2D graphics, PaintStyle.PaintModifier modifier)
protected Paint
getTexturePaint(PaintStyle.TexturePaint fill, Graphics2D graphics)
static Color
HSL2RGB(double h, double s, double l, double alpha)
Convert HSL values to a RGB Color.static double[]
RGB2HSL(Color color)
Convert a RGB Color to it corresponding HSL values.static double[]
RGB2SCRGB(Color color)
Convert sRGB Color to scRGB [0..1] (0:red,1:green,2:blue).static Color
SCRGB2RGB(double... scRGB)
Convert scRGB [0..1] components (0:red,1:green,2:blue) to sRGB Color.
-
-
-
Field Detail
-
shape
protected PlaceableShape<?,?> shape
-
-
Constructor Detail
-
DrawPaint
public DrawPaint(PlaceableShape<?,?> shape)
-
-
Method Detail
-
createSolidPaint
public static PaintStyle.SolidPaint createSolidPaint(Color color)
-
createSolidPaint
public static PaintStyle.SolidPaint createSolidPaint(ColorStyle color)
-
getPaint
public Paint getPaint(Graphics2D graphics, PaintStyle paint)
-
getPaint
public Paint getPaint(Graphics2D graphics, PaintStyle paint, PaintStyle.PaintModifier modifier)
-
getSolidPaint
protected Paint getSolidPaint(PaintStyle.SolidPaint fill, Graphics2D graphics, PaintStyle.PaintModifier modifier)
-
getGradientPaint
protected Paint getGradientPaint(PaintStyle.GradientPaint fill, Graphics2D graphics)
-
getTexturePaint
protected Paint getTexturePaint(PaintStyle.TexturePaint fill, Graphics2D graphics)
-
applyColorTransform
public static Color applyColorTransform(ColorStyle color)
Convert color transformations inColorStyle
to aColor
instance
-
createLinearGradientPaint
protected Paint createLinearGradientPaint(PaintStyle.GradientPaint fill, Graphics2D graphics)
-
createRadialGradientPaint
protected Paint createRadialGradientPaint(PaintStyle.GradientPaint fill, Graphics2D graphics)
-
createPathGradientPaint
protected Paint createPathGradientPaint(PaintStyle.GradientPaint fill, Graphics2D graphics)
-
HSL2RGB
public static Color HSL2RGB(double h, double s, double l, double alpha)
Convert HSL values to a RGB Color.- Parameters:
h
- Hue is specified as degrees in the range 0 - 360.s
- Saturation is specified as a percentage in the range 1 - 100.l
- Luminance is specified as a percentage in the range 1 - 100.alpha
- the alpha value between 0 - 1- Returns:
- the RGB Color object
-
RGB2HSL
public static double[] RGB2HSL(Color color)
Convert a RGB Color to it corresponding HSL values.- Returns:
- an array containing the 3 HSL values.
-
RGB2SCRGB
public static double[] RGB2SCRGB(Color color)
Convert sRGB Color to scRGB [0..1] (0:red,1:green,2:blue). Alpha needs to be handled separately.- See Also:
- .Net implementation sRgbToScRgb
-
SCRGB2RGB
public static Color SCRGB2RGB(double... scRGB)
Convert scRGB [0..1] components (0:red,1:green,2:blue) to sRGB Color. Alpha needs to be handled separately.- See Also:
- .Net implementation ScRgbTosRgb
-
-