I have a bitmap out of which I'm cutting out a multipi point polygon. I'm curious what the correct process is for taking the pixels within the arbitrary shape and copying them onto a new bitmap where the rest of the pixels are transparent. The objective is to allow the user to trace the shape and then remove everything outside the polygon.
I have the polygon part worked out (as a an array of points), but now am stumped as to how to transfer just the selected pixels to a new Bitmap.
TIA
Not sure how your code works, but here's an idea on how to do it:
Bitmap
or Canvas
-methods.Path
from your points, all moved into your new bitmap (x-=minX, y-=minY)
;FillType
to one that is inverse (fill the outside).PorterDuff.CLEAR
, which removes all color.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With