acerbetti / ACEDrawingView

An open source iOS component to create a drawing app
Apache License 2.0
665 stars 171 forks source link

Partial redraw... #36

Open drdaz opened 9 years ago

drdaz commented 9 years ago

Hi there (and happy holidays!)

I've noticed the TODO in ACEDrawingView, where you write that you need to implement partial redraw in the drawRect method. I'm in a situation where I am using this component to draw on top of full resolution (8MP) photos. The full redraw causes the component to lag and crash when the image is zoomed out fully (I've embedded the view in a UIScrollView). At least, I believe this is the cause of the crash - Apple's documentation suggests this is likely the case, but there is no stack trace or error to debug.

This is not a whine, but rather I'm interested in implementing the partial redraw logic. Unless I'm reading it wrong, you began the implementation since the pen tool requests a partial update, but the drawRect method ignores it.

I'm not that familiar with CoreGraphics, so if you have the time I'd like to hear how you thought to implement this functionality, rather than hacking at it from the ground up myself. From the time I've spent looking at the flow of the pen tool, my instinct tells me to get the draw method to return a UIImage and draw that image in the rect specified in the touches... call. I've made some modifications to that effect, but I'm not getting what I'm looking for.

So... yeah. If you've got a moment I'd love to have a dialogue about this. I'd be happy to contribute any usable code I create back to the project.

acerbetti commented 9 years ago

Hi there, thanks for the interest in the project.

I'm happy to see where this is going, but I got very busy with my job and some side projects and I currently have zero time to maintain this component.

Feel free to work on it and I can review you idea, sorry but I can't do much more than that

drdaz commented 9 years ago

That's a shame... but totally understandable. Gotta pay the bills :)

To be honest I'm not quite sure where to go with it; my gut tells me that the undo / redo mechanics and drawing to a UIImage make the partial redrawing difficult... but again, I'm a noob with CoreGraphics. If I make any progress, I'll get back to you here.