public class RectTools {
public static factoryRect( x, y, width, height ) {
return new Rect(x, y, x + width - 1, y + height -1);
}
}
in code
RT.factoryRect( x, y, width, height );
You can then add a bunch of other methods to your rect tools for
convenience.... e.g. move, resize, create based on a rect and padding
etc.
BTW, please correct me if I'm wrong, but if it's the bottom corner,
not width and height, shouldn't the an 80 by 80 rect at origin be 0,0
and 79,79 as in my code above, not 80, 80. Given it's actual pixels
you're painting.
On Dec 9, 11:58 am, tauntz <[email protected]> wrote:
> public Rect getRect(int x, int y, int width, int height) {
> return new Rect(x, y, x + width, y + height);
>
>
>
> }
> On Wed, Dec 9, 2009 at 11:41 AM, schwiz <[email protected]> wrote:
> > I gotta vent here bare with me! It is really starting to get to me
> > that when making a rect you must give the top left and bottom right
> > coordinate. Why can't it be the top left coordinate and the length
> > and width!!!???? It is easy to make a square in starting in at the
> > origin but becomes a little complicated when trying to move it
> > around.
> > /rant
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Android Discuss" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group
> > athttp://groups.google.com/group/android-discuss?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Android Discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/android-discuss?hl=en.