#Ok - code architecture question - I can'
1 messages · Page 1 of 1 (latest)
You could probably do it similar to how actual screen blitting works - if you have a list of shapes in the order you get them, and have some loop that goes through them all and changes all of the pixels to that shape's color, the last one will win by default. You spend a bit of extra time drawing the same pixel multiple times, but ideally that would already be quite fast so it won't make a huge difference
Ok so I guesss I failed to mention an important thing - shapes can be removed at any time in any order
so if we get shapes A, B, C, and D all overlapping on one pixel, in that order, and then C and D get removed, the pixel should end up being the color of B
tbh just doing it and letting them overlap doesnt sound an issue at all, thats not really a thing you need to worry about anymore, even on modern phones
ye
If you maintain a list of all active shapes, and repaint them all in order after any change, that should handle that case too
or I guess, the whole image
overlap doesnt provide too much issues
I guess the overdraw is probably not going to be a problem. I'll start with that and revisit this if it becomes a problem
Along with some sort of clear flag that you set the whole image to before blitting shapes
were in 2025, not 2005 anymore, sure optimizations are still nice, but i dont think optimizing this would be useful and just ends up in wasted time
Alright thanks for this
np but as digi said, dont forget to clear the flags and sort them correctly
I think one minor optimization I can do without too much fuss is just to only draw the new shape when a shape is added
when a shape is removed, I have to redraw the whole canvas
ye