AuthorTravis Kirton
Tags color
This example shows how to create colors from pattern images.
There are two images that come with the standard C4 installer, we will use them to stroke and fill a shape:
To create a color from any image, simply do this:
let color = Color("pattern1")
let f = Rect(0, 0, 200, 200) let rect = Rectangle(frame: f) rect.lineWidth = 50.0 rect.center = canvas.center canvas.add(rect) rect.strokeColor = Color("pattern1") rect.fillColor = Color("pattern2")