4 ms·
I completely agree with you WRT downvoting... I'd much prefer a discussion like this to a buried comment, regardless of the merit of the original comment. Perha
by dandelany 16y ago
I completely agree with you WRT downvoting... I'd much prefer a discussion like this to a buried comment, regardless of the merit of the original comment. Perhaps it was due to the perceived tone of your comment: "I don't understand why anyone would think it would be impossible" ~= "Who would be dumb enough to assume this isn't possible?" As for why anyone would claim the task is impossible - not enough imagination! :) Although it's more likely that they meant they thought it was impossible to achieve at a decent speed/framerate, which is a pretty reasonable assumption at first glance.
Technically, I think you're right - you could implement a pseudolayering system with only one canvas element. The limiting factor, however, is redrawing speed. You have essentially two options - every time a layer moves, you could redraw the entire canvas, which is conceptually easy but slow. Or you could do some calculation to determine exactly which pixels need to be redrawn - as you say, a matrix operation to determine a delta matrix. This may be faster than redrawing the entire canvas, but it gets much slower as you increase the number of layers. Speed may not seem like a huge issue here, but imagine clicking a layer and dragging it around - this would require constant (un-hardware-accelerated) canvas redrawing at ~10-30fps, which is probably pretty difficult to achieve with any significantly-sized canvas.
The brilliant canvas-on-top-of-canvas implementation avoids this problem altogether. While the layer being dragged still has to be redrawn, the process of doing so is made a lot easier because you don't have to shuffle around the data in the other layers in the process, you just have to worry about one layer at a time.
- jshen 16y ago"I don't understand why anyone would think it would be impossible" ~= "Who would be dumb enough to assume this isn't possible?" If that's how they feel about themselves they shouldn't take it out on me ;) Back on topic, can there be multiple objects on a layer? If so what happens when you drag one on top of another object on the same layer? I haven't used the app, so this may be a dumb question. These are the sorts of things that gave me headaches when I made my audio player UI, and it seems to lead to the same sort of data shuffling that you'd have with multiple matrices.