Rough lets you draw in a sketchy, hand-drawn-like, style.

Related tags

Image Rough
Overview

Rough (Swift)

Version License Platform

Rough lets you draw in a sketchy, hand-drawn-like, style. It is Swift clone of Rough.js. The library defines primitives to draw lines, curves, arcs, polygons, circles, and ellipses.

Requirements

Xcode 9, iOS 10

Installation

Rough is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Rough'

Usage

Rectangle

let canvas = roughView.canvas
canvas.rectangle(origin: CGPoint(x: 10, y: 10), width: 200, height: 100)
roughView.setNeedsDisplay()

Lines and Ellipses

Lines and Ellipses

canvas.circle(center: CGPoint(x: 80, y: 120), radius: 25)
canvas.ellipse(center: CGPoint(x: 300, y: 100), width: 150, height: 80)
canvas.line(from: CGPoint(x: 80, y: 120), to: CGPoint(x: 300, y: 100))

Filling

Filling

canvas.circle(center: CGPoint(x: 50, y: 50), radius: 40) { options in
    options.fill = UIColor.red
} // fill with red hachure

canvas.rectangle(origin: CGPoint(x: 120, y: 15), width: 80, height: 80) { options in
    options.fill = UIColor.red
}

canvas.circle(center: CGPoint(x: 50, y: 150), radius: 40) {
    options in
    options.fill = UIColor(red: 10/255.0, green: 150/255.0, blue: 10/255.0, alpha: 1.0)
    options.fillWeight = 3 // thicker lines for hachure
}

canvas.rectangle(origin: CGPoint(x: 220, y: 15), width: 80, height: 80) { options in
    options.fill = UIColor.red
    options.hachureAngle = 60 // angle of hachure
    options.hachureGap = 8
}

canvas.rectangle(origin: CGPoint(x: 120, y: 105), width: 80, height: 80) { options in
    options.fill = UIColor(red: 1.0, green: 0, blue: 200/255.0, alpha: 0.2)
    options.fillStyle = .solid // solid fill
}

Sketching style

Sketching style

canvas.rectangle(origin: CGPoint(x: 15, y: 15), width: 80, height: 80) { options in
    options.roughness = 0.5
    options.fill = UIColor.red
}

canvas.rectangle(origin: CGPoint(x: 120, y: 15), width: 80, height: 80) { options in
    options.roughness = 2.8
    options.fill = UIColor.blue
}

canvas.rectangle(origin: CGPoint(x: 220, y: 15), width: 80, height: 80) { options in
    options.bowing = 6
    options.stroke = UIColor.green
    options.strokeWidth = 3
}

SVG Path

TODO

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Screenshot1 Screenshot2

Credits

Credits to Rough.js by Preet

License

Rough is available under the MIT license. See the LICENSE file for more info.

You might also like...
Generates an image that looks like LEGO Art.

LegoArtFilter Generates an image that looks like LEGO Art. This library supports both iOS (14≤) and macOS (11≤). Usage // Get CGImage from CIImage let

📸 iMessage-like, Image Picker Controller Provides custom features.

RAImagePicker Description RAImagePicker is a protocol-oriented framework that provides custom features from the built-in Image Picker Edit. Overview O

An image cropper / photo cropper for iOS like in the Contacts app with support for landscape orientation.
An image cropper / photo cropper for iOS like in the Contacts app with support for landscape orientation.

RSKImageCropper An image cropper for iOS like in the Contacts app with support for landscape orientation. Installation RSKImageCropper requires iOS 9.

📷 multiple phassets picker for iOS lib. like a facebook
📷 multiple phassets picker for iOS lib. like a facebook

Written in Swift 5.0 TLPhotoPicker enables application to pick images and videos from multiple smart album in iOS, similar to the current facebook app

Microblog-ref-app - A Twitter like social media app that users can share their moments
Microblog-ref-app - A Twitter like social media app that users can share their moments

HiPlace - iOS Table of Contents Introduction HMS Services Getting Started Suppor

Create ImageView for User or Group like Messenger app
Create ImageView for User or Group like Messenger app

MessengerBubbles Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Installation C

Get  a photo which has effects like the system camera’s Portrait mode (on compatible devices).
Get a photo which has effects like the system camera’s Portrait mode (on compatible devices).

Blurring background like Portrait mode in the iPhone camera If we want to have the blurring effect like the Portrait mode in the iOS Camera app. What

A Shortcuts-like and highly customizable SFSymbol picker written in Swift.
A Shortcuts-like and highly customizable SFSymbol picker written in Swift.

SFTintedIconPicker SFTintedIconPicker is a Shortcuts-like and highly customizable SFSymbol picker written in Swift. Features Native Appearance Search

Simple UIView to interact with an Image view like scroll, zoom, pinch and crop.
Simple UIView to interact with an Image view like scroll, zoom, pinch and crop.

Welcome to Interactive Image View, a simple library that provides an easier way to interact with image view, like scroll, zoom and crop. In its core i

Owner
null
A library that makes defines your style sheet like a breeze.

Atelier A library that makes defines your style sheet like a breeze. Requirements iOS 13.0+ Xcode 12.0+ Swift 5.3+ Installation You can add Atelier to

Hsieh Min Che 1 Dec 29, 2022
ZImageCropper is a simplest way to crop image to any shapes you like.

ZImageCropper ZImageCropper is a simplest way to crop image to any shapes you like. Example To run the example project, clone the repo, and run pod in

Mohammad Zaid Pathan 219 Dec 17, 2022
A apple music cover picture shadow style image library

ShadowImageView A apple music cover picture shadow style image library ShadowImageView is a iOS 10 Apple Music style image view, help you create elege

Old Donkey 794 Dec 17, 2022
MSLView - Shadertoy-style SwiftUI view

MSLView SwiftUI view for Shadertoy-style MSL shaders import MSLView struct Cons

Audulus LLC 33 Jan 2, 2023
NavigationCoordinator acts as a coordinator for NavigationView in SwiftUI. You can use pushView, popView, popToView, popToRootView as you can in traditional UIKit

NavigationCoordinator NavigationCoordinator acts as a coordinator for NavigationView. You can use pushView, popView, popToView, popToRootView in Swift

Shahriar Nasim Nafi 3 Aug 3, 2022
A custom ImageView that is used to cover the surface of other view like a scratch card, user can swipe the mulch to see the view below.

MCScratchImageView GIF Showcase Requirments iOS 8.0+ Xcode 7.2+ Swift 4.0 Installation CocoaPods pod "MCScratchImageView" Manually Just drag MCScratch

Jaylen Bian 359 Dec 17, 2022
Image filtering UI library like Instagram.

Sharaku Usage How to present SHViewController let imageToBeFiltered = UIImage(named: "targetImage") let vc = SHViewController(image: imageToBeFiltered

Makoto Mori 1.5k Dec 20, 2022
📸 Instagram-like image picker & filters for iOS

YPImagePicker YPImagePicker is an instagram-like photo/video picker for iOS written in pure Swift. It is feature-rich and highly customizable to match

Yummypets 4k Dec 27, 2022
SwiftGen is a tool to automatically generate Swift code for resources of your projects (like images, localised strings, etc), to make them type-safe to use.

SwiftGen is a tool to automatically generate Swift code for resources of your projects (like images, localised strings, etc), to make them type-safe to use.

null 8.3k Jan 5, 2023