All Projects → shaps80 → Inkkit

shaps80 / Inkkit

Licence: mit
Drawing and Geometry made easy on iOS - now in Swift 3.0

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Inkkit

Pixelorama
A free & open-source 2D sprite editor, made with the Godot Engine! Available on Windows, Linux, macOS and the Web!
Stars: ✭ 2,535 (+590.74%)
Mutual labels:  graphics, draw
Pixieditor
PixiEditor is a lightweight pixel art editor made with .NET 5
Stars: ✭ 210 (-42.78%)
Mutual labels:  graphics, draw
Aachartkit Swift
📈📊📱💻🖥️An elegant modern declarative data visualization chart framework for iOS, iPadOS and macOS. Extremely powerful, supports line, spline, area, areaspline, column, bar, pie, scatter, angular gauges, arearange, areasplinerange, columnrange, bubble, box plot, error bars, funnel, waterfall and polar chart types. 极其精美而又强大的跨平台数据可视化图表框架,支持柱状图、条形图、…
Stars: ✭ 1,962 (+434.6%)
Mutual labels:  graphics, draw
Root
The official repository for ROOT: analyzing, storing and visualizing big data, scientifically
Stars: ✭ 1,377 (+275.2%)
Mutual labels:  graphics, geometry
gridder
A Grid based 2D Graphics library
Stars: ✭ 51 (-86.1%)
Mutual labels:  grid, draw
Aardvark.base
Aardvark is an open-source platform for visual computing, real-time graphics and visualization. This repository is the basis for most platform libraries and provides basic functionality such as data-structures, math and much more.
Stars: ✭ 117 (-68.12%)
Mutual labels:  graphics, geometry
Trimesh2
C++ library and set of utilities for input, output, and basic manipulation of 3D triangle meshes
Stars: ✭ 206 (-43.87%)
Mutual labels:  graphics, geometry
Core
A canvas-based super high performant grid renderer API
Stars: ✭ 857 (+133.51%)
Mutual labels:  graphics, grid
Rough
Create graphics with a hand-drawn, sketchy, appearance
Stars: ✭ 16,472 (+4388.28%)
Mutual labels:  graphics, draw
Sketch
Sketch have a lot of basic functions to develop a drawing app for iPhone. Anyone can easily create drawing iOS Application.
Stars: ✭ 229 (-37.6%)
Mutual labels:  graphics, draw
Plexus
Polygonal mesh processing.
Stars: ✭ 90 (-75.48%)
Mutual labels:  graphics, geometry
Cga.js
CGA 3D 计算几何算法库 | 3D Compute Geometry Algorithm Library webgl three.js babylon.js等任何库都可以使用
Stars: ✭ 313 (-14.71%)
Mutual labels:  graphics, geometry
Pymesh
Geometry Processing Library for Python
Stars: ✭ 1,135 (+209.26%)
Mutual labels:  graphics, geometry
Svg.skia
An SVG rendering library.
Stars: ✭ 122 (-66.76%)
Mutual labels:  graphics, geometry
Sophus
C++ implementation of Lie Groups using Eigen.
Stars: ✭ 1,048 (+185.56%)
Mutual labels:  graphics, geometry
Aseprite
Animated sprite editor & pixel art tool (Windows, macOS, Linux)
Stars: ✭ 14,832 (+3941.42%)
Mutual labels:  graphics, draw
Touchdesigner shared
TouchDesigner toxes and small projects
Stars: ✭ 385 (+4.9%)
Mutual labels:  graphics, geometry
Aachartkit
📈📊🚀🚀🚀An elegant modern declarative data visualization chart framework for iOS, iPadOS and macOS. Extremely powerful, supports line, spline, area, areaspline, column, bar, pie, scatter, angular gauges, arearange, areasplinerange, columnrange, bubble, box plot, error bars, funnel, waterfall and polar chart types. 极其精美而又强大的跨平台数据可视化图表框架,支持柱状图、条形图、折…
Stars: ✭ 4,358 (+1087.47%)
Mutual labels:  graphics, draw
Consolegameengine
.NET Console Graphics Engine
Stars: ✭ 226 (-38.42%)
Mutual labels:  graphics, draw
Three Mesh Bvh
A BVH implementation to speed up raycasting against three.js meshes.
Stars: ✭ 302 (-17.71%)
Mutual labels:  graphics, geometry

InkKit

Version License Language Platform

Swift Support

Swift 4.0

InkKit is Swift 4.0 by default, so to use that just include InkKit in your podfile:

pod 'InkKit'

Swift 3.2

In order to use InkKit in a Swift 3.2/3.0 project, ensure you point to the 2.1.0 tag.

pod 'InkKit', '2.1.0'

Swift 2.3

In order to use InkKit in a Swift 2.3 project, ensure you point to the swift2.3 branch.

pod 'InkKit', :git => 'https://github.com/shaps80/InkKit/', :branch => 'swift2.3'

Swift 2.2

If you still require Swift 2.2, point your version as such: pod 'InkKit', '1.3.1'

Example Code

Everything you see here, was code-drawn with InkKit! In fact, other than some CGRect instances, this is ALL the code required to draw the image you see on the right ;)

Drawing made simple! InkKit In Action
Lets draw the screen on the right.
Draw.fillRect(bgFrame, color: UIColor(hex: "1c3d64"))
let grid = Grid(colCount: 6, rowCount: 9, bounds: gridFrame)
let path = grid.path(includeComponents: [.Columns, .Rows])

Draw.strokePath(path, startColor: UIColor(white: 1, alpha: 0.15), endColor: UIColor(white: 1, alpha: 0.05), angleInDegrees: 90)

let rect = grid.boundsForRange(sourceColumn: 1, sourceRow: 1, destinationColumn: 4, destinationRow: 6)

drawCell(rect, title: "4x6", includeBorder: true, includeShadow: true)

Draw.addShadow(.Outer, path: UIBezierPath(rect: barFrame), color: UIColor(white: 0, alpha: 0.4), radius: 5, offset: CGSize(width: 0, height: 1))

Draw.fillRect(barFrame, color: UIColor(hex: "ff0083"))

let (_, navFrame) = barFrame.divide(20, fromEdge: .MinYEdge) "InkKit".drawAlignedTo(navFrame, attributes: [ NSForegroundColorAttributeName: Color.whiteColor(), NSFontAttributeName: UIFont(name: "Avenir-Book", size: 20)! ])

backIndicatorImage().drawAtPoint(CGPoint(x: 22, y: 30))

Change Log

v2.0.0

Note: Since this is a Swift 3 release, I decided to also clean up the API and remove all deprecation warnings. InkKit 2.0 should be considered a new API.

  • Swift 3.0 Support
  • Updated API to support Swift 3.0 guidelines
  • Shear Transforms
  • Perspective Transforms
  • Radians from Degrees function (and inverse)
  • Corner Radius with Concave, Convex and Line support
  • New Color value-type

v1.3.1

  • OSX Support
  • OSX Demo Project now included
  • Table renamed to Grid
  • Table renamed to GridComponents
  • Added convenience methods for working with paths

v1.2.0

  • Shadows
  • Borders
  • Tables

v1.1.0

  • Images
  • Strings

v1.0

  • Fills
  • Strokes
  • Geometry

API

InkKit provides many useful convenience methods for drawing and geometry calculations. Its also cross platform working across iOS & MacOS

Core

If the convenience methods below don't solve your needs, you can start by using the new methods added directly to CGContext itself:

func draw(inRect:attributes:drawing:)

Which would look like this in usage:

CGContext.current?.draw(inRect: rect, drawing: { (context, rect, attributes) in
  Color.redColor.setFill()
  UIRectFill(rect)
})

This basically wraps getting the context, setting up its frame and save/restore calls. If you provide the additional DrawingAttributes block, it will also pre-configure your context with those options for you.

Grid

init(colCount:rowCount:bounds:)
func positionForCell(atIndex:) -> (col: Int, row: Int)
func boundsForCell(atIndex:) -> CGRect
func boundsForRange(sourceColumn:sourceRow:destinationColumn:destinationRow:) -> CGRect
func boundsForCell(col:row:) -> CGRect
func enumerateCells(enumerator:(index:col:row:bounds:) -> Void)

A Grid is a really great way for laying out your drawing without having to think about placement, rect translations, etc...

I use them often for layout only, but sometimes its useful to be able to render them as well (like in the included demo).

// components is a bitmask [ .Outline, .Rows, .Columns ]
func stroke(components:attributes:)

Borders & Shadows

Supports .Outer, .Inner and .Center borders, as well as .Outer and .Inner shadows.

static func addBorder(type:path:attributes:)
static func addShadow(type:path:color:radius:offset:)

Strokes

static func strokeLine(startPoint:endPoint:startColor:endColor:angleInDegrees:attributes:)
static func strokeLine(startPoint:endPoint:color:attributes:)
static func strokePath(path:startColor:endColor:angleInDegrees:attributes:)

Fills

static func fillPath(path:startColor:endColor:angleInDegrees:attributes:)

Geometry

Many of the drawing methods use the geometry additions below, but they can also be useful for your own projects:

func divide(atDelta:fromEdge:margin:) -> (slice, remainder)
func insetBy(edgeInsets:) -> CGRect
mutating func insetInPlace(edgeInsets:)
func alignedTo(rect:horizontal:vertical:) -> CGRect
func scaledTo(rect:scaleMode:) -> CGRect

func gradientPoints(forAngleInDegrees:) -> (start, end)
func scaledTo(size:scaleMode:) -> CGSize

func reversibleRect(fromPoint:toPoint:) -> CGRect

Images

There are also additional draw methods for images:

func drawAlignedTo(rect:horizontal:vertical:blendMode:alpha:)
func drawScaledTo(rect:scaleMode:blendMode:alpha:)

static func circle(radius:attributes:) -> Image
static func draw(width:height:scale:attributes:drawing:) -> Image
static func draw(size:scale:attributes:drawing:) -> Image

Strings

Finally, we even have some easy draw methods for strings:

func drawAlignedTo(rect:horizontal:vertical:attributes:constrainedSize:)
func sizeWithAttributes(attributes:constrainedSize:) -> CGSize
func drawAtPoint(point:attributes:)
func drawInRect(rect:withAttributes)

Demo

To try it out yourself, download the source and run the included demo project.

Platforms and Versions

InkKit is supported on the following platforms:

  • iOS 8.0 and greater
  • OSX 10.11 and greater

Installation

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

pod 'InkKit'

Alternatively you can simply drag the files into your iOS or OSX project.

Author

@shaps

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].