DrawsanaView
public class DrawsanaView : UIView
extension DrawsanaView: DrawsanaViewShapeUpdating
Add this view to your view hierarchy to get going with Drawsana!
-
Declaration
Swift
public weak var delegate: DrawsanaViewDelegate?
-
Currently active tool
Declaration
Swift
public private(set) var tool: DrawingTool? { get }
-
You may set this object’s properties and they will be forwarded to the active tool and applied to new shapes.
Declaration
Swift
public let userSettings: UserSettings
-
Values used by tools to manage state.
Declaration
Swift
public let toolSettings: ToolSettings
-
Declaration
Swift
public var drawing: Drawing { get set }
-
Manages the undo stack. You may become this object’s delegate (
DrawingOperationStackDelegate
) to be notified when undo/redo become enabled/disabled.Declaration
Swift
public lazy var operationStack: DrawingOperationStack { get set }
-
Configurable inset for the selection indicator
Declaration
Swift
public var selectionIndicatorInset: CGPoint
-
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. Itspath
andframe
properties are managed byDrawsanaView
.Declaration
Swift
public var selectionIndicatorViewShapeLayer: CAShapeLayer { get }
-
Declaration
Swift
public override init(frame: CGRect)
-
Declaration
Swift
required public init?(coder aDecoder: NSCoder)
-
Declaration
Swift
public override func layoutSubviews()
-
Set the active tool to a new value. If you pass
shape
, it is passed on to the tool’sDrawingTool.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?
-
Rerender all shapes from scratch. Very expensive for drawings with many shapes.
Declaration
Swift
public func rerenderAllShapesInefficiently()