Skip to content
ColorSource

ColorSource

Mojo trait 🡭

ColorSource

Anything that can answer “what color is at this point?” – the fill source a gradient-filled shape queries per pixel.

Conformance is nominal per Mojo’s trait rule, so a new fill source has to declare ColorSource explicitly to be usable as one.

Implemented traits

AnyType

Methods

color_at

fn def color_at(self, x: Float64, y: Float64) -> Color

This source’s color at (x, y), in canvas pixel coordinates.

Args:

  • self (_Self)
  • x (Float64): Point x.
  • y (Float64): Point y.

Returns:

Color: The color to paint at that point.