|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.awt.Color
com.davisor.graphics.data.ColorData
ColorData represents a concrete solid color. Thie class extends
Color, making it compatible with standard Java
graphics tools. This also makes instances of this class immutable,
so any operations from the Data framework that would
change the value of this data object will fail with appropriate
exceptions.
brighterPaint(),
darkerPaint(),
next(),
ColorType,
PaintData,
PaintParameters,
Serialized Form| Field Summary | |
static float |
DEFAULTSCALE
Default color intensity scale factor (0.7). |
protected java.lang.String |
M_creationString
Name used to create this instance |
protected PaintType |
M_type
The type of this data. |
| Fields inherited from class java.awt.Color |
black, BLACK, blue, BLUE, cyan, CYAN, DARK_GRAY, darkGray, gray, GRAY, green, GREEN, LIGHT_GRAY, lightGray, magenta, MAGENTA, orange, ORANGE, pink, PINK, red, RED, white, WHITE, yellow, YELLOW |
| Fields inherited from interface java.awt.Transparency |
BITMASK, OPAQUE, TRANSLUCENT |
| Constructor Summary | |
ColorData(ColorData data,
boolean deep)
Deep or shallow copy constructor. |
|
ColorData(PaintType type,
java.awt.Color color)
Creates a new color data object from the given color type and value. |
|
ColorData(PaintType type,
java.awt.Color color,
float alpha,
boolean preserve)
Creates a new color data object from the given color type and color and alpha values. |
|
ColorData(PaintType type,
int rgb)
Creates a new color data object from the given color type and integer RGB Java color value. |
|
ColorData(PaintType type,
int argb,
boolean hasAlpha)
Creates a new color data object from the given color type and integer value that optionally may have an alpha component. |
|
ColorData(PaintType type,
int red,
int green,
int blue)
Creates a new color data object from the given color type and RGB components. |
|
ColorData(PaintType type,
int red,
int green,
int blue,
int alpha)
Creates a new color data object from the given color type and RGB and alpha components. |
|
ColorData(PaintType type,
java.lang.String color)
Creates a new color data object from the given color type and spesification string. |
|
ColorData(PaintType type,
java.lang.String format,
java.text.ParsePosition status)
Creates a new color data object from the given color type and spesification string fragment. |
|
| Method Summary | |
DataValue |
abs()
Returns absolute data value of current value. |
DataValue |
add(DataValue value)
Adds data values. |
java.awt.Paint |
brighterPaint()
Creates a brighter version of this paint. |
static java.awt.Color |
brighterPaint(java.awt.Color color)
Creates a brighter version of the given color. |
static java.awt.Color |
brighterPaint(java.awt.Color color,
float scale)
Creates a brighter version of the given color. |
static int |
brighterPaint(int value)
Computes a brighter RGB component value. |
static int |
brighterPaint(int value,
float scale)
Computes a brighter RGB component value. |
DataValue |
ceil(DataValue precision)
Quantizes the current value up to an even value within given precision. |
int |
compareTo(java.lang.Object o)
Compares this color with other color objects. |
protected static float |
cropColorScale(float scale)
Crops the given scale to the range of [0,1]. |
java.awt.Paint |
darkerPaint()
Creates a darker version of this paint. |
static java.awt.Color |
darkerPaint(java.awt.Color color)
Creates a darker version of the given color. |
static java.awt.Color |
darkerPaint(java.awt.Color color,
float scale)
Creates a darker version of the given color. |
static int |
darkerPaint(int value)
Computes a darker RGB component value. |
static int |
darkerPaint(int value,
float scale)
Computes a darker RGB component value. |
double |
deinterpolate(DataValue min,
DataValue max)
De-interpolates the current data value to a scalar value, in respect, with the given data value range. |
DataValue |
div(DataValue value)
Divides current data value with given value. |
com.davisor.core.Dupable |
dup()
Makes a deep copy of this object. |
DataValue |
floor(DataValue precision)
Quantizes the current value down to an even value within given precision. |
java.lang.String |
getCreationString()
Implements PaintValue interface method |
java.lang.String |
getFormat()
Gets the type specification optimal for this particular value. |
static int |
getRGBA(java.awt.Color color,
float alpha,
boolean preserve)
Merges a color RGB value with the given normalized alpha value. |
Type |
getType()
Gets the color data type. |
DataValue |
interpolate(double value,
DataValue max)
Interpolates the given scalar value to a data value, in respect, with the range defined by this value and the given maximum value. |
boolean |
isNull()
Tests if this data object value is undetermined. |
DataValue |
max(DataValue value)
Finds the largest data value. |
DataValue |
min(DataValue value)
Finds the smallest data value. |
DataValue |
mul(DataValue value)
Multiplies current data value with given value. |
DataValue |
negate()
Returns the negation of current value. |
BetterPaint |
next()
Gets the next paint in this paint series. |
static java.awt.Color |
setAlpha(java.awt.Color color,
float alpha)
Sets color transparency for the given color. |
void |
setCreationString(java.lang.String creationString)
Implements PaintValue interface method |
void |
setValue(java.lang.String value,
java.text.ParsePosition status)
Attempts to set the color value, but since colors are immutable objects, this will always fail. |
DataValue |
sub(DataValue value)
Substracts a data value. |
void |
toStatement(java.sql.PreparedStatement statement,
int parameter)
Converts color data to a prepared statement input parameter. |
java.lang.String |
toString()
Gets the paint spesification string of this color. |
java.lang.String |
toXML()
Gets the XML string representation of this value. |
DataValue |
unit(DataValue targetValue,
double maxSteps)
Gets the largest suitable unit step to represent a value change between this value and the given target value. |
| Methods inherited from class java.awt.Color |
brighter, createContext, darker, decode, equals, getAlpha, getBlue, getColor, getColor, getColor, getColorComponents, getColorComponents, getColorSpace, getComponents, getComponents, getGreen, getHSBColor, getRed, getRGB, getRGBColorComponents, getRGBComponents, getTransparency, hashCode, HSBtoRGB, RGBtoHSB |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.awt.Paint |
createContext |
| Methods inherited from interface java.awt.Transparency |
getTransparency |
| Field Detail |
public static final float DEFAULTSCALE
protected PaintType M_type
protected java.lang.String M_creationString
| Constructor Detail |
public ColorData(ColorData data,
boolean deep)
data - source datadeep - determine if the copying is deep or shallowgetType(),
Type.dup()
public ColorData(PaintType type,
java.awt.Color color)
type - color typecolor - color valueColorData(PaintType,int)
public ColorData(PaintType type,
java.awt.Color color,
float alpha,
boolean preserve)
type - color typecolor - color valuealpha - opacity (zero: transparent, one: opaque)preserve - should the previous alpha value of the color be merged
with the given opacity value or notgetRGBA(Color,float,boolean),
ColorData(PaintType,int,boolean)
public ColorData(PaintType type,
java.lang.String color)
throws InvalidDataException
type - color typecolor - color valueColorData(PaintType,String,ParsePosition)
public ColorData(PaintType type,
java.lang.String format,
java.text.ParsePosition status)
throws InvalidDataException
type - color typeformat - color spesicifaction stringstatus - parse statusColorData(PaintType,String),
ColorType.createColor(String,ParsePosition)
public ColorData(PaintType type,
int rgb)
type - color typergb - color RGB valueColorData(PaintType,int,boolean)
public ColorData(PaintType type,
int argb,
boolean hasAlpha)
type - color typeargb - color RGB value with optional alpha componenthasAlpha - flag for telling if the color value contains an
alpha componentColorData(PaintType,int)
public ColorData(PaintType type,
int red,
int green,
int blue)
type - color typered - red color component valuegreen - green color component valueblue - blue color component valueColorData(PaintType,int,int,int,int)
public ColorData(PaintType type,
int red,
int green,
int blue,
int alpha)
type - color typered - red color component valuegreen - green color component valueblue - blue color component valuealpha - alpha color component valueColorData(PaintType,int,int,int,int)| Method Detail |
public java.awt.Paint brighterPaint()
brighterPaint in interface BetterPaintdarkerPaint(),
brighterPaint(int),
ColorDatapublic java.awt.Paint darkerPaint()
darkerPaint in interface BetterPaintbrighterPaint(),
darkerPaint(int),
ColorDatapublic BetterPaint next()
This default implementation will return this instance. Subclasses may alter the behaviour and return other paint objects.
next in interface BetterPaintPaintsDatapublic int compareTo(java.lang.Object o)
This object will be greater than any object that is not an
instance of Color. For Color objects,
comparison is done with the help of
CompareGraphics.compareTo(Color,Color) method.
compareTo in interface java.lang.ComparableCompareGraphics.compareTo(Color,Color)
public Type getType()
throws InvalidDataException
getType in interface DataInvalidDataException - if type retrieval failspublic boolean isNull()
isNull in interface SerializableDataType.isNull(com.davisor.data.SerializableData)
public DataValue abs()
throws InvalidDataException
abs in interface DataValueInvalidDataException - if absolute value can not be computed
public DataValue add(DataValue value)
throws InvalidDataException
Color values do not support this operation, but they always throw an
InvalidDataException instead.
add in interface DataValuevalue - a data value to be added to this data value
InvalidDataException - if the data values cannot be addedpublic DataValue ceil(DataValue precision)
Color values do not support this operation, but they always throw an
Error instead.
ceil in interface DataValueprecision - the precision within quantization occurs
floor(com.davisor.data.DataValue)
public double deinterpolate(DataValue min,
DataValue max)
throws InvalidDataException
Color values do not support this operation, but they always throw an
InvalidDataException instead.
deinterpolate in interface DataValuemin - a data value representing a range's lower limitmax - a data value representing a range's higher limit
InvalidDataException - if the de-interpolation failsDataValue.interpolate(double, com.davisor.data.DataValue),
DeinterpolationException,
TupleData.deinterpolate(com.davisor.data.DataValue, com.davisor.data.DataValue)
public DataValue div(DataValue value)
throws InvalidDataException
Color values do not support this operation, but they always throw an
InvalidDataException instead.
div in interface DataValuevalue - the divider
InvalidDataException - if current data value cannot be dividedpublic DataValue floor(DataValue precision)
Color values do not support this operation, but they always throw an
Error instead.
floor in interface DataValueprecision - the precision within quantization occurs
ceil(com.davisor.data.DataValue)public java.lang.String getFormat()
The color data optimal specification string is always the current specification string for the current type.
getFormat in interface DataValueData.getType(),
Type.getFormat(),
Type.setFormat(java.lang.String)
public DataValue interpolate(double value,
DataValue max)
throws InvalidDataException
Color values do not support this operation, but they always throw an
InvalidDataException instead.
interpolate in interface DataValuevalue - the scalar value to be interpolatedmax - a data value representing a range's higher limit
InvalidDataException - if the interpolation failsDataValue.deinterpolate(com.davisor.data.DataValue, com.davisor.data.DataValue)
public DataValue max(DataValue value)
throws InvalidDataException
max in interface DataValuevalue - a data value to be compared with this data value
InvalidDataException - if the data value cannot be compared
public DataValue min(DataValue value)
throws InvalidDataException
min in interface DataValuevalue - a data value to be compared with this data value
InvalidDataException - if the data value cannot be compared
public DataValue mul(DataValue value)
throws InvalidDataException
Color values do not support this operation, but they always throw an
InvalidDataException instead.
mul in interface DataValuevalue - the multiplier
InvalidDataException - if current data value cannot be multiplied
public DataValue negate()
throws InvalidDataException
negate in interface DataValueInvalidDataException - if absolute value can not be computed
public void setValue(java.lang.String value,
java.text.ParsePosition status)
throws InvalidDataException
setValue in interface DataValuevalue - new data value (may be null)status - parse status (may be null)
InvalidDataException - always.CountType.countValue(String,ParsePosition)
public DataValue sub(DataValue value)
throws InvalidDataException
Color values do not support this operation, but they always throw an
InvalidDataException>/CODE> instead.
value - a data value to be substracted from this data value
InvalidDataException - if the value cannot be
substracted
public void toStatement(java.sql.PreparedStatement statement,
int parameter)
throws java.sql.SQLException
toStatement in interface DataValuestatement - statement to be updatedparameter - index of the statement parameter to be updated
java.sql.SQLException - if a SQL error occurspublic java.lang.String toXML()
toXML in interface DataValuetoString()
public DataValue unit(DataValue targetValue,
double maxSteps)
Color values do not support this operation, but they always throw an
Error instead.
unit in interface DataValuetargetValue - target value to be reached (may be null)maxSteps - maximum number of steps (zero leaves the choise open)
public com.davisor.core.Dupable dup()
dup in interface com.davisor.core.Dupablepublic java.lang.String toString()
toString in interface DataValuePaintParameters.PaintParameters(Paint)public java.lang.String getCreationString()
PaintValue interface method
getCreationString in interface PaintValuepublic void setCreationString(java.lang.String creationString)
PaintValue interface method
setCreationString in interface PaintValuepublic static int brighterPaint(int value)
brighterPaint(),
brighterPaint(Color),
brighterPaint(int,float),
brighterPaint(Color,float),
darkerPaint(int)public static java.awt.Color brighterPaint(java.awt.Color color)
color - source color
brighterPaint(),
brighterPaint(int),
brighterPaint(int,float),
brighterPaint(Color,float),
darkerPaint(Color)
public static int brighterPaint(int value,
float scale)
value - RGB component value [0,255]scale - scale factor [0,1]brighterPaint(),
brighterPaint(int),
brighterPaint(Color),
brighterPaint(Color,float),
darkerPaint(int,float)
public static java.awt.Color brighterPaint(java.awt.Color color,
float scale)
color - source colorscale - scale factor
brighterPaint(),
brighterPaint(int),
brighterPaint(Color),
brighterPaint(int,float),
darkerPaint(Color,float)public static int darkerPaint(int value)
brighterPaint(int),
darkerPaint(),
darkerPaint(Color),
darkerPaint(int,float),
darkerPaint(Color,float)public static java.awt.Color darkerPaint(java.awt.Color color)
color - source color
brighterPaint(Color),
darkerPaint(),
darkerPaint(int),
darkerPaint(int,float),
darkerPaint(Color,float)
public static int darkerPaint(int value,
float scale)
value - RGB component value [0,255]scale - scale factor [0,1]brighterPaint(int,float),
darkerPaint(),
darkerPaint(int),
darkerPaint(Color),
darkerPaint(Color,float)
public static java.awt.Color darkerPaint(java.awt.Color color,
float scale)
color - source colorscale - scale factor
brighterPaint(Color,float),
darkerPaint(),
darkerPaint(int),
darkerPaint(Color),
darkerPaint(int,float)
public static int getRGBA(java.awt.Color color,
float alpha,
boolean preserve)
color - the color from which the color RGB value is taken
(may be null)alpha - the normalized alpha value (0.0-1.0)preserve - should the previous alpha value of the color be merged
with the given normalized alpha value or notsetAlpha(java.awt.Color, float)
public static java.awt.Color setAlpha(java.awt.Color color,
float alpha)
null color will default to black.
color - the color from which the color RGB value is taken
(may be null)alpha - the normalized alpha value (0.0-1.0)getRGBA(java.awt.Color, float, boolean)protected static float cropColorScale(float scale)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||