Package org.web3d.x3d.jsail.fields
Class SFColorObject
java.lang.Object
org.web3d.x3d.jsail.fields.X3DConcreteField
org.web3d.x3d.jsail.fields.SFColorObject
public class SFColorObject extends X3DConcreteField implements SFColor
This utility class provides a concrete implementation corresponding to SFColor X3D field type.
Note that SFColorObject provides a variety of color constants.
Package hint: This specification class is defined by the X3D Java Language Binding Specification for the Scene Authoring Interface (SAI). SFColor specifies one RGB (red-green-blue) color triple, where each color value is an RGB triple of floating point numbers in range [0,1]. The default value of an uninitialized SFColor field is (0 0 0). Warning: comma characters within singleton values do not pass strict XML validation.
Related field object:
Note that SFColorObject provides a variety of color constants.
Package hint: This specification class is defined by the X3D Java Language Binding Specification for the Scene Authoring Interface (SAI). SFColor specifies one RGB (red-green-blue) color triple, where each color value is an RGB triple of floating point numbers in range [0,1]. The default value of an uninitialized SFColor field is (0 0 0). Warning: comma characters within singleton values do not pass strict XML validation.
Related field object:
MFColorObject
- See Also:
- X3D Tooltips: type SFColor, SAI Java Specification: B.4.11 X3DFieldTypes, SAI Abstract Specification: 5.2.15 SAIFieldType, X3D Abstract Specification: SFColorAndMFColor, X3D Tooltips, X3D Tooltips: field, X3D Tooltips: fieldValue, X3D Scene Authoring Hints * @see CSS Color Module Level 3, 4.3. Extended color keywords
-
Field Summary
Fields Modifier and Type Field Description static float[]
ALICEBLUE
static float[]
ANTIQUEWHITE
static float[]
AQUA
static float[]
AQUAMARINE
static float[]
AZURE
static float[]
BEIGE
static float[]
BISQUE
static float[]
BLACK
static float[]
BLANCHEDALMOND
static float[]
BLUE
static float[]
BLUEVIOLET
static float[]
BROWN
static float[]
BURLYWOOD
static float[]
CADETBLUE
static float[]
CHARTREUSE
static float[]
CHOCOLATE
static float[]
CORAL
static float[]
CORNFLOWERBLUE
static float[]
CORNSILK
static float[]
CRIMSON
static float[]
CYAN
static float[]
DARKBLUE
static float[]
DARKCYAN
static float[]
DARKGOLDENROD
static float[]
DARKGRAY
static float[]
DARKGREEN
static float[]
DARKGREY
static float[]
DARKKHAKI
static float[]
DARKMAGENTA
static float[]
DARKOLIVEGREEN
static float[]
DARKORANGE
static float[]
DARKORCHID
static float[]
DARKRED
static float[]
DARKSALMON
static float[]
DARKSEAGREEN
static float[]
DARKSLATEBLUE
static float[]
DARKSLATEGRAY
static float[]
DARKSLATEGREY
static float[]
DARKTURQUOISE
static float[]
DARKVIOLET
static float[]
DEEPPINK
static float[]
DEEPSKYBLUE
static float[]
DEFAULT_VALUE
Default value for this field type is 0 0 0.static java.lang.String
DEFAULT_VALUE_STRING
Default string value for this field type is "0 0 0".static float[]
DIMGRAY
static float[]
DIMGREY
static float[]
DODGERBLUE
static float[]
FIREBRICK
static float[]
FLORALWHITE
static float[]
FORESTGREEN
static float[]
FUCHSIA
static float[]
GAINSBORO
static float[]
GHOSTWHITE
static float[]
GOLD
static float[]
GOLDENROD
static float[]
GRAY
static float[]
GREEN
static float[]
GREENYELLOW
static float[]
GREY
static float[]
HONEYDEW
static float[]
HOTPINK
static float[]
INDIANRED
static float[]
INDIGO
static float[]
IVORY
static float[]
KHAKI
static float[]
LAVENDER
static float[]
LAVENDERBLUSH
static float[]
LAWNGREEN
static float[]
LEMONCHIFFON
static float[]
LIGHTBLUE
static float[]
LIGHTCORAL
static float[]
LIGHTCYAN
static float[]
LIGHTGOLDENRODYELLOW
static float[]
LIGHTGRAY
static float[]
LIGHTGREEN
static float[]
LIGHTGREY
static float[]
LIGHTPINK
static float[]
LIGHTSALMON
static float[]
LIGHTSEAGREEN
static float[]
LIGHTSKYBLUE
static float[]
LIGHTSLATEGRAY
static float[]
LIGHTSLATEGREY
static float[]
LIGHTSTEELBLUE
static float[]
LIGHTYELLOW
static float[]
LIME
static float[]
LIMEGREEN
static float[]
LINEN
static float[]
MAGENTA
static float[]
MAROON
static float[]
MEDIUMAQUAMARINE
static float[]
MEDIUMBLUE
static float[]
MEDIUMORCHID
static float[]
MEDIUMPURPLE
static float[]
MEDIUMSEAGREEN
static float[]
MEDIUMSLATEBLUE
static float[]
MEDIUMSPRINGGREEN
static float[]
MEDIUMTURQUOISE
static float[]
MEDIUMVIOLETRED
static float[]
MIDNIGHTBLUE
static float[]
MINTCREAM
static float[]
MISTYROSE
static float[]
MOCCASIN
static java.lang.String
NAME
String constant NAME provides name of this element: SFColorstatic float[]
NAVAJOWHITE
static float[]
NAVY
static float[]
OLDLACE
static float[]
OLIVE
static float[]
OLIVEDRAB
static float[]
ORANGE
static float[]
ORANGERED
static float[]
ORCHID
static float[]
PALEGOLDENROD
static float[]
PALEGREEN
static float[]
PALETURQUOISE
static float[]
PALEVIOLETRED
static float[]
PAPAYAWHIP
static java.util.regex.Pattern
PATTERN
Precompiled regular expression (regex) pattern for this field type using default REGEX value.static float[]
PEACHPUFF
static float[]
PERU
static float[]
PINK
static float[]
PLUM
static float[]
POWDERBLUE
static float[]
PURPLE
static float[]
RED
static java.lang.String
REGEX
Default regular expression (regex) pattern for this field type is (\s)*(([+]?static float[]
ROSYBROWN
static float[]
ROYALBLUE
static float[]
SADDLEBROWN
static float[]
SALMON
static float[]
SANDYBROWN
static float[]
SEAGREEN
static float[]
SEASHELL
static float[]
SIENNA
static float[]
SILVER
static float[]
SKYBLUE
static float[]
SLATEBLUE
static float[]
SLATEGRAY
static float[]
SLATEGREY
static float[]
SNOW
static float[]
SPRINGGREEN
static float[]
STEELBLUE
static float[]
TAN
static float[]
TEAL
static float[]
THISTLE
static float[]
TOMATO
static int
TUPLE_SIZE
Default tuple size for this field type is 3 (i.e. number of component values making up a single-field SF object).static float[]
TURQUOISE
static float[]
VIOLET
static float[]
WHEAT
static float[]
WHITE
static float[]
WHITESMOKE
static float[]
YELLOW
static float[]
YELLOWGREEN
-
Constructor Summary
Constructors Constructor Description SFColorObject()
Constructor for SFColorObject performs value initialization.SFColorObject(double[] newValue)
Utility constructor for SFColorObject using an alternatively typed Java double[] array as new initial value.SFColorObject(double red, double green, double blue)
Constructor using individual double types as new initial value (which must pass validation checks).SFColorObject(float[] newValue)
Constructor for SFColorObject using a corresponding Java primitive float[] array as new initial value.SFColorObject(float red, float green, float blue)
Constructor using individual float types as new initial value (which must pass validation checks).SFColorObject(int hexColorValue)
Constructor using single HTML-style 0xRRGGBB hex value as new initial value.SFColorObject(SFColorObject newValue)
Constructor to copy an SFColorObject value as initial value for this new field object. -
Method Summary
Modifier and Type Method Description SFColorObject
complementRGB()
Complement all color values in RGB space (i.e. subtract each component from 1).boolean
equals(SFColorObject comparisonSFColorObject)
Determine whether two objects contain equal values.float[]
getPrimitiveValue()
Provides current value of the field as a Java primitive type.void
getValue(float[] valueDestination)
Get the current value of this SFColorObject by copying it into the valueDestination array, leaving the current object unchanged.void
initialize()
Initialization for SFColorObject applies default initial value.static boolean
isArray()
Whether or not this field type is an array (false)boolean
isDefaultValue()
Determine whether current value matches DEFAULT_VALUEboolean
matches()
Test PATTERN match via regular expression (regex) check of current object's toString() value.static boolean
matches(java.lang.String value)
Test PATTERN match with regular expression (regex) of provided value.SFColorObject
normalizeClip()
Ensure all component color values are within range [0-1] by clipping as necessary.SFColorObject
scaleRGB(float scaleFactor)
Scale all color values in RGB space.SFColorObject
setValue(double[] newValue)
Assign a new value to this field.SFColorObject
setValue(double red, double green, double blue)
Assign a new value to this field.void
setValue(float[] newValue)
Assign a new value to this field.SFColorObject
setValue(float red, float green, float blue)
Assign a new value to this field.SFColorObject
setValue(int hexColorValue)
Public utility accessor method setting single HTML-style 0xRRGGBB hex value as new value.SFColorObject
setValue(SFColorObject newValue)
Apply an SFColorObject value to this field.SFColorObject
setValueArray(float[] newValue)
Assign a new array value to this field, pipelined.SFColorObject
setValueByString(java.lang.String newValue)
Utility accessor for SFColorObject using String value (which must pass parsing validation checks).float[]
toFloatArray()
Provide float array for this field type.static float[]
toFloatArray(int hexColorValue)
Public utility method converting single HTML-style 0xRRGGBB hex value to three-tuple float array.java.lang.String
toString()
Provides current value as a String.static java.lang.String
toString(float[] value)
Static utility method to provide String representation of a correctly typed input value.java.lang.String
toStringCSS()
Provide CSS color value for this object.static java.lang.String
toStringCSS(float[] colors)
Provide CSS color value foran RGB triplet.static java.lang.String
toStringCSS(float red, float green, float blue)
Provide CSS color value for RGB values.java.lang.String
toStringHTML()
Provide HTML color value for this object.static java.lang.String
toStringHTML(float[] colors)
Provide HTML color value for an RGB triplet.static java.lang.String
toStringHTML(float red, float green, float blue)
Provide HTML color value for RGB values.java.lang.String
validate()
Validate current value via get/set comparison testsjava.lang.String
validateRegex()
Validate current value via regular expression (regex) check of current object's toString() value, reporting errors only if found.Methods inherited from class org.web3d.x3d.jsail.fields.X3DConcreteField
addX3DEventListener, getDefinition, getTupleSize, getValidationResult, isReadable, isWritable, removeX3DEventListener, setReadable, setWritable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.web3d.x3d.sai.X3DField
addX3DEventListener, getDefinition, isReadable, isWritable, removeX3DEventListener
-
Field Details
-
NAME
public static final java.lang.String NAMEString constant NAME provides name of this element: SFColor- See Also:
- Constant Field Values
-
DEFAULT_VALUE
public static final float[] DEFAULT_VALUEDefault value for this field type is 0 0 0.- See Also:
- Java Tutorials: Primitive Data Types
-
DEFAULT_VALUE_STRING
public static final java.lang.String DEFAULT_VALUE_STRINGDefault string value for this field type is "0 0 0".- See Also:
- Constant Field Values
-
TUPLE_SIZE
public static final int TUPLE_SIZEDefault tuple size for this field type is 3 (i.e. number of component values making up a single-field SF object).- See Also:
- Constant Field Values
-
REGEX
public static final java.lang.String REGEXDefault regular expression (regex) pattern for this field type is (\s)*(([+]?((0(\.[0-9]*)?|\.[0-9]+)|1(\.0*)?)([Ee][+-]?[0-9]+)?)(\s)+){2}([+]?((0(\.[0-9]*)?|\.[0-9]+)|1(\.0*)?)([Ee][+-]?[0-9]+)?)(\s)* -
PATTERN
public static final java.util.regex.Pattern PATTERNPrecompiled regular expression (regex) pattern for this field type using default REGEX value.- See Also:
REGEX
,matches()
,matches(String)
,validate()
, java.util.regex.Pattern
-
ALICEBLUE
public static float[] ALICEBLUE -
ANTIQUEWHITE
public static float[] ANTIQUEWHITE -
AQUA
public static float[] AQUA -
AQUAMARINE
public static float[] AQUAMARINE -
AZURE
public static float[] AZURE -
BEIGE
public static float[] BEIGE -
BISQUE
public static float[] BISQUE -
BLACK
public static float[] BLACK -
BLANCHEDALMOND
public static float[] BLANCHEDALMOND -
BLUE
public static float[] BLUE -
BLUEVIOLET
public static float[] BLUEVIOLET -
BROWN
public static float[] BROWN -
BURLYWOOD
public static float[] BURLYWOOD -
CADETBLUE
public static float[] CADETBLUE -
CHARTREUSE
public static float[] CHARTREUSE -
CHOCOLATE
public static float[] CHOCOLATE -
CORAL
public static float[] CORAL -
CORNFLOWERBLUE
public static float[] CORNFLOWERBLUE -
CORNSILK
public static float[] CORNSILK -
CRIMSON
public static float[] CRIMSON -
CYAN
public static float[] CYAN -
DARKBLUE
public static float[] DARKBLUE -
DARKCYAN
public static float[] DARKCYAN -
DARKGOLDENROD
public static float[] DARKGOLDENROD -
DARKGRAY
public static float[] DARKGRAY -
DARKGREEN
public static float[] DARKGREEN -
DARKGREY
public static float[] DARKGREY -
DARKKHAKI
public static float[] DARKKHAKI -
DARKMAGENTA
public static float[] DARKMAGENTA -
DARKOLIVEGREEN
public static float[] DARKOLIVEGREEN -
DARKORANGE
public static float[] DARKORANGE -
DARKORCHID
public static float[] DARKORCHID -
DARKRED
public static float[] DARKRED -
DARKSALMON
public static float[] DARKSALMON -
DARKSEAGREEN
public static float[] DARKSEAGREEN -
DARKSLATEBLUE
public static float[] DARKSLATEBLUE -
DARKSLATEGRAY
public static float[] DARKSLATEGRAY -
DARKSLATEGREY
public static float[] DARKSLATEGREY -
DARKTURQUOISE
public static float[] DARKTURQUOISE -
DARKVIOLET
public static float[] DARKVIOLET -
DEEPPINK
public static float[] DEEPPINK -
DEEPSKYBLUE
public static float[] DEEPSKYBLUE -
DIMGRAY
public static float[] DIMGRAY -
DIMGREY
public static float[] DIMGREY -
DODGERBLUE
public static float[] DODGERBLUE -
FIREBRICK
public static float[] FIREBRICK -
FLORALWHITE
public static float[] FLORALWHITE -
FORESTGREEN
public static float[] FORESTGREEN -
FUCHSIA
public static float[] FUCHSIA -
GAINSBORO
public static float[] GAINSBORO -
GHOSTWHITE
public static float[] GHOSTWHITE -
GOLD
public static float[] GOLD -
GOLDENROD
public static float[] GOLDENROD -
GRAY
public static float[] GRAY -
GREEN
public static float[] GREEN -
GREENYELLOW
public static float[] GREENYELLOW -
GREY
public static float[] GREY -
HONEYDEW
public static float[] HONEYDEW -
HOTPINK
public static float[] HOTPINK -
INDIANRED
public static float[] INDIANRED -
INDIGO
public static float[] INDIGO -
IVORY
public static float[] IVORY -
KHAKI
public static float[] KHAKI -
LAVENDER
public static float[] LAVENDER -
LAVENDERBLUSH
public static float[] LAVENDERBLUSH -
LAWNGREEN
public static float[] LAWNGREEN -
LEMONCHIFFON
public static float[] LEMONCHIFFON -
LIGHTBLUE
public static float[] LIGHTBLUE -
LIGHTCORAL
public static float[] LIGHTCORAL -
LIGHTCYAN
public static float[] LIGHTCYAN -
LIGHTGOLDENRODYELLOW
public static float[] LIGHTGOLDENRODYELLOW -
LIGHTGRAY
public static float[] LIGHTGRAY -
LIGHTGREEN
public static float[] LIGHTGREEN -
LIGHTGREY
public static float[] LIGHTGREY -
LIGHTPINK
public static float[] LIGHTPINK -
LIGHTSALMON
public static float[] LIGHTSALMON -
LIGHTSEAGREEN
public static float[] LIGHTSEAGREEN -
LIGHTSKYBLUE
public static float[] LIGHTSKYBLUE -
LIGHTSLATEGRAY
public static float[] LIGHTSLATEGRAY -
LIGHTSLATEGREY
public static float[] LIGHTSLATEGREY -
LIGHTSTEELBLUE
public static float[] LIGHTSTEELBLUE -
LIGHTYELLOW
public static float[] LIGHTYELLOW -
LIME
public static float[] LIME -
LIMEGREEN
public static float[] LIMEGREEN -
LINEN
public static float[] LINEN -
MAGENTA
public static float[] MAGENTA -
MAROON
public static float[] MAROON -
MEDIUMAQUAMARINE
public static float[] MEDIUMAQUAMARINE -
MEDIUMBLUE
public static float[] MEDIUMBLUE -
MEDIUMORCHID
public static float[] MEDIUMORCHID -
MEDIUMPURPLE
public static float[] MEDIUMPURPLE -
MEDIUMSEAGREEN
public static float[] MEDIUMSEAGREEN -
MEDIUMSLATEBLUE
public static float[] MEDIUMSLATEBLUE -
MEDIUMSPRINGGREEN
public static float[] MEDIUMSPRINGGREEN -
MEDIUMTURQUOISE
public static float[] MEDIUMTURQUOISE -
MEDIUMVIOLETRED
public static float[] MEDIUMVIOLETRED -
MIDNIGHTBLUE
public static float[] MIDNIGHTBLUE -
MINTCREAM
public static float[] MINTCREAM -
MISTYROSE
public static float[] MISTYROSE -
MOCCASIN
public static float[] MOCCASIN -
NAVAJOWHITE
public static float[] NAVAJOWHITE -
NAVY
public static float[] NAVY -
OLDLACE
public static float[] OLDLACE -
OLIVE
public static float[] OLIVE -
OLIVEDRAB
public static float[] OLIVEDRAB -
ORANGE
public static float[] ORANGE -
ORANGERED
public static float[] ORANGERED -
ORCHID
public static float[] ORCHID -
PALEGOLDENROD
public static float[] PALEGOLDENROD -
PALEGREEN
public static float[] PALEGREEN -
PALETURQUOISE
public static float[] PALETURQUOISE -
PALEVIOLETRED
public static float[] PALEVIOLETRED -
PAPAYAWHIP
public static float[] PAPAYAWHIP -
PEACHPUFF
public static float[] PEACHPUFF -
PERU
public static float[] PERU -
PINK
public static float[] PINK -
PLUM
public static float[] PLUM -
POWDERBLUE
public static float[] POWDERBLUE -
PURPLE
public static float[] PURPLE -
RED
public static float[] RED -
ROSYBROWN
public static float[] ROSYBROWN -
ROYALBLUE
public static float[] ROYALBLUE -
SADDLEBROWN
public static float[] SADDLEBROWN -
SALMON
public static float[] SALMON -
SANDYBROWN
public static float[] SANDYBROWN -
SEAGREEN
public static float[] SEAGREEN -
SEASHELL
public static float[] SEASHELL -
SIENNA
public static float[] SIENNA -
SILVER
public static float[] SILVER -
SKYBLUE
public static float[] SKYBLUE -
SLATEBLUE
public static float[] SLATEBLUE -
SLATEGRAY
public static float[] SLATEGRAY -
SLATEGREY
public static float[] SLATEGREY -
SNOW
public static float[] SNOW -
SPRINGGREEN
public static float[] SPRINGGREEN -
STEELBLUE
public static float[] STEELBLUE -
TAN
public static float[] TAN -
TEAL
public static float[] TEAL -
THISTLE
public static float[] THISTLE -
TOMATO
public static float[] TOMATO -
TURQUOISE
public static float[] TURQUOISE -
VIOLET
public static float[] VIOLET -
WHEAT
public static float[] WHEAT -
WHITE
public static float[] WHITE -
WHITESMOKE
public static float[] WHITESMOKE -
YELLOW
public static float[] YELLOW -
YELLOWGREEN
public static float[] YELLOWGREEN
-
-
Constructor Details
-
SFColorObject
public SFColorObject()Constructor for SFColorObject performs value initialization. -
SFColorObject
Constructor to copy an SFColorObject value as initial value for this new field object.- Parameters:
newValue
- The newValue to apply
-
SFColorObject
public SFColorObject(float[] newValue)Constructor for SFColorObject using a corresponding Java primitive float[] array as new initial value.- Parameters:
newValue
- is new value to assign Warning: newValue array length must correspond to tuple size for base type SFColor tuple size of 3. setContainerFieldOverride(containerFieldName); // apply checksConcreteField#getTupleSize(String)
-
SFColorObject
public SFColorObject(float red, float green, float blue)Constructor using individual float types as new initial value (which must pass validation checks).- Parameters:
red
- first component [0..1]green
- second component [0..1]blue
- third component [0..1]- See Also:
- X3D Scene Authoring Hints: Color
-
SFColorObject
public SFColorObject(double red, double green, double blue)Constructor using individual double types as new initial value (which must pass validation checks).- Parameters:
red
- first component [0..1]green
- second component [0..1]blue
- third component [0..1]- See Also:
- X3D Scene Authoring Hints: Color
-
SFColorObject
public SFColorObject(int hexColorValue)Constructor using single HTML-style 0xRRGGBB hex value as new initial value.- Parameters:
hexColorValue
- HTML color value (such as 0xAA2288)- See Also:
- X3D Scene Authoring Hints: Color
-
SFColorObject
public SFColorObject(double[] newValue)Utility constructor for SFColorObject using an alternatively typed Java double[] array as new initial value.- Parameters:
newValue
- is new value to assign
-
-
Method Details
-
isArray
public static final boolean isArray()Whether or not this field type is an array (false)- Returns:
- true if array type
-
initialize
public final void initialize()Initialization for SFColorObject applies default initial value. Static initializer also provided to verify that the regex pattern compiles and matches that default value.- Specified by:
initialize
in classX3DConcreteField
- See Also:
- Stack Overflow: How to check if a given Regex is valid?,
DEFAULT_VALUE
-
equals
Determine whether two objects contain equal values.- Parameters:
comparisonSFColorObject
- field type to compare- Returns:
- true if equivalent, false otherwise
-
validate
public final java.lang.String validate()Validate current value via get/set comparison tests- Returns:
- empty string if get/set testing passes, warning otherwise
- See Also:
validate()
,validateRegex()
-
validateRegex
public final java.lang.String validateRegex()Validate current value via regular expression (regex) check of current object's toString() value, reporting errors only if found.- Returns:
- empty string if PATTERN matches, warning otherwise
- See Also:
REGEX
,PATTERN
,matches()
,matches(String)
,validate()
,validate()
, java.util.regex.Pattern
-
matches
public final boolean matches()Test PATTERN match via regular expression (regex) check of current object's toString() value.- Returns:
- true if PATTERN matches, false otherwise
- See Also:
REGEX
,PATTERN
,matches()
,matches(String)
,validate()
, java.util.regex.Pattern
-
matches
public static final boolean matches(java.lang.String value)Test PATTERN match with regular expression (regex) of provided value.- Parameters:
value
- String to check against regex pattern for successful match- Returns:
- true if PATTERN matches, false otherwise
- See Also:
REGEX
,PATTERN
,matches()
,matches(String)
,validate()
, java.util.regex.Pattern
-
setValueByString
Utility accessor for SFColorObject using String value (which must pass parsing validation checks).
Warning: this method is not type safe at compile time! Best practice for X3DJSAIL programmers is to use strongly typed methods instead, in order to avoid potential for run-time errors.- Parameters:
newValue
- is new value to assign, if empty then assign DEFAULT_VALUE- Returns:
MFMatrix4dObject
- namely this same object to allow sequential method pipelining (i.e. consecutive method invocations on the same node object).- Throws:
InvalidFieldValueException
- See Also:
X3DLoaderDOM.toX3dObjectTree(org.w3c.dom.Node)
-
toFloatArray
public static float[] toFloatArray(int hexColorValue)Public utility method converting single HTML-style 0xRRGGBB hex value to three-tuple float array. TODO: also MFColor.- Parameters:
hexColorValue
- HTML color value (such as 0xAA2288)- Returns:
- float[3] array containing X3D RGB values, each ranging [0..1]
- See Also:
- X3D Scene Authoring Hints: Color
-
setValue
Public utility accessor method setting single HTML-style 0xRRGGBB hex value as new value.- Parameters:
hexColorValue
- HTML color value (such as 0xAA2288)- Returns:
SFColorObject
- namely this same object to allow sequential method pipelining (i.e. consecutive method invocations on the same object).- See Also:
- X3D Scene Authoring Hints: Color
-
complementRGB
Complement all color values in RGB space (i.e. subtract each component from 1).- Returns:
SFColorObject
- namely this same object to allow sequential method pipelining (i.e. consecutive method invocations on the same object).- See Also:
- Wikipedia: Negative (photography), Wikipedia: Complementary colors, X3D Scene Authoring Hints: Color
-
scaleRGB
Scale all color values in RGB space.- Parameters:
scaleFactor
- nonnegative scaling factor- Returns:
SFColorObject
- namely this same object to allow sequential method pipelining (i.e. consecutive method invocations on the same object).- See Also:
- X3D Scene Authoring Hints: Color
-
normalizeClip
Ensure all component color values are within range [0-1] by clipping as necessary.- Returns:
SFColorObject
- namely this same object to allow sequential method pipelining (i.e. consecutive method invocations on the same object).- See Also:
- X3D Scene Authoring Hints: Color
-
toStringHTML
public java.lang.String toStringHTML()Provide HTML color value for this object. -
toStringHTML
public static java.lang.String toStringHTML(float red, float green, float blue)Provide HTML color value for RGB values.- Parameters:
red
- red value [0..1]green
- value value [0..1]blue
- blue value [0..1]- Returns:
- HTML color value
- See Also:
- X3D Scene Authoring Hints: Color, HyperText Markup Language (HTML) 5.2, section 2.4.6 Colors, Cascading Style Sheets (CSS) Color Module Level 3, Java Tutorials: Formatting Numeric Print Output, stackoverflow: Integer to two digits hex in Java
-
toStringHTML
public static java.lang.String toStringHTML(float[] colors)Provide HTML color value for an RGB triplet.- Parameters:
colors
- RGB triplet with values [0..1]- Returns:
- HTML color value
- See Also:
- X3D Scene Authoring Hints: Color, HyperText Markup Language (HTML) 5.2, section 2.4.6 Colors, Cascading Style Sheets (CSS) Color Module Level 3, Java Tutorials: Formatting Numeric Print Output, stackoverflow: Integer to two digits hex in Java
-
toStringCSS
public java.lang.String toStringCSS()Provide CSS color value for this object. -
toStringCSS
public static java.lang.String toStringCSS(float red, float green, float blue)Provide CSS color value for RGB values.- Parameters:
red
- red value [0..1]green
- value value [0..1]blue
- blue value [0..1]- Returns:
- CSS color value
- See Also:
- X3D Scene Authoring Hints: Color, HyperText Markup Language (HTML) 5.2, section 2.4.6 Colors, Cascading Style Sheets (CSS) Color Module Level 3: section 4.2.1. RGB color values
-
toStringCSS
public static java.lang.String toStringCSS(float[] colors)Provide CSS color value foran RGB triplet.- Parameters:
colors
- RGB triplet with values [0..1]- Returns:
- CSS color value
- See Also:
- X3D Scene Authoring Hints: Color, HyperText Markup Language (HTML) 5.2, section 2.4.6 Colors, Cascading Style Sheets (CSS) Color Module Level 3
-
setValue
Assign a new value to this field. Warning: newValue array length must correspond to tuple size for base type SFColor tuple size of 3.- Parameters:
newValue
- The replacement value to assign.- Returns:
SFColorObject
- namely this same object to allow sequential method pipelining (i.e. consecutive method invocations on the same object).- See Also:
X3DConcreteField.getTupleSize(String)
-
toString
public static java.lang.String toString(float[] value)Static utility method to provide String representation of a correctly typed input value.- Parameters:
value
- The value to convert to a String- Returns:
- String version of the provided value, with trailing zeroes and decimal points omitted.
- See Also:
- X3D Tooltips: type,
SFFloatObject.stripTrailingZeroes(float)
-
getValue
public void getValue(float[] valueDestination)Get the current value of this SFColorObject by copying it into the valueDestination array, leaving the current object unchanged. -
getPrimitiveValue
public float[] getPrimitiveValue()Provides current value of the field as a Java primitive type.- Returns:
- current value
-
toString
public java.lang.String toString()Provides current value as a String.- Overrides:
toString
in classjava.lang.Object
- Returns:
- String version of the provided value, with trailing zeroes and decimal points omitted.
- See Also:
- X3D Tooltips: type SFColor,
SFFloatObject.stripTrailingZeroes(float)
-
setValue
public void setValue(float[] newValue)Assign a new value to this field. Warning: newValue array length must correspond to tuple size for base type SFColor tuple size of 3.- Specified by:
setValue
in interfaceSFColor
- Parameters:
newValue
- The replacement value to assign.- See Also:
X3DConcreteField.getTupleSize(String)
-
setValueArray
Assign a new array value to this field, pipelined. This is an alternate utility method since primary method returns void and cannot be overridden. Warning: newValue array length must correspond to tuple size for base type SFColor tuple size of 3.- Parameters:
newValue
- The replacement value to assign.- Returns:
SFColorObject
- namely this same object to allow sequential method pipelining (i.e. consecutive method invocations on the same object).- See Also:
X3DConcreteField.getTupleSize(String)
-
setValue
Assign a new value to this field.- Parameters:
red
- first component [0..1]green
- second component [0..1]blue
- third component [0..1]- Returns:
SFColorObject
- namely this same object to allow sequential method pipelining (i.e. consecutive method invocations on the same object).
-
setValue
Assign a new value to this field.- Parameters:
red
- first component [0..1]green
- second component [0..1]blue
- third component [0..1]- Returns:
SFColorObject
- namely this same object to allow sequential method pipelining (i.e. consecutive method invocations on the same object).
-
toFloatArray
public float[] toFloatArray()Provide float array for this field type.- Returns:
- Array of floats in this field array.
-
setValue
Apply an SFColorObject value to this field.- Parameters:
newValue
- The newValue to apply- Returns:
SFColorObject
- namely this same object to allow sequential method pipelining (i.e. consecutive method invocations on the same object).
-
isDefaultValue
public boolean isDefaultValue()Determine whether current value matches DEFAULT_VALUE- Returns:
- whether current value matches DEFAULT_VALUE
- See Also:
DEFAULT_VALUE
-