|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.dante.extex.interpreter.type.AbstractCode
de.dante.extex.interpreter.type.AbstractAssignment
de.dante.extex.interpreter.primitives.color.AbstractColor
de.dante.extex.interpreter.primitives.color.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 opactness 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(java.lang.String name)
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 de.dante.extex.interpreter.primitives.color.AbstractColor |
show, the |
Methods inherited from class de.dante.extex.interpreter.type.AbstractAssignment |
execute |
Methods inherited from class de.dante.extex.interpreter.type.AbstractCode |
enableLocalization, getLocalizer, getName, isIf, isOuter, printable, printableControlSequence, readResolve, setName, toString |
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(java.lang.String name)
name
- the name for debuggingMethod Detail |
public void assign(Flags prefix, Context context, TokenSource source, Typesetter typesetter) throws InterpreterException
AbstractAssignment
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 AbstractAssignment
prefix
- the prefix controlling the executioncontext
- the interpreter contextsource
- the token sourcetypesetter
- the typesetter
InterpreterException
- in case of an errorAbstractAssignment.assign(
de.dante.extex.interpreter.Flags,
de.dante.extex.interpreter.context.Context,
de.dante.extex.interpreter.TokenSource,
de.dante.extex.typesetter.Typesetter)
public Color convertColor(Context context, TokenSource source, Typesetter typesetter) throws InterpreterException
ColorConvertible
context
- the interpreter contextsource
- the source for new tokenstypesetter
- the typesetter to use for conversion
InterpreterException
- in case of an errorColorConvertible.convertColor(
de.dante.extex.interpreter.context.Context,
de.dante.extex.interpreter.TokenSource,
de.dante.extex.typesetter.Typesetter)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |