Sketch

public protocol Sketch

An object which can draw shapes to a DrawingContext

  • Title of the sketch

    Declaration

    Swift

    static var title: String { get set }
  • Size of the sketch

    Declaration

    Swift

    var size: Size { get set }
  • Whether to repeatedly call .draw()

    Declaration

    Swift

    var loop: SketchAnimation { get set }
  • Instantiate a new sketch

    Declaration

    Swift

    init()
  • Draw all objects to the current DrawingContext

    Declaration

    Swift

    func draw()
  • context Extension method

    Returns the current DrawingContext

    Declaration

    Swift

    public var context: DrawingContext? { get }
  • hashedFileName() Extension method

    Return a unique file name based on a hash of the time and pid.

    The string takes the form of YYYYMMDD-HHmmss-<short hash>

    Declaration

    Swift

    public func hashedFileName() -> String
  • Draw a solid rectangle over the sketch

    Declaration

    Swift

    public func drawBackground(fillColor: Color = .white, drawInSVG: Bool = false)

    Parameters

    fillColor

    Color of the background to draw

    drawInSVG

    Draw the background in SVGContext