Skip to content
Filter

Filter

Mojo struct 🡭

Filter

@memory_only
struct Filter

How a transformed draw_canvas reads the source between its pixels: NEAREST takes the one the sample point lands in, giving hard pixel edges and no color the source did not already hold, and BILINEAR mixes the four around it, giving smooth edges and intermediate colors.

Aliases

  • NEAREST = Filter(Int(0))
  • BILINEAR = Filter(Int(1))

Implemented traits

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

Methods

__init__

fn def __init__(out self, value: Int)

Prefer the NEAREST/BILINEAR comptime constants over constructing one directly.

Args:

  • value (Int): 0 for NEAREST, 1 for BILINEAR.
  • self (Self)

Returns:

Self

__eq__

fn def __eq__(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