GetPixel problem

susu

Well-Known Member
Licensed User
Longtime User
Hi all,

I'm trying to make a circle button by reading pixel colors. It seems to work but only get error with the right edge of circle button (red & blue color). I assume the reason is ImageView's position is not correct but I can't figure out :BangHead:

Please find attached project to see the problem and help me.

Thank you so much ;)
 

Attachments

  • getpixelproblem.zip
    18.5 KB · Views: 273

klaus

Expert
Licensed User
Longtime User
Attached you find a working program.
The problem was the bitmap size.
I tested it on my Nexus One 480 x 800 x 1.5
The imageview dimension is 300dip = 450 pixels.
The bitmap dimension is 380 pixels.
The bitmap property of the imageview points onto the original bitmap and the original bitmaps dimension which are not the same.
I added a canvas for the imageview and draw the bitmap onto it so the imageview bitmap has the same dimensions as the imageview (450) not the original ones (380).

Best regards.
 

Attachments

  • getpixelproblem1.zip
    18.5 KB · Views: 354
Upvote 0

susu

Well-Known Member
Licensed User
Longtime User
Hi Klaus,

You saved my day. Thank you so much :D
 
Upvote 0
Top