Painting

@objc(PESDKPainting) open class Painting: NSObject

A Painting manages the shaders, textures, vertices and framebuffers involved in a single painting.

  • The canvas view that displays this painting.

    Declaration

    Swift

    open weak var canvas: CanvasView?
  • The size of the painting.

    Declaration

    Swift

    open let dimensions: CGSize
  • The bounds of the painting.

    Declaration

    Swift

    open var bounds: CGRect
  • The context that this painting belongs to.

    Declaration

    Swift

    fileprivate(set) open lazy var context: EAGLContext =
  • The VAO that covers this painting.

    Declaration

    Swift

    open var quadVAO: GLuint
  • The brush texture that will be used to paint strokes.

    Declaration

    Swift

    open var brushTexture: Texture?
  • An undo manager that can be used to undo drawing operations.

    Declaration

    Swift

    open var undoController: UndoController?
  • Returns a newly initialized painting of the given size.

    Declaration

    Swift

    public init(size: CGSize)

    Parameters

    size

    The size of the painting.

    Return Value

    A newly initialized Painting object.

  • Clears the painting of any drawings.

    Declaration

    Swift

    open func clear()
  • Preloads the texture that will be used to render drawings into.

    Declaration

    Swift

    open func preloadPaintTexture()
  • Generates an image of the painting of the given size and with the given background color.

    Declaration

    Swift

    open func image(with size: CGSize, backgroundColor color: UIColor) -> UIImage?

    Parameters

    size

    The size of the requested image.

    color

    The background color of the image.

    Return Value

    An image of the painting.