Painting

@available(iOS 9.0, *)
@objcMembers
@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

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

    Declaration

    Swift

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

    Declaration

    Swift

    open private(set) lazy var context: EAGLContext { get set }
  • The VAO that covers this painting.

    Declaration

    Swift

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

    Declaration

    Swift

    open var brushTexture: Texture?
  • Creates a new painting of the given size.

    Declaration

    Swift

    public required init(size: CGSize)

    Parameters

    size

    The size of the painting.

  • 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 UIImage of the painting of the given size and with the given background color.

    Declaration

    Swift

    @objc(imageWithSize:backgroundColor:)
    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.

  • Generates a CIImage of the painting of the given size and with the given background color.

    Declaration

    Swift

    @objc(ciImageWithSize:backgroundColor:)
    open func ciImage(with size: CGSize, backgroundColor color: UIColor) -> CIImage?

    Parameters

    size

    The size of the requested image.

    color

    The background color of the image.

    Return Value

    An image of the painting.