Reputation: 996
Hello Apple development experts, I'm currently working on creating an iOS app that includes a handwriting drawing feature. Due to certain constraints, I'm unable to directly utilize PencilKit and need to render the handwriting using the MetalKit framework instead.
Before embarking on this task, I carefully examined the effects achieved by Apple's PencilKit (via the Notes app) and made some coding attempts. However, my attempts fall significantly short of the PencilKit's results, leading me to believe there might be flaws in my approach.
In the Notes app, the rendering of a stroke is impressively smooth and clear. For instance, a light tap with the iPencil produces an almost perfect circle with very smooth and clear edges. Similarly, slowly moving the iPencil creates smooth and clear irregular paths on the screen.
After some research, I attempted the following drawing process:
In step 4, I'd like to add a few points:
In summary, my current approach involves interpolating the trajectory of the handwriting into a very dense set of point primitives, which are then rendered on the screen.
Following these steps, I've been able to successfully render a stroke, but the edges of the stroke are still not as smooth and clear as those in PencilKit.
Therefore, I'm looking to clarify two key points:
Given the uncertainty about whether my current approach is fundamentally flawed, I've opted not to post the lengthy source code here to avoid cluttering the discussion. If you think my current approach is on the right track, I can provide the source code for further discussion later.
Thank you for your insights!
Upvotes: 1
Views: 147