Shapes

Concept

Constructing simple geometric shapes is provided by the Shape algebra. All the methods on the algebra are constructors, so typically you'd access them by calling methods on the Picture object. Here's an example.

import doodle.core.*
import doodle.java2d.*
import doodle.syntax.all.*

val basicShapes =
  Picture
    .circle(200)
    .strokeColor(Color.blue)
    .on(Picture.square(125).strokeColor(Color.darkBlue))
    .on(Picture.triangle(100, 100).strokeColor(Color.crimson))
    .strokeWidth(5.0)

This program gives the output below.

A circle on a square on a triangle

Here is a short description of all the methods provided by Shape.

Implementation

These methods are available on both the Shape algebra and Image.

Paths→