/hand-drawing-swift-metal

✏️ Drawing engine with Swift and Metal (GPU)

Primary LanguageSwiftMIT LicenseMIT

Draw on an iOS device using Metal ✏️

TODOs and WIP tasks ✅

Look at the the project board here

How does it works 📟 ?

Line system

A line is composed of a multitude of interconnected triangles, they are generated from "key point" which are the points having as coordinates the places where you have slipped your finger/pen and handled by your device. Several linked triangles can form a trapeze which allows to manage the force communicated with the apple pen in order to vary the width of the line on the same line.

Image from ios_metal_bezier_renderer
From XCode debugger

Interpolation

I use the Catmull Rom interpolation, it generates points between each key points
With interpolation:

Without interpolation (only the key points):

See also