Something I've done is create a custom view where you implement the
onDraw function. Then in the onDraw function you can make a call like

canvas.clipRect(clippedRect, Region.Op.DIFFERENCE);

which will mask out the Clipped region from what has been drawn
already to the canvas. That being said clippedRect is a rectangle,
which may not achieve your goal of a rounded edge. But I bet there's
something clever you could do using this methodology.

Brady

On Aug 18, 2:00 pm, Eddified <[email protected]> wrote:
> I'm trying to figure out how to draw a bitmap to the canvas in such a
> way that only part of it is actually drawn. The part that would be
> drawn corresponds to pixels of the bitmap that "match up" with pixels
> of some other shape.
>
> Photoshop and Flash both have masks like this.
>
> Specifically, I have rectangular bitmaps that I want to draw as
> circles. I don't want the corners of the bitmaps to be drawn. The user
> of the application would then see images appearing as circular images.
> This would be pretty simple using Flash, but searching "Mask" in the
> Android API only gives code that modifies each pixel (like a GIMP or
> Photoshop "filter" would). Or at least that's what it appears to me.
>
> How can I apply a circular "cookie-cutter" to a rectangular bitmap so
> that the corners don't show up? Specific solutions to this problem and
> general "mask" type solutions are both desired.
>
> Thank you.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to