When using Canvas.drawBitmap() with a src and dst Rect, are the edges
considered inclusive?  Presumably the left and top edges are, but I am
unsure about the right and bottom edges.  Consider the following:

Rect src1 = new Rect(0, 0, 0, 0);
Rect dst1 = new Rect(1, 1, 1, 1);
cv.drawBitmap(bm, src1, dst1, null);

Rect src2 = new Rect(0, 0, 1, 1);
Rect dst2 = new Rect(1, 1, 2, 2);
cv.drawBitmap(bm, src2, dst2, null);

Which of the two examples above blits a 1x1 pixel rect from the upper-
left corner of bm to the second row/col pixel of cv?  Presumably, one
of them does.

More to the point, if the right and bottom edges are inclusive, then
the following is an error, correct?:

//Blit lower right subRect to an arbitrary location
Rect src = new Rect(x1, y1, width, height);
Rect dst = new Rect(x2, y2, (width - x1), (height - y1));
cv.drawBitmap(bm, src, dst, null);

If the edges are inclusive those blits read from off the right/bottom
edges of bm and write an extra row/col of pixels on the right/bottom
of the dst rect into cv?  In which case the correct usage would be to
replace width with (width - 1) and likewise for height.

So, which way is correct?  How are the edges of the Rects interpreted?

Thanks.
--~--~---------~--~----~------------~-------~--~----~
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
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to