fill_rect_gradient
Mojo function 🡭
fill_rect_gradient
fn def fill_rect_gradient(mut canvas: Canvas, x: Int, y: Int, width: Int, height: Int, gradient: LinearGradient)Fill a rectangle as fill_rect does, sourcing each pixel’s color from gradient (gradient.mojo) rather than one flat Color. Same once-up-front clamp as fill_rect.
Args:
- canvas (
Canvas): Canvas to fill into. - x (
Int): Rectangle’s left edge. - y (
Int): Rectangle’s top edge. - width (
Int): Rectangle’s width. - height (
Int): Rectangle’s height. - gradient (
LinearGradient): Fill source, projected across the rectangle.
fn def fill_rect_gradient(mut canvas: Canvas, x: Float64, y: Float64, width: Float64, height: Float64, gradient: LinearGradient)fill_rect_gradient for a geometric rectangle, snapped to whole pixels as the Float64 fill_rect snaps.
Args:
- canvas (
Canvas): Canvas to fill into. - x (
Float64): Left edge. - y (
Float64): Top edge. - width (
Float64): Width. - height (
Float64): Height. - gradient (
LinearGradient): Fill source, projected across the rectangle.