S susu Well-Known Member Licensed User Longtime User Dec 17, 2012 #1 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 getpixelproblem.zip 18.5 KB · Views: 526
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
klaus Expert Licensed User Longtime User Dec 18, 2012 #2 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 getpixelproblem1.zip 18.5 KB · Views: 622 Upvote 0
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.
S susu Well-Known Member Licensed User Longtime User Dec 18, 2012 #3 Hi Klaus, You saved my day. Thank you so much Upvote 0