Linear Gradient

class img_gen.LinearGradient(colors: ColorGradient, start: Offset, end: Offset, spread: Spread = Spread.Pad)

A data structure to represent a linear gradient

as_json_str()

Serialize the LinearGradient object to a JSON string.

as_yaml_str()

Serialize the LinearGradient object to a YAML string.

end

The gradient ending point (Offset).

static from_json_str(json_str)

Deserialize a LinearGradient object from a JSON string.

static from_yaml_str(yaml_str)

Deserialize a LinearGradient object from a YAML string.

get_color_at(x: int, y: int) SolidColor

A helper function to Generator.render() behavior.

The given x and y values (unsigned) are the coordinate of the pixel in the Layer (relative to Layer.offset).

spread

The gradient Spread

start

The gradient starting point (Offset).