/*********************************************************/
/* This source code copyright (c) 1991-2001, Aaron Giles */
/* See the Read Me file for licensing information.       */
/* Contact email: mac@aarongiles.com                     */
/*********************************************************/

#ifndef __QUICKDRAWUTILS__
#define __QUICKDRAWUTILS__

#define Height(rect) ((rect)->bottom - (rect)->top)
#define Width(rect) ((rect)->right - (rect)->left)
#define TopLeft(rect) (*(Point *)&(rect).top)
#define BotRight(rect) (*(Point *)&(rect).bottom)
#define EqualSizeRect(r1, r2) ((Height(r1) == Height(r2)) && (Width(r1) == Width(r2)))
#define MySetRect(rect, l, t, r, b) (rect)->left = l, (rect)->top = t, \
								    (rect)->right = r, (rect)->bottom = b
#define MySetPt(point, hp, vp) (point)->h = hp, (point)->v = vp

extern void PushPort(void);
extern void PopPort(void);
extern void MySetPort(CGrafPtr thePort);
extern GWorldPtr NewTempGWorld(short width, short height, short depth, CTabHandle colors);
extern GWorldPtr MyNewGWorld(Rect *theRect, short theDepth, CTabHandle theColors, 
	GDHandle theDevice, Boolean whiteBack, Boolean inTempMem);
extern void MaxRect(Rect *srcRect, Rect *boundingRect, Rect *dstRect);
extern void MaxSquare(Rect *srcRect, Rect *squareRect);
extern void CopyGWorldToGWorld(GWorldPtr gw1, GWorldPtr gw2, Rect *srcRect, Rect *dstRect,
			short mode, RgnHandle mask);
extern void GlobalRect(Rect *theRect, WindowPtr theWindow);
extern void GlobalRgn(RgnHandle theRgn, WindowPtr theWindow);
extern void LocalRect(Rect *theRect, WindowPtr theWindow);
extern void LocalRgn(RgnHandle theRgn, WindowPtr theWindow);
extern Boolean Clipped(Rect *theRect, RgnHandle clipRgn);

#endif