Coder Social home page Coder Social logo

smooth-line-view's Introduction

Smooth line UIView

The goal of this project is to create a UIView that can generate smooth lines from touch input in a reasonably fast manner without moving to a more complex framework like OpenGL.

Update: Completely re-written smooth line algorithm to use native CGContext quadratic curves. The result is much faster and smoother drawing. There's no more need for switching between agorithms.

Many thanks to Ginamin for his elegant solution.

The Smooth Line View code is licensed under the MIT License: http://opensource.org/licenses/MIT

smooth-line-view's People

Contributors

algal avatar egold avatar iosdeveloper avatar lalo avatar levinunnink avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

smooth-line-view's Issues

Crashing on iOS 12

Hello there,

The Smooth-Line-View is crashing in iOS 12. Works fine with older version.

Please help.

I have attach the crash screenshot from Xcode.

Thanks.
screen shot 2018-09-28 at 5 46 29 pm

Missing Spline files

I can see that you have added a folder "spline" in the framework, however, it doesn't come with the project so it cannot be run.

Make background color clearcolor of director controller

I have document and want to use this code to make annotations on it. So I want to see my controller in background and have director controller on it. So that user feel that line is drawn on the document.

Thanks in advance

Changing colour/width affects previous paths

This is a really great project and performs very well even on Retina iPad displays.

If you change the lineColor or lineWidth property and then attempt to draw another line, any previous paths that fall within the rectangle drawn in drawRect are updated to the new colour/width.

This makes sense since all drawn paths are added to the single mutable path but it's not ideal. I've been wondering about saving existing paths in onTouchesEnded but I'm not sure what is best to save to - UIImage, a sub-view or maybe a CGLayer.

Memory Warning

When I try to run this app in iPad (1st gen), it will receive memory warning if I draw a lot of lines. After a few more lines are drawn, the app will crash.

How to clean up the path?

if a stroke removed by clearColor or kcgblendmodeclear, the stroke will be respawned if another stroke touch the path. How should this be handled?

Lags noticeably on Retina (iPad)

I watched WWDC '12 session #506 and already made sure that

  • UIKit set the appropriate scale factor (2.0 on Retina [iPad])
  • We use UIGraphicsBeginImageContextWithOptions to draw to bitmap contexts
  • We use opaque drawing because it is much faster
  • We "never draw more than we actually need to" (We use setNeedsDisplayInRect: )
  • We do not redraw the entire CGPath, instead it is flatten to a bitmap
  • static content is placed into separate UIView

Code still lags noticeably in performance on Retina (iPad).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.