00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00027 package org.mpcl.nui;
00028
00029 import java.awt.Color;
00030
00031
00033 public class TColor extends Color
00034 {
00035
00036
00037
00038
00039
00040 public static TColor _brighter (Color tCOLOR, int iINCREMENT)
00041 {
00042 int iRed = Math.min (255, tCOLOR.getRed() + iINCREMENT);
00043 int iGreen = Math.min (255, tCOLOR.getGreen() + iINCREMENT);
00044 int iBlue = Math.min (255, tCOLOR.getBlue() + iINCREMENT);
00045
00046 return new TColor (iRed, iGreen, iBlue, tCOLOR.getAlpha());
00047 }
00048
00049 public static TColor _darker (Color tCOLOR, int iDECREMENT)
00050 {
00051 int iRed = Math.max (0, tCOLOR.getRed() - iDECREMENT);
00052 int iGreen = Math.max (0, tCOLOR.getGreen() - iDECREMENT);
00053 int iBlue = Math.max (0, tCOLOR.getBlue() - iDECREMENT);
00054
00055 return new TColor (iRed, iGreen, iBlue, tCOLOR.getAlpha());
00056 }
00057
00065 public TColor (int iRED, int iGREEN, int iBLUE)
00066 {
00067 super (iRED, iGREEN, iBLUE);
00068 }
00069
00078 public TColor (int iRED, int iGREEN, int iBLUE, int iALPHA)
00079 {
00080 super (iRED, iGREEN, iBLUE, iALPHA);
00081 }
00082
00083 public TColor brighter (int iINCREMENT)
00084 {
00085 int iRed = Math.min (255, getRed() + iINCREMENT);
00086 int iGreen = Math.min (255, getGreen() + iINCREMENT);
00087 int iBlue = Math.min (255, getBlue() + iINCREMENT);
00088
00089 return new TColor (iRed, iGreen, iBlue, getAlpha());
00090 }
00091
00092 public TColor darker (int iDECREMENT)
00093 {
00094 int iRed = Math.max (0, getRed() - iDECREMENT);
00095 int iGreen = Math.max (0, getGreen() - iDECREMENT);
00096 int iBlue = Math.max (0, getBlue() - iDECREMENT);
00097
00098 return new TColor (iRed, iGreen, iBlue, getAlpha());
00099 }
00100
00101 }