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

Related tags

Graphics 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...
Hand-gesture recognition on iOS app using CoreML
Hand-gesture recognition on iOS app using CoreML

GestureAI-CoreML-iOS Hand-gesture recognizer using CoreML Demo Screenshots This app is using RNN(Recurrent Neural network) with CoreML on iOS11. The m

📋A hand-curated collection of useful and informative Swift Scripting materials.
📋A hand-curated collection of useful and informative Swift Scripting materials.

Articles • Videos Articles Creating iOS Application Icons with SwiftUI by Eneko Alonso An interesting way to use SwiftUI with CLI for icon generation.

A SwiftUI proof-of-concept, and some sleight-of-hand, which adds rain to a view's background
A SwiftUI proof-of-concept, and some sleight-of-hand, which adds rain to a view's background

Atmos A SwiftUI proof-of-concept, and some sleight-of-hand, which adds rain to a view's background. "Ima use this in my app..." Introducing Metal to S

Examples projects using SwiftUI released by WWDC2019. Include Layout, UI, Animations, Gestures, Draw and Data.
Examples projects using SwiftUI released by WWDC2019. Include Layout, UI, Animations, Gestures, Draw and Data.

SwiftUI Examples About Examples projects using SwiftUI & Combine. Include Layout, UI, Animations, Gestures, Draw and Data. See projects files in Files

SwiftUI:Using Shape & Path to Draw Taiwan Meme Cat

SwiftUI:Using Shape & Path to Draw Taiwan Meme Cat Using SwiftUI's Shape & Path to draw sticker「Taiwan Meme Cat」from Instagram:@taiwanmemecat! SwiftUI

The application is develop in Objective IOS. kids can draw whatever they want and also kids can save the drawing as well as undo erase the drawing.
The application is develop in Objective IOS. kids can draw whatever they want and also kids can save the drawing as well as undo erase the drawing.

IOSObjC_KidsBoard The application is develop in Objective IOS. kids can draw whatever they want and also kids can save the drawing as well as undo era

Draw VR content over live camera feed with ARKit

funny-ar Exercise with ARKit: draw VR content over live camera feed: work is in

🐝 Draw Xcode targets and dependencies tree
🐝 Draw Xcode targets and dependencies tree

🐝 Bee Draw Xcode targets and dependencies tree.

Draw Week Time Table on PDF using PDFKit in iOS Swift
Draw Week Time Table on PDF using PDFKit in iOS Swift

DrawPDFTimeTable Draw Week Time Table on PDF using PDFKit in iOS Swift. Image Info This is the pdf of time table drawn using PDFKit in iOS Swift with

Get your CPU core and cluster power draw in Watts. Supports Apple Silicon and Intel.

macos-cpupower Get your CPU core and cluster power draw in Watts. What It Does and How It Works This project is designed to get the power draw of your

JTChartView is the new lightweight and fully customizable solution to draw a chart
JTChartView is the new lightweight and fully customizable solution to draw a chart

JTChartView JTChartView is the new lightweight and fully customizable solution to draw a curve and fill the space underneath it with a gradient. The r

SwiftLint - A tool to enforce Swift style and conventions, loosely based on Swift Style Guide.
SwiftLint - A tool to enforce Swift style and conventions, loosely based on Swift Style Guide.

SwiftLint - A tool to enforce Swift style and conventions, loosely based on Swift Style Guide.

Style Art library process images using COREML with a set of pre trained machine learning models and convert them to Art style.
Style Art library process images using COREML with a set of pre trained machine learning models and convert them to Art style.

StyleArt Style Art is a library that process images using COREML with a set of pre trained machine learning models and convert them to Art style. Prev

SwiftySound is a simple library that lets you deal with Swift sounds easily

SwiftySound Overview SwiftySound is a simple library that lets you deal with Swift sounds easily. Static methods Sound.play(file: "dog.wav") Sound.pla

HexColor is a simple extension that lets you initialize UIColors the way they were meant to be initialized: With hex integer values

HexColor is a simple extension that lets you initialize UIColors the way they were meant to be initialized: With hex integer values. Requirem

Argo is a library that lets you extract models from JSON or similar structures in a way that's concise, type-safe, and easy to extend
Argo is a library that lets you extract models from JSON or similar structures in a way that's concise, type-safe, and easy to extend

Argo is a library that lets you extract models from JSON or similar structures in a way that's concise, type-safe, and easy to extend. Using Argo

SystemNotification is lets you mimic the native iOS system notification in your SwiftUI apps.
SystemNotification is lets you mimic the native iOS system notification in your SwiftUI apps.

SystemNotification is a SwiftUI library that lets you mimic the native iOS system notification in your iOS apps.

ShortWebCore - This iOS library lets you run automations on Web Views.

This iOS library lets you run automations on Web Views. Example (Optional) Declare class conforming to AutomationRunnerDelegate: import S

Valet lets you securely store data in the iOS, tvOS, or macOS Keychain without knowing a thing about how the Keychain works.

Valet Valet lets you securely store data in the iOS, tvOS, watchOS, or macOS Keychain without knowing a thing about how the Keychain works. It’s easy.

Owner
null
The application is develop in Objective IOS. kids can draw whatever they want and also kids can save the drawing as well as undo erase the drawing.

IOSObjC_KidsBoard The application is develop in Objective IOS. kids can draw whatever they want and also kids can save the drawing as well as undo era

Haresh 0 Oct 28, 2021
When you scan the clothing tag, a 3D character appears and informs you of the clothing information.

1. Introduction When you scan the clothing tag, a 3D character appears and tells you the information on the clothes. You can select necessary informat

kimniki 0 Dec 23, 2021
Rough lets you draw in a sketchy, hand-drawn-like, style.

Rough (Swift) 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, c

null 96 Nov 24, 2022
An open source library that lets your users draw on things - mark up images with text, shapes, etc.

Drawsana 0.12.0 Drawsana is a generalized framework for making freehand drawing views on iOS. You can let users scribble over images, add shapes and t

Asana 569 Dec 23, 2022
WebKit aims to provide platform agnostic isolated browser environments without the need for sketchy C bindings or a bloated V8 runtime.

WebKit WebKit aims to provide platform agnostic isolated browser environments without the need for sketchy C bindings or a bloated V8 runtime. Running

Linden 1 Nov 26, 2021
Completely customizable progress based loaders drawn using custom CGPaths written in Swift

FillableLoaders Completely customizable progress based loaders drawn using custom CGPaths written in Swift Waves Plain Spike Rounded Demo: Changelog:

Pol Quintana 2.1k Dec 31, 2022
Draw a chart with progress bar style

ChartProgressBar-iOS Draw a chart with progress bar style - the android version here Installation iOS version (9.0,*) Swift 3.2 Using cocoapods : pod

Hadi Dbouk 84 Apr 25, 2022
Provides an iOS view controller allowing a user to draw their signature with their finger in a realistic style.

Swift version now available! Mimicking pen-on-paper signatures with a touch screen presents a difficult set of challenges. The rate touch events are e

Uber Open Source 1.3k Jan 6, 2023
🖐 Memory game with hand gesture recognition that will keep your brain in a good shape!

Hands I have always been interested in how I can improve my memory in addition to reading books, and once I came across an interesting technique relat

Tamerlan Satualdypov 35 Dec 19, 2022
VisionCamera Frame Processor Plugin that uses Tensorflow to recognize hand poses

vision-camera-handpose VisionCamera Frame Processor Plugin that uses Tensorflow to recognize hand poses Installation npm install vision-camera-handpos

United Nations International Computing Centre 0 Nov 9, 2021