The Rect class is primarily used to represent a rectangular area in a coordinate system and can do some simple things about it. This rectangular area needs to be represented (Left,top,right,bottom) by the lower-left, upper-right two coordinate points, and you can also get the width and height of a rect instance. Here, the wonderful things come, as a little experience to do the image or matrix operation or programming programmer, the consensus is that if a matrix is MXN, that is, M row N column, then the line number is [0,m-1], the column number is [0,n-1]. But the wonderful Rect class is not like this! If you declare a rect class like this:
Rect rect=newRect(100,50,300,500); |
So the lower right corner (300,500) is not actually inside the rectangle, but the upper left corner (100,50) is in, that is, the area that the rectangle actually represents is: (100,50,299,499). In addition, Rect calculates the height and width of the pair . Therefore, in this warning to the programmer, when it involves a rect operation, try not to use its lower-right corner of the left, that is, the bottom. Because they are wrong. Of course, when you call Android's own function, it can be used, because Android has kept so wonderful thinking.
The Rect class in Android--The thought of wonderful flowers