[android-developers] Re: How to get a region which is not a standard rect area

2009-02-22 Thread David Hu
I've found the key point is the path. Here are two cases: 1) Use Path.transform(Matrix) top = 150; bottom = top + resizedBitmap.getHeight(); left = 0; right = left + resizedBitmap.getWidth(); mPath = new Path(); mPath.addRect(left, top, right, bottom,

[android-developers] Re: How to get a region which is not a standard rect area

2009-02-21 Thread David Hu
Hi, Mike It still doesn't work for me. I've tried two use case: 1) Pass a very large rect as the clip region--the actual result is the outer rect, bigger than my expect region; 2) Pass the outer rect as the clip region---the actual result is smaller than the rotated

[android-developers] Re: How to get a region which is not a standard rect area

2009-02-20 Thread Mike Reed
Ah, that's a bug, null should be allowed. I'll see what can be done there for the future. The clip parameter is mean to be a hint to speedup turning the path into a region by restricting the result to a clipped subset of the path. For your purposes, you can just make a big rectangular region for

[android-developers] Re: How to get a region which is not a standard rect area

2009-02-20 Thread Mike Reed
By bug, I mean I would like to relax the restriction, and allow you to pass null. I don't know yet when the could get in. Thus you should always (for now) pass in a region as the clip. It can be something large with no downside (i.e. -10,000, 10,000) On Fri, Feb 20, 2009 at 3:57 PM, David

[android-developers] Re: How to get a region which is not a standard rect area

2009-02-20 Thread David Hu
Okay, great, I'll pass a large region to check. On Sat, Feb 21, 2009 at 5:01 AM, Mike Reed r...@google.com wrote: By bug, I mean I would like to relax the restriction, and allow you to pass null. I don't know yet when the could get in. Thus you should always (for now) pass in a region as

[android-developers] Re: How to get a region which is not a standard rect area

2009-02-19 Thread Mike Reed
You could possibly un-rotate your touch-point by 30 degrees, and then just use the rectangle. However, you can make complex regions by first constructing a Path, and then calling region.setPath(...), which converts the path into a region. Below is pseudo sample code: Path p = new Path();

[android-developers] Re: How to get a region which is not a standard rect area

2009-02-19 Thread David Hu
Thanks for your reply, Mike. I've tried your method, seems still not work yet. The second parameter of Region.setPath (clip) can't be null. If we use null, there will be an exception happen. So I've tried to use the region I've just constructed or the original rect region, the area is

[android-developers] Re: How to get a region which is not a standard rect area

2009-02-19 Thread David Hu
Another solution is to use int Bitmap.getPixelhttp://code.google.com/android/reference/android/graphics/Bitmap.html#getPixel(int, int)(int x, int y), if it runs normal, then the point(x, y) is in its region, otherwise, if an exception