public class LineAttributes extends NodeComponent
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
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
LineAttributes()
Constructs a LineAttributes object with default parameters.
|
LineAttributes(float lineWidth,
int linePattern,
boolean lineAntialiasing)
Constructs a LineAttributes object with specified values.
|
Modifier and Type | Method and Description |
---|---|
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.
|
cloneNodeComponent, duplicateNodeComponent, duplicateNodeComponent, getDuplicateOnCloneTree, setDuplicateOnCloneTree
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString, updateNodeReferences
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 Valuespublic 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 OFFpublic void setLineWidth(float lineWidth)
lineWidth
- the width, in pixels, of line primitivesCapabilityNotSetException
- 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 maskCapabilityNotSetException
- 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 factorCapabilityNotSetException
- 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 antialiasingCapabilityNotSetException
- 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
Copyright © 2016–2022 SciJava. All rights reserved.