org.browsecode.helpers.images
Class HexConversion

java.lang.Object
  extended by org.browsecode.helpers.images.HexConversion

public class HexConversion
extends java.lang.Object

Convert between HTML hex colors and regular colors. The original source from this was public domain on the web. Unfortunately, the original author and credits have been lost.


Constructor Summary
HexConversion()
           
 
Method Summary
static java.awt.Color getColor(java.lang.String hex)
           
static java.awt.Color getColorFromHTML(java.lang.String hex)
           
static java.lang.String getHex(java.awt.Color c)
           
static int hexCharToInt(char c)
          convert a single hex char to corresponding int.
static int hexStringToInt(java.lang.String str)
           
static java.lang.String intToHex(int b)
           
static int[] twoCharEachHexStringToInts(java.lang.String str)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HexConversion

public HexConversion()
Method Detail

getColor

public static java.awt.Color getColor(java.lang.String hex)

getColorFromHTML

public static java.awt.Color getColorFromHTML(java.lang.String hex)

getHex

public static java.lang.String getHex(java.awt.Color c)

intToHex

public static java.lang.String intToHex(int b)

twoCharEachHexStringToInts

public static int[] twoCharEachHexStringToInts(java.lang.String str)

hexStringToInt

public static int hexStringToInt(java.lang.String str)

hexCharToInt

public static int hexCharToInt(char c)
convert a single hex char to corresponding int.

Parameters:
c - char to convert. must be 0-9 a-f A-F, no spaces, plus or minus signs.
Returns:
corresponding integer