|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.j3d.SceneGraphObject | +--javax.media.j3d.NodeComponent | +--javax.media.j3d.LineAttributes
The LineAttributes object defines all rendering state that can be set as a component object of a Shape3D node. The line attributes that can be defined are:
If antialiasing is enabled, the lines are considered transparent for rendering purposes. They are rendered with all the other transparent objects and adhere to the other transparency settings such as the View transparency sorting policy and the View depth buffer freeze transparent enable.
User-defined Line Patterns
A user-defined line pattern is specified with a pattern mask and an optional scale factor.
The Pattern Mask
The pattern is specified using a 16-bit mask that specifies on and off segments. Bit 0 in the pattern mask corresponds to the first pixel of the line or line strip primitive. A value of 1 for a bit in the pattern mask indicates that the corresponding pixel is drawn, while a value of 0 indicates that the corresponding pixel is not drawn. After all 16 bits in the pattern are used, the pattern is repeated.
For example, a mask of 0x00ff defines a dashed line with a repeating pattern of 8 pixels on followed by 8 pixels off. A value of 0x0101 defines a a dotted line with a repeating pattern of 1 pixel on and 7 pixels off.
The pattern continues around individual line segments of a line strip primitive. It is restarted at the beginning of each new line strip. For line array primitives, the pattern is restarted at the beginning of each line.
The Scale Factor
The pattern is multiplied by the scale factor such that each bit in the pattern mask corresponds to that many consecutive pixels. For example, a scale factor of 3 applied to a pattern mask of 0x001f would produce a repeating pattern of 15 pixels on followed by 33 pixels off. The valid range for this attribute is [1,15]. Values outside this range are clamped.
Appearance
,
View
Field Summary | |
static int |
ALLOW_ANTIALIASING_READ
Specifies that this LineAttributes object allows reading its line antialiasing flag. |
static int |
ALLOW_ANTIALIASING_WRITE
Specifies that this LineAttributes object allows writing its line antialiasing flag. |
static int |
ALLOW_PATTERN_READ
Specifies that this LineAttributes object allows reading its line pattern information. |
static int |
ALLOW_PATTERN_WRITE
Specifies that this LineAttributes object allows writing its line pattern information. |
static int |
ALLOW_WIDTH_READ
Specifies that this LineAttributes object allows reading its line width information. |
static int |
ALLOW_WIDTH_WRITE
Specifies that this LineAttributes object allows writing its line width information. |
static int |
PATTERN_DASH
Draw dashed lines. |
static int |
PATTERN_DASH_DOT
Draw dashed-dotted lines. |
static int |
PATTERN_DOT
Draw dotted lines. |
static int |
PATTERN_SOLID
Draw solid lines with no pattern. |
static int |
PATTERN_USER_DEFINED
Draw lines with a user-defined line pattern. |
Constructor Summary | |
LineAttributes()
Constructs a LineAttributes object with default parameters. |
|
LineAttributes(float lineWidth,
int linePattern,
boolean lineAntialiasing)
Constructs a LineAttributes object with specified values. |
Method Summary | |
NodeComponent |
cloneNodeComponent()
Deprecated. replaced with cloneNodeComponent(boolean forceDuplicate) |
boolean |
getLineAntialiasingEnable()
Retrieves the state of the line antialiasing flag. |
int |
getLinePattern()
Gets the line pattern for this LineAttributes component object. |
float |
getLineWidth()
Gets the line width for this LineAttributes component object. |
int |
getPatternMask()
Retrieves the line pattern mask. |
int |
getPatternScaleFactor()
Retrieves the line pattern scale factor. |
void |
setLineAntialiasingEnable(boolean state)
Enables or disables line antialiasing for this LineAttributes component object. |
void |
setLinePattern(int linePattern)
Sets the line pattern for this LineAttributes component object. |
void |
setLineWidth(float lineWidth)
Sets the line width for this LineAttributes component object. |
void |
setPatternMask(int mask)
Sets the line pattern mask to the specified value. |
void |
setPatternScaleFactor(int scaleFactor)
Sets the line pattern scale factor to the specified value. |
Methods inherited from class javax.media.j3d.NodeComponent |
cloneNodeComponent, duplicateNodeComponent, duplicateNodeComponent, getDuplicateOnCloneTree, setDuplicateOnCloneTree |
Methods inherited from class javax.media.j3d.SceneGraphObject |
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setUserData, updateNodeReferences |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int ALLOW_WIDTH_READ
public static final int ALLOW_WIDTH_WRITE
public static final int ALLOW_PATTERN_READ
public static final int ALLOW_PATTERN_WRITE
public static final int ALLOW_ANTIALIASING_READ
public static final int ALLOW_ANTIALIASING_WRITE
public static final int PATTERN_SOLID
setLinePattern(int)
,
Constant Field Valuespublic static final int PATTERN_DASH
setLinePattern(int)
,
Constant Field Valuespublic static final int PATTERN_DOT
setLinePattern(int)
,
Constant Field Valuespublic static final int PATTERN_DASH_DOT
setLinePattern(int)
,
Constant Field Valuespublic static final int PATTERN_USER_DEFINED
setLinePattern(int)
,
setPatternMask(int)
,
setPatternScaleFactor(int)
,
Constant Field ValuesConstructor Detail |
public LineAttributes()
public LineAttributes(float lineWidth, int linePattern, boolean lineAntialiasing)
lineWidth
- the width of lines in pixelslinePattern
- the line pattern, one of PATTERN_SOLID,
PATTERN_DASH, PATTERN_DOT, or PATTERN_DASH_DOTlineAntialiasing
- flag to set line antialising ON or OFFMethod Detail |
public void setLineWidth(float lineWidth)
lineWidth
- the width, in pixels, of line primitives
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic float getLineWidth()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setLinePattern(int linePattern)
linePattern
- the line pattern to be used, one of:
PATTERN_SOLID, PATTERN_DASH, PATTERN_DOT, PATTERN_DASH_DOT, or
PATTERN_USER_DEFINED.
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic int getLinePattern()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setPatternMask(int mask)
The pattern continues around individual line segments of a line strip primitive. It is restarted at the beginning of each new line strip. For line array primitives, the pattern is restarted at the beginning of each line.
mask
- the new line pattern mask
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphsetPatternScaleFactor(int)
public int getPatternMask()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setPatternScaleFactor(int scaleFactor)
scaleFactor
- the new line pattern scale factor
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphsetPatternMask(int)
public int getPatternScaleFactor()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setLineAntialiasingEnable(boolean state)
If antialiasing is enabled, the lines are considered transparent for rendering purposes. They are rendered with all the other transparent objects and adhere to the other transparency settings such as the View transparency sorting policy and the View depth buffer freeze transparent enable.
state
- true or false to enable or disable line antialiasing
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphView
public boolean getLineAntialiasingEnable()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic NodeComponent cloneNodeComponent()
cloneNodeComponent
in class NodeComponent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |