/*
 * UPIWIN - Micro Pi Windowing Framework Kernel
 * Copyright (C) 2019 Amy Bowersox/Erbosoft Metaverse Design Solutions
 *    
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *    
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *-------------------------------------------------------------------------
 */
#ifndef __GFXTYPE_H_INCLUDED
#define __GFXTYPE_H_INCLUDED

#include "wintype.h"

typedef struct tagPOINT {
	INT32 x;
	INT32 y;
} POINT, *PPOINT;

typedef struct tagRECT {
	INT32 left;
	INT32 top;
	INT32 right;
	INT32 bottom;
} RECT, *PRECT;

typedef const POINT *PCPOINT;
typedef const RECT *PCRECT;

typedef UINT32 COLORREF;
typedef PUINT32 PCOLORREF;

extern BOOL G_set_rect(PRECT rect, int left, int top, int right, int bottom);
extern BOOL G_set_rect_empty(PRECT rect);
extern BOOL G_inflate_rect(PRECT rect, int dx, int dy);
extern BOOL G_offset_rect(PRECT rect, int dx, int dy);
extern BOOL G_is_rect_empty(PCRECT rect);
extern BOOL G_coords_in_rect(PCRECT rect, INT32 x, INT32 y);
extern BOOL G_point_in_rect(PCRECT rect, PCPOINT pt);
extern BOOL G_rect_equal(PCRECT rect1, PCRECT rect2);
extern BOOL G_rect_intersect(PRECT dest, PCRECT src1, PCRECT src2);
extern BOOL G_rect_union(PRECT dest, PCRECT src1, PCRECT src2);

#define RGB(r, g, b)    ((((UINT32)(r)) & 0xFF) | ((((UINT32)(g)) & 0xFF) << 8) | ((((UINT32)(b)) & 0xFF) << 16))
#define GetRValue(cr)   ((UINT32)((cr) & 0xFF))
#define GetGValue(cr)   ((UINT32)(((cr) >> 8) & 0xFF))
#define GetBValue(cr)   ((UINT32)(((cr) >> 16) & 0xFF))

#endif /* __GFXTYPE_H_INCLUDED */
