LineCap
Mojo struct 🡭
LineCap
@memory_only
struct LineCapHow an open stroke ends.
ROUND, the default, caps with a half-disk of the stroke’s radius, so a stroke extends half its width past each endpoint – a 4px round cap on a rule from x=40 to x=560 spans 38 to 562. BUTT stops exactly at the endpoint. SQUARE stops half a width past it, flat.
Caps apply only to the two ends of an open stroke; a closed polygon has no ends and ignores them.
Aliases
ROUND = LineCap(Int(0))BUTT = LineCap(Int(1))SQUARE = LineCap(Int(2))
Implemented traits
AnyType, Copyable, Deinitable, Equatable, ImplicitlyCopyable, Movable, Writable
Methods
__init__
fn def __init__(out self, value: Int)Prefer the ROUND/BUTT/SQUARE comptime constants over constructing one directly.
Args:
- value (
Int): 0 for ROUND, 1 for BUTT, 2 for SQUARE. - self (
Self)
Returns:
Self
__eq__
fn def __eq__(self, other: Self) -> BoolArgs:
- self (
Self) - other (
Self)
Returns:
Bool
__ne__
fn def __ne__(self, other: Self) -> BoolArgs:
- 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) -> StringArgs:
- self (
Self)
Returns:
String