DrawsanaView

public class DrawsanaView : UIView
extension DrawsanaView: DrawsanaViewShapeUpdating

Add this view to your view hierarchy to get going with Drawsana!

Public API

Views

  • View which is moved around to match the frame of the selected shape. You may configure whatever properties you want to to make it look like you want it to look.

    Declaration

    Swift

    public let selectionIndicatorView: UIView
  • Offset for the selection Indicatior, because it is placed relative to the anchorPoint. You should only have to change this if your anchorPoint is different from the default (0.5, 0.5)

    Declaration

    Swift

    public var selectionIndicatorAnchorPointOffset: CGPoint
  • Layer that backs DrawsanaView.selectionIndicatorView. You may set this layer’s properties to change its visual apparance. Its path and frame properties are managed by DrawsanaView.

    Declaration

    Swift

    public var selectionIndicatorViewShapeLayer: CAShapeLayer { get }

Init

API

  • Set the active tool to a new value. If you pass shape, it is passed on to the tool’s DrawingTool.activate(context:shape:) method.

    Declaration

    Swift

    public func set(tool: DrawingTool, shape: Shape? = nil)
  • Render the drawing on top of an image, using that image’s size. Shapes are re-scaled to match the resolution of the target without artifacts. The scale parameter defines wether image is rendered at the device’s native resolution (scale = 0.0) or to scale it to the image size (scale 1.0). Use scale = 0.0 when rendering to display on screen and 1.0 if you are saving the image to a file

    Declaration

    Swift

    public func render(over image: UIImage?, scale: CGFloat = 0.0) -> UIImage?
  • Render the drawing. If you pass a size, shapes are re-scaled to be full resolution at that size, otherwise the view size is used.

    Declaration

    Swift

    public func render(size: CGSize? = nil, scale: CGFloat = 0.0) -> UIImage?

DrawsanaViewShapeUpdating implementation