Documentation of 'de.erichseifert.gral.util.GraphicsUtils' Java class
GraphicsUtils
de.erichseifert.gral.util

Class GraphicsUtils



  • public abstract class GraphicsUtils
    extends java.lang.Object
    Abstract class that contains utility functions for working with graphics. For example, this includes font handling or color space conversion.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.awt.Color blend(java.awt.Color color1, java.awt.Color color2, double weight)
      Linearly blends two colors with a defined weight.
      static java.awt.Color deriveBrighter(java.awt.Color color)
      Creates a new brighter version of a color by blending it with white.
      static java.awt.Color deriveDarker(java.awt.Color color)
      Creates a new darker version of a color by blending it with black.
      static java.awt.Color deriveWithAlpha(java.awt.Color color, int alpha)
      Creates a new color with the same color components but a different alpha value.
      static void drawPaintedShape(java.awt.Graphics2D graphics, java.awt.Shape shape, java.awt.Paint paint, java.awt.geom.Rectangle2D paintBounds, java.awt.Stroke stroke)
      Draws a filled Shape with the specified Paint object.
      static void fillPaintedShape(java.awt.Graphics2D graphics, java.awt.Shape shape, java.awt.Paint paint, java.awt.geom.Rectangle2D paintBounds)
      Fills a Shape with the specified Paint object.
      static java.awt.Shape getOutline(java.lang.String text, java.awt.Font font, float wrappingWidth, double alignment)
      Returns the outline for the specified text using the specified font and line width.
      static double[] luv2rgb(double[] luv, double[] rgb)
      Converts color components from the CIE L*u*v* to the sRGB color space.
      static double[] luv2xyz(double[] luv, double[] xyz)
      Convert color components from the CIE L*u*v* to the CIE XYZ color space.
      static double[] rgb2luv(double[] rgb, double[] luv)
      Converts color components from the CIE L*u*v* to the sRGB color space.
      static double[] rgb2xyz(double[] rgb, double[] xyz)
      Converts color components from the sRGB to the CIE XYZ color space.
      static double[] xyz2luv(double[] xyz, double[] luv)
      Converts color components from the CIE XYZ to the CIE L*u*v* color space.
      static double[] xyz2rgb(double[] xyz, double[] rgb)
      Converts color components from the sRGB to the CIE XYZ color space.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getOutline

        public static java.awt.Shape getOutline(java.lang.String text,
                                                java.awt.Font font,
                                                float wrappingWidth,
                                                double alignment)
        Returns the outline for the specified text using the specified font and line width. The text may also contain line breaks ('\n').
        Parameters:
        text - Text to be displayed.
        font - Font of the Text.
        wrappingWidth - Maximum width of lines
        alignment - Alignment of the text when it spans multiple lines.
        Returns:
        Shape of the text outline in the specified font.
      • fillPaintedShape

        public static void fillPaintedShape(java.awt.Graphics2D graphics,
                                            java.awt.Shape shape,
                                            java.awt.Paint paint,
                                            java.awt.geom.Rectangle2D paintBounds)
        Fills a Shape with the specified Paint object.
        Parameters:
        graphics - Graphics to be painted into.
        shape - Shape to be filled.
        paint - Paint to be used.
        paintBounds - Optional bounds describing the painted area.
      • drawPaintedShape

        public static void drawPaintedShape(java.awt.Graphics2D graphics,
                                            java.awt.Shape shape,
                                            java.awt.Paint paint,
                                            java.awt.geom.Rectangle2D paintBounds,
                                            java.awt.Stroke stroke)
        Draws a filled Shape with the specified Paint object.
        Parameters:
        graphics - Graphics to be painted into.
        shape - Shape to be filled.
        paint - Paint to be used.
        paintBounds - Optional bounds describing the painted area.
        stroke - Stroke to be used for outlines.
      • rgb2xyz

        public static double[] rgb2xyz(double[] rgb,
                                       double[] xyz)
        Converts color components from the sRGB to the CIE XYZ color space. A D50 white point is assumed for the sRGB conversion. If the xyz array is null, a new one will be created with the same size as the rgb array. See http://www.brucelindbloom.com/index.html?Eqn_RGB_to_XYZ.html
        Parameters:
        rgb - Color components in the sRGB color space.
        xyz - Optional array to store color components in the CIE XYZ color space.
        Returns:
        Color components in the CIE XYZ color space.
      • luv2xyz

        public static double[] luv2xyz(double[] luv,
                                       double[] xyz)
        Convert color components from the CIE L*u*v* to the CIE XYZ color space. If the xyz array is null, a new one will be created with the same size as the luv array. See http://www.brucelindbloom.com/index.html?Eqn_Luv_to_XYZ.html
        Parameters:
        luv - Color components in the CIE L*u*v* color space
        xyz - Optional array to store color components in the CIE XYZ color space.
        Returns:
        Color components in the CIE XYZ color space.
      • xyz2rgb

        public static double[] xyz2rgb(double[] xyz,
                                       double[] rgb)
        Converts color components from the sRGB to the CIE XYZ color space. A D50 white point is assumed for the sRGB conversion. If the rgb array is null, a new one will be created with the same size as the xyz array. See http://www.brucelindbloom.com/index.html?Eqn_XYZ_to_RGB.html
        Parameters:
        xyz - Color components in the CIE XYZ color space.
        rgb - Optional array for storing color components in the sRGB color space.
        Returns:
        Color components in the sRGB color space.
      • xyz2luv

        public static double[] xyz2luv(double[] xyz,
                                       double[] luv)
        Converts color components from the CIE XYZ to the CIE L*u*v* color space. If the luv array is null, a new one will be created with the same size as the xyz array. http://www.brucelindbloom.com/index.html?Eqn_XYZ_to_Luv.html
        Parameters:
        xyz - Color components in the CIE XYZ color space.
        luv - Optional array for storing color components in the CIE L*u*v* color space.
        Returns:
        Color components in the CIE L*u*v* color space.
      • rgb2luv

        public static double[] rgb2luv(double[] rgb,
                                       double[] luv)
        Converts color components from the CIE L*u*v* to the sRGB color space. A D50 white point is assumed for the sRGB conversion. If the luv array is null, a new one will be created with the same size as the rgb array.
        Parameters:
        rgb - Color components in the sRGB color space.
        luv - Optional array for storing color components in the CIE L*u*v* color space.
        Returns:
        Color components in the CIE L*u*v* color space.
      • luv2rgb

        public static double[] luv2rgb(double[] luv,
                                       double[] rgb)
        Converts color components from the CIE L*u*v* to the sRGB color space. A D50 white point is assumed for the sRGB conversion. If the rgb array is null, a new one will be created with the same size as the luv array.
        Parameters:
        luv - Color components in the CIE L*u*v* color space.
        rgb - Optional array for storing color components in the sRGB color space.
        Returns:
        Color components in sRGB color space.
      • blend

        public static java.awt.Color blend(java.awt.Color color1,
                                           java.awt.Color color2,
                                           double weight)
        Linearly blends two colors with a defined weight.
        Parameters:
        color1 - First color.
        color2 - Second color.
        weight - Weighting factor in the range 0 to 1 (0 means color1, 1 means second color)
        Returns:
        New blended color
      • deriveWithAlpha

        public static java.awt.Color deriveWithAlpha(java.awt.Color color,
                                                     int alpha)
        Creates a new color with the same color components but a different alpha value.
        Parameters:
        color - Original color.
        alpha - Alpha value for new color.
        Returns:
        New color with specified alpha value.
      • deriveDarker

        public static java.awt.Color deriveDarker(java.awt.Color color)
        Creates a new darker version of a color by blending it with black. The derived color has the same alpha value as the original color.
        Parameters:
        color - Original color.
        Returns:
        Darker color with same alpha value.
      • deriveBrighter

        public static java.awt.Color deriveBrighter(java.awt.Color color)
        Creates a new brighter version of a color by blending it with white. The derived color has the same alpha value as the original color.
        Parameters:
        color - Original color.
        Returns:
        Brighter color with same alpha value.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.