Algorithm for filling a stream of a scanned line for iPad

I'm trying to use https://github.com/Chintan-Dave/UIImageScanlineFloodfill , but when the image has a different resolution than 640x640, the flood works poorly, it fills in the wrong area with some shift depending on the resolution big or small from 640x640.

When I delete the touch code of the multiplication touch: "tpoint.x = tpoint.x * 2; tpoint.y = tpoint.y * 2;" from the template in the class "FloodFillImageView". This is the start of the job for the iPad, but again only for the 640x640.

Can someone explain what I missed and why this code does not work for all permissions and has filling problems for different devices. And, of course, I'm glad to see maybe some kind of code to solve my problem or what I should change in this code or some explanation of how to make it work.

+4
source share
1 answer

If you noted the image size and image resolution, the image size is 320X320 and the image itself (star.png) is 640 x 640, so tpoint.x = tpoint.x * 2; and tpoint.y = tpoint.y * 2; multiplied by two. tpoint are the coordinates you touched. and you need to calculate where the point you touched is in the image.

0

All Articles