|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.extex.interpreter.type.AbstractCode
org.extex.interpreter.type.AbstractAssignment
org.extex.unit.color.AbstractColor
org.extex.unit.color.ColorPrimitive
public class ColorPrimitive
This class provides an implementation for the primitive
The primitive \color sets the current color value to the value
given. The value can be any color specification for one of the supported
color models.
The color models of
The color models of
The RGB color model provides three values for the red, green, and blue
channel. Each is given as floating point number from 0.0 to 1.0.
The CMYK color model provides four values for cyan, magenta, yellow, and
black channel. Each is given as floating point number from 0.0 to 1.0.
The gray-scale color model provides one value for the gray channel. It is
given as floating point number from 0.0 to 1.0.
The HSV color model provides three values for the hue, saturation, and value
channel. Each is given as floating point number from 0.0 to 1.0.
The alpha channel determines the opactivity of the color. A value of 0 means
that the given color completely overwrites the underlying texture. A value of
1.0 is the maximal admissible alpha value. In this case the color is in fact
invisible. In between the background shines through to the degree of the
alpha value.
Note that the alpha channel may not be supported by any output device. In
such a case it is up to the back-end driver to make best use of the alpha
value or ignore it at all.
\color.
The Primitive \color
The RGB Color Model
The CMYK Color Model
The Grayscale Model
The HSV Color Model
The Alpha Channel
Syntax
The formal description of this primitive is the following:
〈color〉
→ 〈prefix〉 \color 〈alpha〉 〈color〉
〈prefix〉
→
| \global
〈alpha〉
→
| alpha 〈number〉
〈color〉
→ { 〈color value〉 〈color value〉 〈color value〉 }
| rgb { 〈color value〉 〈color value〉 〈color value〉 }
| gray { 〈color value〉 }
| cmyk { 〈color value〉 〈color value〉 〈color value〉 〈color value〉 }
| hsv { 〈color value〉 〈color value〉 〈color value〉 }
| 〈color convertible〉
〈color value〉
→ 〈number〉
Examples
\color{\r \b \g}
\color gray {\gray}
\color rgb {\r \b \g}
\color rgb {1 .2 .3333}
\color hsv {\h \s \v}
\color alpha 500 rgb {\r \b \g}
| Field Summary | |
|---|---|
protected static long |
serialVersionUID
The constant serialVersionUID contains the id for serialization. |
| Constructor Summary | |
|---|---|
ColorPrimitive(CodeToken token)
Creates a new object. |
|
| Method Summary | |
|---|---|
void |
assign(Flags prefix,
Context context,
TokenSource source,
Typesetter typesetter)
The method assign is the core of the functionality of execute(). |
Color |
convertColor(Context context,
TokenSource source,
Typesetter typesetter)
This method converts something into a color. |
| Methods inherited from class org.extex.unit.color.AbstractColor |
|---|
show, the |
| Methods inherited from class org.extex.interpreter.type.AbstractAssignment |
|---|
execute |
| Methods inherited from class org.extex.interpreter.type.AbstractCode |
|---|
getLocalizer, getName, getToken, isIf, isOuter, readResolve, toString, toText, toText |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final long serialVersionUID
| Constructor Detail |
|---|
public ColorPrimitive(CodeToken token)
token - the initial token for the primitive| Method Detail |
|---|
public void assign(Flags prefix,
Context context,
TokenSource source,
Typesetter typesetter)
throws ConfigurationException,
HelpingException,
TypesetterException
execute().
This method is preferable to execute() since the
execute() method provided in this class takes care of
\afterassignment and \globaldefs as well.
assign in class AbstractAssignmentprefix - the prefix controlling the executioncontext - the interpreter contextsource - the token sourcetypesetter - the typesetter
ConfigurationException - in case of an configuration error
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetterAbstractAssignment.assign(
org.extex.interpreter.Flags, org.extex.interpreter.context.Context,
org.extex.interpreter.TokenSource, org.extex.typesetter.Typesetter)
public Color convertColor(Context context,
TokenSource source,
Typesetter typesetter)
throws HelpingException
context - the interpreter contextsource - the source for new tokenstypesetter - the typesetter to use for conversion
HelpingException - in case of an errorColorConvertible.convertColor(
org.extex.interpreter.context.Context,
org.extex.interpreter.TokenSource, org.extex.typesetter.Typesetter)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||