StampGenerator

@objcMembers
@objc(PESDKStampGenerator)
open class StampGenerator : NSObject

A StampGenerator is responsible for generating a stamp image that is used by a brush to draw a stroke.

Properties

  • The size of the generated stamp.

    Declaration

    Swift

    open var size: CGSize
  • The stamp image.

    Declaration

    Swift

    open var stamp: UIImage { get }
  • A lower resolution version of the stamp image. This is used for the brush preview.

    Declaration

    Swift

    open var smallStamp: UIImage { get }
  • The base dimension of the generated stamp image.

    Declaration

    Swift

    open var baseDimension: CGFloat { get }
  • The bounds of the generated stamp image.

    Declaration

    Swift

    open var baseBounds: CGRect { get }
  • The scale of the stamp image in respect to its base dimension.

    Declaration

    Swift

    open var scale: CGFloat { get }
  • The object that acts as the delegate of the stamp generator.

    Declaration

    Swift

    open weak var delegate: GeneratorDelegate

Subclasses only

  • This method should be override by subclasses. This is where the actual stamp image should be generated using Core Graphics.

    Declaration

    Swift

    @objc(renderStampInContext:)
    open func renderStamp(in context: CGContext)

    Parameters

    context

    The context to render into.

Image Creation

  • A helper method to generate a radial gradient image from white to black.

    Declaration

    Swift

    open func radialFade(withHardness hardness: CGFloat) -> CGImage

    Parameters

    hardness

    The hardness of the gradient.

    Return Value

    A radial gradient image from white to black.