As well as specifying Points on your Canvas you often need to specify areas. One of the most common constructs is a Rectangle (in fact it is so common that it is often shortened to just Rect).

You can use a Rect to specify an area of the Canvas. For instance:

  • To specify an area into which to draw text.
  • Or an area into which to draw a picture.
  • Or to find out the area of a Canvas that a specific piece of text would take up.

A Rect is described by two Points - the top left corner of the rectangle and the bottom right of the rectangle. Often these are just referred to as the left, top, right and bottom coordinates of the Rect.

If the top left of the rectangle is the same as the bottom right (or if the top left is below or to the right of the bottom right) this is referred to as an Empty Rect.