Android: How can I get the transparent region in an image
How can I get the transparent region in an image in android?
My problem is that I have images with transparent areas and I need to let the user click on regions and handle the click event only when they clicked on the actual colored regions of the image. How can I do this in android?
I saw that Drawable Has a getTrasnsparentRegion method but the default implementation returns null. 开发者_如何学JAVASo I need to overwrite it and put this implementation there.
Thank you,
If you used a bitmap you could then call getPixel(x,y) using the coodinate information provided from the click. I think getPixel returns an argb color value, you could then use this to see if that pixel is transparent.
Maybe there is a web api where you can send it an image and it will clear out white space, maybe picnik.
I know android apps can use each other, maybe find an app that can make white space transparent, though I doubt there is one with magic wand like capabilities. I know you would need to get at the developer of the app.
精彩评论