Class PaintAlpha


  • public class PaintAlpha
    extends Object
    This class contains static methods for the manipulation of objects of type Paint

    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.

    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 type TexturePaint.

    Since:
    1.0.15
    Author:
    DaveLaw
    • Method Detail

      • setLegacyAlpha

        public static boolean setLegacyAlpha​(boolean legacyAlpha)
        Per default PaintAlpha 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 Paint darker​(Paint paint)
        Create a new (if possible, darker) Paint of the same Type. If the Type is not supported, the original Paint is returned.

        Parameters:
        paint - a Paint implementation (e.g. Color, GradientPaint, TexturePaint,..)

        Returns:
        a (usually new, see above) Paint