Extend
Mojo struct 🡭
Extend
@memory_only
struct ExtendHow PatternSource.color_at samples outside the tile’s own [0, width) x [0, height) bounds.
REPEAT tiles the pattern in both directions. REFLECT tiles it too,
mirroring alternate copies so adjacent tile edges match colors
exactly (Cairo/CSS call this “mirrored repeat”). PAD extends the
tile’s own edge pixels outward, the way LinearGradient/
RadialGradient extend past their axis. NONE paints nothing outside
the tile: color_at returns transparent there.
Aliases
REPEAT = Extend(Int(0))REFLECT = Extend(Int(1))PAD = Extend(Int(2))NONE = Extend(Int(3))
Implemented traits
AnyType, Copyable, Deinitable, Equatable, ImplicitlyCopyable, Movable, Writable
Methods
__init__
fn def __init__(out self, value: Int)Prefer the REPEAT/REFLECT/PAD/NONE comptime constants over constructing one directly.
Args:
- value (
Int): 0 for REPEAT, 1 for REFLECT, 2 for PAD, 3 for NONE. - self (
Self)
Returns:
Self
__eq__
fn def __eq__(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