TArea can be seen as a signed origin and and unsigned extent in the Y and Y, or it can be seen as a singed origin and signed upper left corner. Internally of course its one or the other, but you don't have to care. This allows the class to be more self documenting and convenient when the semantics of your problem naturally falls into one of these schemes.
Here are some simple examples of the TArea class.
//
// Assume we have some widget object to draw. We also have a paint
// brush object to draw on and its current invalid area.
//
TSomeWidget* pwdgtToDraw;
TPaintbrush ptbToDrawOn;
TArea areaInvalid;
// If our widget area intersects the invalid area, then we draw
if (areaInvalid.bIntersects(pwdgtToDraw->areaOf())
pwdgtToDraw->Draw(ptbToDrawOn);
//
// In this example, we show how to use it to draw a bitmap in the
// upper right of a window. Assume we have a window and a bitmap
// object to draw. Create a paintbrush to draw with, get the window
// area and create a new, upper right justified area and draw the
// bitmap into it.
//
// areaWndSize() returns a 0 based TArea that holds the window's
// size. We want 0 based here becasue drawing is relative to the
// window. If we wanted the window's actual area, we would have
// used areaWnd().
//
TWindow* pSomeWindow;
TBitmap bmpToDraw;
TArea areaDraw(bmpToDraw.areaBitMap());
areaDraw.JustifyIn
(
pSomeWindow->areaWndSize()
, tCIDLib::eHJustify_Right
, tCIDLib::eVJustify_Top
);
TPaintbrush ptbToDrawOn(pSomeWindow);
bmpToDraw.DrawOn(ptbToDrawOn, areaDraw);
TArea();
TArea
(
const RECTL& rectlSrc
, const tCIDLib::eRectlTypes eInclusive
);
TArea
(
const SWP& swpSrc
);
TArea
(
const POINTL& ptlLLeft
, const POINTL& ptlURight
);
TArea
(
const TPoint& pntLLeft
, const TPoint& pntURight
);
TArea
(
const tCIDLib::TInt4 x
, const tCIDLib::TInt4 y
, const tCIDLib::TCard4 cx
, const tCIDLib::TCard4 cy
);
TArea
(
const TPoint& pntOrg
, const tCIDLib::TCard4 cx
, const tCIDLib::TCard4 cy
);
TArea
(
const TArea& areaSrc
);