#Ok - code architecture question - I can'

1 messages · Page 1 of 1 (latest)

glacial ermine
#

thread

ruby orbit
#

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

glacial ermine
#

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

onyx harbor
#

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

glacial ermine
#

Oh I see what digi is saying

#

after any change you simply redraw the whole list

onyx harbor
#

ye

ruby orbit
glacial ermine
#

or I guess, the whole image

onyx harbor
#

overlap doesnt provide too much issues

glacial ermine
#

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

ruby orbit
#

Along with some sort of clear flag that you set the whole image to before blitting shapes

onyx harbor
#

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

glacial ermine
#

Alright thanks for this

onyx harbor
#

np but as digi said, dont forget to clear the flags and sort them correctly

glacial ermine
#

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

onyx harbor
#

ye