Class PaintAlpha
- java.lang.Object
-
- org.jfree.chart.util.PaintAlpha
-
public class PaintAlpha extends java.lang.Object
This class contains static methods for the manipulation of objects of typePaint
The intention is to honour the alpha-channel in the process.
PaintAlpha
was originally conceived to improve the rendering of 3D Shapes with transparent colours and to allow invisible bars by making them completely transparent.In, for example
StackedBarRenderer3D
, bars are rendered with 6 faces. The front face is rendered with thePaint
requested. The other 5 faces are rendered darker to achieve the 3D effect.Previously
Color.darker()
was used for this, which always returns an opaque colour.Additionally there are methods to control the behaviour and in particular a
cloneImage(..)
method which is needed to darken objects of typeTexturePaint
.- Since:
- 1.0.15
- Author:
- DaveLaw
-
-
Constructor Summary
Constructors Constructor Description PaintAlpha()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.awt.image.BufferedImage
cloneImage(java.awt.image.BufferedImage image)
Clone aBufferedImage
.static java.awt.Paint
darker(java.awt.Paint paint)
Create a new (if possible, darker)Paint
of the same Type.static boolean
setLegacyAlpha(boolean legacyAlpha)
Per defaultPaintAlpha
will try to honour alpha-channel information.
-
-
-
Constructor Detail
-
PaintAlpha
public PaintAlpha()
-
-
Method Detail
-
setLegacyAlpha
public static boolean setLegacyAlpha(boolean legacyAlpha)
Per defaultPaintAlpha
will try to honour alpha-channel information. In the past this was not the case. If you wish legacy functionality for your application you can request this here.- Parameters:
legacyAlpha
- boolean- Returns:
- the previous setting
-
darker
public static java.awt.Paint darker(java.awt.Paint paint)
Create a new (if possible, darker)Paint
of the same Type. If the Type is not supported, the originalPaint
is returned.- Parameters:
paint
- aPaint
implementation (e.g.Color
,GradientPaint
,TexturePaint
,..)- Returns:
- a (usually new, see above)
Paint
-
cloneImage
public static java.awt.image.BufferedImage cloneImage(java.awt.image.BufferedImage image)
Clone aBufferedImage
.Note: when constructing the clone, the original Color Model Object is reused.
That keeps things simple and should not be a problem, as all known Color Models
(IndexColorModel
,DirectColorModel
,ComponentColorModel
) are immutable.- Parameters:
image
- original BufferedImage to clone- Returns:
- a new BufferedImage reusing the original's Color Model and containing a clone of its pixels
-
-