Skip to content

🚀 This new wiki is in beta! Please double-check for any issue and report them on the GitHub

Brushes

Instead of simple colors, you can use brushes to create more complex fills for your shapes. Brushes allow you to create gradients, patterns, textures, and other visual effects.

The most basic brush is a solid color:

set {_brush} to new solid brush with color red
set {_shape} to new rectangle with width 80 and height 80 and brush {_brush}

Gradient brushes create a smooth transition between multiple colors:

set {_brush} to new horizontal gradient brush with colors red, yellow, blue
set {_shape} to new rectangle with width 80 and height 80 and brush {_brush}

Pattern brushes create repeating patterns:

set {_brush} to new checkerboard pattern brush with primary color black and secondary color white and size 10
set {_shape} to new rectangle with width 80 and height 80 and brush {_brush}

Hatch brushes create line-based patterns:

set {_brush} to new horizontal hatch brush with primary color black and secondary color white and spacing 5
set {_shape} to new rectangle with width 80 and height 80 and brush {_brush}

These brushes create more complex visual effects:

set {_brush} to new marble brush with primary color blue and secondary color white and turbulence 0.5
set {_shape} to new rectangle with width 80 and height 80 and brush {_brush}

You can use an existing image as a texture brush:

set {_texture} to image from file "plugins/SkImage2/textures/grass.png"
set {_brush} to new texture brush from {_texture}
set {_shape} to new rectangle with width 80 and height 80 and brush {_brush}