| 1 |
pjm2 |
1.1 |
//---PACKAGE DECLARATION--- |
| 2 |
|
|
|
| 3 |
|
|
//---IMPORTS--- |
| 4 |
|
|
|
| 5 |
|
|
|
| 6 |
|
|
/** |
| 7 |
|
|
* IscreamColour - Used to provide static colour methods. |
| 8 |
|
|
* |
| 9 |
|
|
* @author $Author: pjm2 $ |
| 10 |
pjm2 |
1.3 |
* @version $Id: IscreamColour.java,v 1.2 2001/02/03 17:26:07 pjm2 Exp $ |
| 11 |
pjm2 |
1.1 |
*/ |
| 12 |
|
|
public class IscreamColour { |
| 13 |
|
|
|
| 14 |
|
|
//---FINAL ATTRIBUTES--- |
| 15 |
|
|
|
| 16 |
|
|
/** |
| 17 |
|
|
* The current CVS revision of this class |
| 18 |
|
|
*/ |
| 19 |
pjm2 |
1.3 |
public final String REVISION = "$Revision: 1.2 $"; |
| 20 |
pjm2 |
1.1 |
|
| 21 |
|
|
// black |
| 22 |
|
|
public static final int BLACK = 0; |
| 23 |
|
|
|
| 24 |
|
|
// white |
| 25 |
|
|
public static final int WHITE = 16777215; |
| 26 |
|
|
|
| 27 |
|
|
// web-safe i-scream blue ;) |
| 28 |
|
|
public static final int ISCREAM_BLUE = 13421823; |
| 29 |
|
|
|
| 30 |
|
|
|
| 31 |
|
|
//---STATIC METHODS--- |
| 32 |
|
|
|
| 33 |
|
|
/** |
| 34 |
|
|
* Static function used to return an RGBA integer. |
| 35 |
|
|
* |
| 36 |
|
|
* @return the RGB value in RGBA integer format. |
| 37 |
|
|
*/ |
| 38 |
|
|
public static int rgb(int r, int g, int b){ |
| 39 |
|
|
int rgb = r*256*256 + g*256 + b; |
| 40 |
|
|
return (rgb & 0xff00ff00) | ((rgb & 0xff0000) >> 16) | ((rgb & 0xff) << 16); |
| 41 |
|
|
} |
| 42 |
|
|
|
| 43 |
|
|
|
| 44 |
|
|
//---CONSTRUCTORS--- |
| 45 |
|
|
|
| 46 |
|
|
//---PUBLIC METHODS--- |
| 47 |
|
|
|
| 48 |
|
|
/** |
| 49 |
|
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
| 50 |
|
|
* method to provide clean logging (every class should have this). |
| 51 |
|
|
* |
| 52 |
|
|
* @return the name of this class and its CVS revision |
| 53 |
|
|
*/ |
| 54 |
|
|
public String toString(){ |
| 55 |
|
|
return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")"; |
| 56 |
|
|
} |
| 57 |
|
|
|
| 58 |
|
|
//---PRIVATE METHODS--- |
| 59 |
|
|
|
| 60 |
|
|
//---ACCESSOR/MUTATOR METHODS--- |
| 61 |
|
|
|
| 62 |
|
|
//---ATTRIBUTES--- |
| 63 |
|
|
|
| 64 |
|
|
//---STATIC ATTRIBUTES--- |
| 65 |
|
|
|
| 66 |
|
|
} |