I have got a Canvas
. Its associated Bitmap
is some image (see 1st image).
On top of that (see 4th image), I want to draw a part (see 3rd image) of a Bitmap
(see 2nd image).
Now, I could create a cropped version of the bitmap. But that would require me to copy the entire Bitmap
(which I would need to do many times each frame).
From what I have seen, PorterDuff
doesn't really help either as using a pattern-Bitmap
to cut the unwanted pixels after drawing would remove the original image below.
Is there any efficient way of "telling android what pixels of the bitmap to draw"? I am thinking of something like an implementation of an interface
that takes an x- and y- coordinate and returns a boolean of whether to paint the according pixel.