vintage / scratcher

Scratch card widget which temporarily hides content from user.
https://pub.dev/packages/scratcher
MIT License
572 stars 67 forks source link

Check how much of a specific area has been scratched #24

Closed rubenaster closed 3 years ago

rubenaster commented 3 years ago

Hey Kamil,

so far I can tell that your package is exactly what I've been looking for and it works great! Thank you so much!

Now I'm using this package to create a test for users that need to scratch free a picture above a picture. So far so good. But I need to check afterwards how much of a specific rectangular area on that picture a user has scratched free.

See this image for example: https://www.wiso.uni-hamburg.de/10054699/scraching1-7410709a6d0ee7f6066922f31886f2fc7ed065c1.png

All five displays would be a different Scratcher and I need to determine how much of those grey areas on those displays have been scratched free.

So it's like your current threshold but for several, rectangular areas instead of the full image. But it feels like that would need a completely different way of calculating those progress.

Do you have any ideas or suggestions?

vintage commented 3 years ago

Hey @rubenaster

I didn't get it. The use case is too broad, mind to scope it to the simplest possible scenario?

rubenaster commented 3 years ago

Hey @vintage,

thanks for the response! I already posted the question more detailed on StackOverflow but unfortunately didn't get any feedback: https://stackoverflow.com/questions/66504210/calculate-how-much-of-a-rectangular-area-is-covered-by-a-list-of-circles

I think I'll solve this problem using one of the following options:

Anyways, I'm to dumb for some cool calculations so I'll have to solve it programmatically :)

vintage commented 3 years ago

Well, each separate scratcher knows the percentage of scratched area in own bounds. So if I would have 3 scratchers of the same size: ScratcherA, ScratcherB, ScratcherC where:

Then total scratch area is simply (0.3 + 0.6 + 0.9) / 3 = 60%. Where's the catch?

Check every pixel of a rectangle if it's being covered by any circles/checkpoints - that's the pattern used in the lib itself ;)