2019-12-12 09:24:58 -07:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2019-12-09 17:02:04 -07:00
|
|
|
#ifndef __DEVCTXT_H_INCLUDED
|
|
|
|
#define __DEVCTXT_H_INCLUDED
|
|
|
|
|
|
|
|
#include "wintype.h"
|
|
|
|
#include "gfxtype.h"
|
|
|
|
#include "gfxobj.h"
|
2019-12-11 10:50:39 -07:00
|
|
|
#include "bitmap.h"
|
2019-12-09 17:02:04 -07:00
|
|
|
|
|
|
|
#define DCTXT_SIG_WORD 0x78744344 /* "DCtx */
|
|
|
|
|
|
|
|
/* Raster operation codes */
|
|
|
|
#define R2_BLACK 1
|
|
|
|
#define R2_NOTMERGEPEN 2
|
|
|
|
#define R2_MASKNOTPEN 3
|
|
|
|
#define R2_NOTCOPYPEN 4
|
|
|
|
#define R2_MASKPENNOT 5
|
|
|
|
#define R2_NOT 6
|
|
|
|
#define R2_XORPEN 7
|
|
|
|
#define R2_NOTMASKPEN 8
|
|
|
|
#define R2_MASKPEN 9
|
|
|
|
#define R2_NOTXORPEN 10
|
|
|
|
#define R2_NOP 11
|
|
|
|
#define R2_MERGENOTPEN 12
|
|
|
|
#define R2_COPYPEN 13
|
|
|
|
#define R2_MERGEPENNOT 14
|
|
|
|
#define R2_MERGEPEN 15
|
|
|
|
#define R2_WHITE 16
|
|
|
|
|
2019-12-11 10:54:09 -07:00
|
|
|
struct tagDCTXT; /* forward declaration */
|
|
|
|
|
2019-12-09 17:02:04 -07:00
|
|
|
typedef COLORREF (*DCtx_SetPixel)(PVOID privdata, INT32 x, INT32 y, COLORREF color, INT32 op);
|
2019-12-10 12:42:58 -07:00
|
|
|
typedef BOOL (*DCtx_Line)(PVOID privdata, INT32 x1, INT32 y1, INT32 x2, INT32 y2, COLORREF color, INT32 op);
|
2019-12-10 17:09:16 -07:00
|
|
|
typedef BOOL (*DCtx_SolidRect)(PVOID privdata, PRECT rect, COLORREF color, INT32 op);
|
2019-12-11 10:54:09 -07:00
|
|
|
typedef struct tagDCTXT *(*DCtx_CreateCompat)(PVOID privdata);
|
2019-12-10 17:09:16 -07:00
|
|
|
typedef BOOL (*DCtx_NewBitmap)(PVOID privdata, PBITMAP pbmp);
|
|
|
|
typedef BOOL (*DCtx_BitBlt)(PVOID p_dest, PRECT r_dest, PVOID p_src, PRECT r_src, UINT32 op);
|
2019-12-09 17:02:04 -07:00
|
|
|
|
|
|
|
typedef struct tagDCFUNTABLE {
|
2019-12-10 17:09:16 -07:00
|
|
|
DCtx_SetPixel set_pixel; /* sets a single pixel on the display */
|
|
|
|
DCtx_Line line; /* draws a line on the display */
|
|
|
|
DCtx_SolidRect solid_rect; /* draws a solid rectangle on the display */
|
|
|
|
DCtx_CreateCompat create_compat; /* create a memory DC compatible with this one */
|
|
|
|
DCtx_NewBitmap new_bitmap; /* new bitmap selected notification */
|
|
|
|
DCtx_BitBlt bitblt; /* bit block transfer */
|
2019-12-09 17:02:04 -07:00
|
|
|
} DCFUNTABLE;
|
|
|
|
|
|
|
|
typedef const DCFUNTABLE *PDCFUNTABLE;
|
|
|
|
|
|
|
|
typedef struct tagDCTXT {
|
|
|
|
GFXOBJECT hdr; /* the header of all objects */
|
|
|
|
PDCFUNTABLE funcs; /* device context functions */
|
|
|
|
PVOID privdata; /* private data for the type of DC */
|
2019-12-10 17:09:16 -07:00
|
|
|
UINT32 flags; /* flags for the DC */
|
|
|
|
RECT baserect; /* base rectangle */
|
2019-12-09 17:02:04 -07:00
|
|
|
RECT cliprect; /* clipping rectangle */
|
|
|
|
POINT pos; /* current position */
|
|
|
|
UINT32 rop2; /* current raster operation */
|
|
|
|
COLORREF color; /* current drawing color (XXX replace with pens later) */
|
2019-12-10 17:09:16 -07:00
|
|
|
PBITMAP cur_bitmap; /* current selected bitmap */
|
2019-12-09 17:02:04 -07:00
|
|
|
} DCTXT, *PDCTXT;
|
|
|
|
|
2019-12-10 17:09:16 -07:00
|
|
|
#define DCFLG_TYPES 0x03
|
|
|
|
#define DCFLG_IS_SCREEN 0x00
|
|
|
|
#define DCFLG_IS_MEMORY 0x01
|
|
|
|
|
2019-12-10 12:42:58 -07:00
|
|
|
extern PDCTXT _DC_Allocate(PDCFUNTABLE funcs, PVOID privdata);
|
|
|
|
extern void _DC_FinalizeCommon(PDCTXT pdctxt);
|
|
|
|
|
2019-12-09 17:02:04 -07:00
|
|
|
extern COLORREF DC_SetPixel(PDCTXT pdctxt, INT32 x, INT32 y, COLORREF color);
|
2019-12-10 12:42:58 -07:00
|
|
|
extern BOOL DC_LineTo(PDCTXT pdctxt, INT32 x, INT32 y);
|
|
|
|
extern BOOL DC_MoveTo(PDCTXT pdctxt, INT32 x, INT32 y, PPOINT oldpt);
|
|
|
|
extern BOOL DC_Rectangle(PDCTXT pdctxt, INT32 left, INT32 top, INT32 right, INT32 bottom);
|
2019-12-10 17:09:16 -07:00
|
|
|
extern BOOL DC_SolidRectangle(PDCTXT pdctxt, INT32 left, INT32 top, INT32 right, INT32 bottom);
|
2019-12-10 12:42:58 -07:00
|
|
|
extern UINT32 DC_GetROP2(PDCTXT pdctxt);
|
|
|
|
extern UINT32 DC_SetROP2(PDCTXT pdctxt, UINT32 rop);
|
|
|
|
extern COLORREF DC_GetTextColor(PDCTXT pdctxt);
|
|
|
|
extern COLORREF DC_SetTextColor(PDCTXT pdctxt, COLORREF cr);
|
|
|
|
extern BOOL DC_GetClipRect(PDCTXT pdctxt, PRECT prect);
|
|
|
|
extern BOOL DC_SetClipRect(PDCTXT pdctxt, PRECT prect);
|
2019-12-10 17:09:16 -07:00
|
|
|
extern PDCTXT DC_CreateCompatible(PDCTXT pdctxt);
|
|
|
|
extern PGFXOBJECT DC_SelectObject(PDCTXT pdctxt, PGFXOBJECT pobj);
|
|
|
|
extern BOOL DC_BitBlt(PDCTXT dest, INT32 x, INT32 y, INT32 width, INT32 height, PDCTXT source, INT32 x1, INT32 y1, UINT32 rop);
|
2019-12-10 12:42:58 -07:00
|
|
|
|
|
|
|
#define DC_addref(pdctxt) Go_addref(&(pdctxt->hdr))
|
|
|
|
#define DC_release(pdctxt) Go_release(&(pdctxt->hdr))
|
2019-12-09 17:02:04 -07:00
|
|
|
|
|
|
|
#endif /* __DEVCTXT_H_INCLUDED */
|