Latest 0.1.6
Homepage https://github.com/rzmn/CropView
License MIT
Platforms ios 8.0, requires ARC
Authors

Quadrangle view and image cropper like a Notes App

Demo

Screenshot

Usage

Initialization

Set initial coordinates in points

cropView.configureWithCorners(corners: [CGPoint(x: 120, y: 100),
                                        CGPoint(x: 270, y: 170),
                                        CGPoint(x: 280, y: 450),
                                        CGPoint(x: 120, y: 400)], on: imageView)

Customisation

Customize color of your corners/contour and corners size

// SECornerView.swift
static var cornerSize : CGFloat = 50.0
// SECropView.swift
static var goodAreaColor = #colorLiteral(red: 0.4666666687, green: 0.7647058964, blue: 0.2666666806, alpha: 1)
static var badAreaColor  = #colorLiteral(red: 0.9254902005, green: 0.2352941185, blue: 0.1019607857, alpha: 1)

Geometry

// SEQuadrangleHelper.swift

// Crop image by quadrangle points in pixels
static public func cropImage(with image: UIImage, quad: [CGPoint]) throws -> UIImage
// get image frame in UIImageView and convert quadrangle coordinates into image pixels
static public func getCoordinatesOnImageWithoutScale(on imageView: UIImageView, with cropView: SECropView) throws -> Array<CGPoint>
// get quadrangle coordinates, related by UIImageView frame in pixels
static public func getCoordinatesOnImageView(on imageView: UIImageView, with cropView: SECropView) throws -> Array<CGPoint>

Latest podspec

{
    "name": "CropView",
    "version": "0.1.6",
    "platforms": {
        "ios": "8.0"
    },
    "summary": "Crop rectangle view like in Notes App",
    "homepage": "https://github.com/rzmn/CropView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "nikitarazumnuy": "[email protected]"
    },
    "source": {
        "git": "https://github.com/rzmn/CropView.git",
        "tag": "0.1.6"
    },
    "source_files": "Pod/Classes/*.swift",
    "swift_version": "4.2",
    "requires_arc": true
}

Pin It on Pinterest

Share This