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,
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
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
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
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
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();
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
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
8 matches
Mail list logo