Example code below is my attempt to clip an ImageView  with a non-
rectangular shape.  It doesnt work, I see the full rectangle.
Obviously I am misunderstanding some basic thing about the way android
graphics works.

any help appreciated.

also another question - why dont I have to call super.onDraw in my
override function?

public class ClipView extends ImageView{

        public ClipView(Context context) {
                super(context);
        }

        //@Override
         protected void onDraw(Canvas canvas)
        {
                Path path = new Path();
                path.rLineTo(300,0);  // across 300
                path.rLineTo(0,200); // down 300
                path.rLineTo(-300,150);         // left and down diagonally
                path.close();                           // go back to start pos

                canvas.clipPath(path, Op.REPLACE);
        }
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to