Okay, so to respond to various comments!
-
You commented on my waiting .5s before “baking” the path. The choice is arbitrary, but I wanted to have some delay. I remember once coding an auto-save into a drawing program and if it triggered in the middle of a stroke then it would upset the drawing routine as it would cause a delay. Here, it could do something similar as the frame rate would suddenly drop. So I want to ensure that the user has definitely paused before baking the path. The choice of half a second comes from my touch library where touches form part of the same gesture if they occur within .5s of each other - think of a double or triple tap.
-
Without a perfect line rendering system, there are going to be edge cases where the method produces less than perfect results. When the path is rendered with the alpha as it is constructed, it is easy to get undesirable artefacts from turning the corner too quickly or too slowly. Making the opacity of a path global instead of local is a standard method used in PDF and SVG so although it might not be what one would expect if you think of painting, it is what you expect if you come from a vector-based drawing system. However, as you pointed out, it is sometimes desirable to “bake” a path before it is finished so that the opacity is not global. It would seem to me to be very awkward to do that while having your finger still on the screen drawing the path and so lifting the finger, letting it “bake”, and then resuming the path seemed to me a reasonable solution. To make the path continuous, we need to join up the old and new paths - hence the “line” join method. So I disagree with your conclusion that it would be too tricky to use - to do this, you need to trigger something and that means either ending the current touch or starting another simultaneously. However, I concede that I’m hypothesising and I’ll need to test (and get others to test) to see what the best method is.
-
The link between the “move” method and the baking is simply that so long as you wait .5s between the strokes, the first segment will have time to be baked.
-
Yes, I need to sort out the orientation properly! The idea is to have the UI rotate but the drawing not do so. This is something I want in some other projects and I just need to sit down and work out the maths and the API. I suspect that I want something like
transformViewport(desiredOrientation)
which applies a transformation sufficient to transform the current orientation as if the iPad was in the desired orientation. -
I switched the Simple brush to
BrushEx
briefly because I was using it for debugging. I’ll switched it back.
Major change in the next version is the ability to draw with several touches at once. This took a fair bit of refactoring of the drawing routines so probably introduced a fair few new bugs. Haven’t looked at the one you mention above yet.
The ToolBox
class is looking increasingly poorly named! I think I’ll rename it something more sensible.