I'm having quite a problem here and I hope for someone here to able to help me. let's go.
Let's say, I have quite a big image ( 1500x2000 ), i load it as a drawable, fine so far. Now I have a SurfaceView and I want to draw a cert开发者_高级运维ain region ( lets say the top-left-most region ) onto a canvas, in a non-scaled version. I thought using ClipDrawable would be just the right thing to use, but actually, I can't get it to do what I want to. It just displays a scaled-down image with the clip applied.
So basically my question is: how to draw a non-scaled drawable onto a surface, and how to clip that drawable?
any help appreciated, thank you :-)
To clip a drawable simply set the appropriate clip region on the Canvas prior to drawing the drawable. Don't forget to save()/restore() the Canvas!
You can use these in XML Drawable.
Check this doc for more usage for clip
and scale
label:
http://idunnolol.com/android/drawables.html
精彩评论