unitycoder / UnityMobilePaint

Public repository for MobilePaint issues & requests
https://www.assetstore.unity3d.com/en/#!/content/19803?aid=1101lGti
MIT License
49 stars 16 forks source link

Get filled color pixel counts #49

Open unitycoder opened 4 years ago

unitycoder commented 4 years ago

so my question is : If i filled more than one color, then how can i check which color are most fill on object? i'm using "Override Test UI".

easy: manually iterate all pixels in the main array and count used pixel colors, you can do that in another thread. main pixels array is the: private byte[] pixels; in MobilePaint.cs

complex: check how scene_MobilePaint_LockingMaskWithAreaCalculation.scene does fill amount checking, using PaintAreaEventListener.cs, then create or modify fill method to count area pixels also, and could use dictionary to keep track of each color fill counts. (but if user fills on top of another already filled color, that old color count is not updated..)

gohilchirag6565 commented 4 years ago

https://www.youtube.com/watch?v=ROzHxAiLXOU i attach example here, can you please show with example?

unitycoder commented 4 years ago

yes, should use the "easy" method, would be complicated to keep track of pixels otherwise. (and this wouldnt require modifying the plugin source code, can use your own external script to do these)