Drawing - Kelmatou/iOSTools GitHub Wiki

Drawing

Statics

  • func drawLine(between p1: CGPoint, and p2: CGPoint, color: UIColor, width: CGFloat = 1)

Definitions

  • func drawLine(between p1: CGPoint, and p2: CGPoint, color: UIColor, width: CGFloat = 1): Draw a line between p1 to p2 with a specified color and width.

Pixel

Methods

  • func colorOfPixel(point: CGPoint) -> UIColor?

Definitions

  • func colorOfPixel(point: CGPoint) -> UIColor?: Get the color of pixel at point location.

ColorWheel

Delegates

protocol ColorWheelDelegate: class {
  
  @objc optional func didSelectColor(_ colorWheel: ColorWheel, color: UIColor)
}

Nested Types

enum ColorWheelOrientation {
    case Horizontal
    case Vertical
  }

Properties

  • weak var delegate: ColorWheelDelegate?
  • var orientation: ColorWheelOrientation
  • var bounds: CGRect

Inits

  • init(_ rect: CGRect, orientation: ColorWheelOrientation)
  • init?(coder aDecoder: NSCoder)

Methods

  • func draw(_ rect: CGRect)

Definitions

  • weak var delegate: ColorWheelDelegate?: ColorWheel delegate, assign it to your class to receive notifications.

  • var orientation: ColorWheelOrientation: Choose color wheel orientation (.Horizontal or .Vertical). Default is .Horizontal.

  • var bounds: CGRect: The rectangle containing the view.

  • init(_ rect: CGRect, orientation: ColorWheelOrientation): Create a colorWheel view from a rectangle and an orientation.

  • init?(coder aDecoder: NSCoder): Create a colorWheel view from storyboard.

  • func draw(_ rect: CGRect): draw colorWheel in rectangle rect.