org.jdesktop.swingx.color
Class ColorUtil

java.lang.Object
  extended by org.jdesktop.swingx.color.ColorUtil

Deprecated. (pre-1.6.3) all methods moved

@Deprecated
public final class ColorUtil
extends Object

A collection of utility methods for working with Colors.

Author:
joshua.marinacci@sun.com, Karl George Schaefer

Method Summary
static Color blend(Color origin, Color over)
          Deprecated. Use PaintUtils.blend(Color,Color) instead
static Color computeForeground(Color bg)
          Deprecated. Use PaintUtils.computeForeground(Color) instead
static Paint getCheckerPaint()
          Deprecated. Use PaintUtils.getCheckerPaint() instead
static Paint getCheckerPaint(Color c1, Color c2, int size)
          Deprecated. Use PaintUtils.getCheckerPaint(Paint,Paint,int) instead
static Color interpolate(Color b, Color a, float t)
          Deprecated. Use PaintUtils.interpolate(Color,Color,float) instead
static Color removeAlpha(Color color)
          Deprecated. Use PaintUtils.removeAlpha(Color) instead
static Color setAlpha(Color color, int alpha)
          Deprecated. Use PaintUtils.setAlpha(Color,int) instead
static Color setBrightness(Color color, float brightness)
          Deprecated. Use PaintUtils.setBrightness(Color,float) instead
static Color setSaturation(Color color, float saturation)
          Deprecated. Use PaintUtils.setSaturation(Color,float) instead
static void tileStretchPaint(Graphics g, JComponent comp, BufferedImage img, Insets ins)
          Deprecated. (pre-1.6.3) Use GraphicsUtilities.tileStretchPaint(Graphics,JComponent,BufferedImage,Insets) instead
static String toHexString(Color color)
          Deprecated. Use PaintUtils.toHexString(Color) instead
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

removeAlpha

@Deprecated
public static Color removeAlpha(Color color)
Deprecated. Use PaintUtils.removeAlpha(Color) instead

Returns a new color equal to the old one, except that there is no alpha (transparency) channel.

This method is a convenience and has the same effect as setAlpha(color, 255).

Parameters:
color - the color to remove the alpha (transparency) from
Returns:
a new non-transparent Color
Throws:
NullPointerException - if color is null

setAlpha

@Deprecated
public static Color setAlpha(Color color,
                                        int alpha)
Deprecated. Use PaintUtils.setAlpha(Color,int) instead

Returns a new color equal to the old one, except alpha (transparency) channel is set to the new value.

Parameters:
color - the color to modify
alpha - the new alpha (transparency) level. Must be an int between 0 and 255
Returns:
a new alpha-applied Color
Throws:
IllegalArgumentException - if alpha is not between 0 and 255 inclusive
NullPointerException - if color is null

setSaturation

@Deprecated
public static Color setSaturation(Color color,
                                             float saturation)
Deprecated. Use PaintUtils.setSaturation(Color,float) instead

Returns a new color equal to the old one, except the saturation is set to the new value. The new color will have the same alpha (transparency) as the original color.

The color is modified using HSB calculations. The saturation must be a float between 0 and 1. If 0 the resulting color will be gray. If 1 the resulting color will be the most saturated possible form of the passed in color.

Parameters:
color - the color to modify
saturation - the saturation to use in the new color
Returns:
a new saturation-applied Color
Throws:
IllegalArgumentException - if saturation is not between 0 and 1 inclusive
NullPointerException - if color is null

setBrightness

@Deprecated
public static Color setBrightness(Color color,
                                             float brightness)
Deprecated. Use PaintUtils.setBrightness(Color,float) instead

Returns a new color equal to the old one, except the brightness is set to the new value. The new color will have the same alpha (transparency) as the original color.

The color is modified using HSB calculations. The brightness must be a float between 0 and 1. If 0 the resulting color will be black. If 1 the resulting color will be the brightest possible form of the passed in color.

Parameters:
color - the color to modify
brightness - the brightness to use in the new color
Returns:
a new brightness-applied Color
Throws:
IllegalArgumentException - if brightness is not between 0 and 1 inclusive
NullPointerException - if color is null

toHexString

@Deprecated
public static String toHexString(Color color)
Deprecated. Use PaintUtils.toHexString(Color) instead

Creates a String that represents the supplied color as a hex-value RGB triplet, including the "#". The return value is suitable for use in HTML. The alpha (transparency) channel is neither include nor used in producing the string.

Parameters:
color - the color to convert
Returns:
the hex String

computeForeground

@Deprecated
public static Color computeForeground(Color bg)
Deprecated. Use PaintUtils.computeForeground(Color) instead

Computes an appropriate foreground color (either white or black) for the given background color.

Parameters:
bg - the background color
Returns:
Color.WHITE or Color.BLACK
Throws:
NullPointerException - if bg is null

blend

@Deprecated
public static Color blend(Color origin,
                                     Color over)
Deprecated. Use PaintUtils.blend(Color,Color) instead

Blends two colors to create a new color. The origin color is the base for the new color and regardless of its alpha component, it is treated as fully opaque (alpha 255).

Parameters:
origin - the base of the new color
over - the alpha-enabled color to add to the origin color
Returns:
a new color comprised of the origin and over colors

interpolate

@Deprecated
public static Color interpolate(Color b,
                                           Color a,
                                           float t)
Deprecated. Use PaintUtils.interpolate(Color,Color,float) instead

Interpolates a color.

Parameters:
b -
a -
t -
Returns:

getCheckerPaint

@Deprecated
public static Paint getCheckerPaint()
Deprecated. Use PaintUtils.getCheckerPaint() instead

Creates a new Paint that is a checkered effect using the colors gray and Color.WHITE.

Returns:
a the checkered paint

getCheckerPaint

@Deprecated
public static Paint getCheckerPaint(Color c1,
                                               Color c2,
                                               int size)
Deprecated. Use PaintUtils.getCheckerPaint(Paint,Paint,int) instead

Creates a new Paint that is a checkered effect using the specified colors.

While this method supports transparent colors, this implementation performs painting operations using the second color after it performs operations using the first color. This means that to create a checkered paint with a fully-transparent color, you MUST specify that color first.

Parameters:
c1 - the first color
c2 - the second color
size - the size of the paint
Returns:
a new Paint checkering the supplied colors

tileStretchPaint

@Deprecated
public static void tileStretchPaint(Graphics g,
                                               JComponent comp,
                                               BufferedImage img,
                                               Insets ins)
Deprecated. (pre-1.6.3) Use GraphicsUtilities.tileStretchPaint(Graphics,JComponent,BufferedImage,Insets) instead

Draws an image on top of a component by doing a 3x3 grid stretch of the image using the specified insets.



Copyright © 2012. All Rights Reserved.