Table of Contents
1. currentlinejoin
Returns current line join style.
1.2. Stack Effects
| Level | Object |
|---|---|
(empty) |
– |
| Level | Object |
|---|---|
0 |
|
1.3. Description
currentlinejoin returns the current line join parameter from the graphics state. This is the value most recently set by setlinejoin.
Join styles:
-
0 = Miter join (sharp corners)
-
1 = Round join (curved corners)
-
2 = Bevel join (flattened corners)
1.5. Examples
Querying current line join
0 setlinejoin
currentlinejoin
% Stack: 0
Saving and restoring line join
currentlinejoin % Save
/savedJoin exch def
1 setlinejoin % Change to round
drawRectangle
savedJoin setlinejoin % Restore
Conditional drawing
currentlinejoin 0 eq {
% Miter - draw technical diagram
drawBlueprintStyle
} {
% Non-miter - draw artistic
drawArtisticStyle
} ifelse
1.6. Common Use Cases
1.6.1. Join State Preservation
/DrawWithRoundJoins {
currentlinejoin % Save
1 setlinejoin % Round
drawShape
setlinejoin % Restore
} def
1.7. Common Pitfalls
| Miter Limit Interaction - Miter joins (0) affected by miter limit setting. |
0 setlinejoin
currentlinejoin % Returns 0 (miter)
% But sharp miters may become bevels if
% angle exceeds miter limit
| Use Round for Smooth - Round joins (1) produce smoothest appearance. |
1.9. Implementation Notes
-
Very fast query operation
-
No modification to graphics state
-
Returns integer 0, 1, or 2
-
Default value is typically 0 (miter)
-
Miter joins controlled by miter limit
-
Widely supported (Level 1)
1.11. See Also
-
setlinejoin- Set line join style -
currentlinecap- Get line cap style -
currentlinewidth- Get line width -
currentmiterlimit- Get miter limit -
setmiterlimit- Set miter limit