Skip to content
LineJoin

LineJoin

Mojo struct 🡭

LineJoin

@memory_only
struct LineJoin

How a stroke turns a corner.

ROUND, the default, fills the corner with a disk of the stroke’s radius. BEVEL cuts it off flat, joining the two outer corners. MITER extends both outer edges until they meet, giving a sharp point.

MITER needs a limit: as a corner tightens its apex runs away towards infinity, sticking out more than eleven times the half-width at 10 degrees, so past miter_limit the join falls back to BEVEL. That is SVG’s rule, and its default of 4 trips at about 29 degrees.

Joins apply only where a stroke turns; the ends of an open stroke are a cap.

Aliases

  • ROUND = LineJoin(Int(0))
  • BEVEL = LineJoin(Int(1))
  • MITER = LineJoin(Int(2))

Implemented traits

AnyType, Copyable, Deinitable, Equatable, ImplicitlyCopyable, Movable, Writable

Methods

__init__

fn def __init__(out self, value: Int)

Prefer the ROUND/BEVEL/MITER comptime constants over constructing one directly.

Args:

  • value (Int): 0 for ROUND, 1 for BEVEL, 2 for MITER.
  • self (Self)

Returns:

Self

__eq__

fn def __eq__(self, other: Self) -> Bool

Args:

  • self (Self)
  • other (Self)

Returns:

Bool

__ne__

fn def __ne__(self, other: Self) -> Bool

Args:

  • self (Self)
  • other (Self)

Returns:

Bool

write_to

fn def write_to[W: Writer](self, mut writer: W)

Parameters:

  • W (Writer)

Args:

  • self (Self)
  • writer (W)

__str__

fn def __str__(self) -> String

Args:

  • self (Self)

Returns:

String