1
/* -*- c-basic-offset: 8 -*-
2
FreeRDP: A Remote Desktop Protocol client.
3
DirectFB GDI Adapation Layer
5
Copyright (C) Marc-Andre Moreau <marcandre.moreau@gmail.com> 2010
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 2 of the License, or
10
(at your option) any later version.
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27
HDC hDC = (HDC) malloc(sizeof(DC));
31
HDC CreateCompatibleDC(HDC hdc)
33
HDC hDC = (HDC) malloc(sizeof(DC));
38
HBITMAP CreateBitmap(int nWidth, int nHeight, int cBitsPerPixel, unsigned char* data)
40
HBITMAP hBitmap = (HBITMAP) malloc(sizeof(BITMAP));
41
hBitmap->objectType = GDIOBJ_BITMAP;
42
hBitmap->bpp = cBitsPerPixel;
43
hBitmap->width = nWidth;
44
hBitmap->height = nHeight;
45
hBitmap->data = (unsigned char*) data;
49
HBITMAP CreateCompatibleBitmap(HDC hdc, int nWidth, int nHeight)
51
HBITMAP hBitmap = (HBITMAP) malloc(sizeof(BITMAP));
52
hBitmap->objectType = GDIOBJ_BITMAP;
53
hBitmap->width = nWidth;
54
hBitmap->height = nHeight;
58
HPEN CreatePen(int fnPenStyle, int nWidth, int crColor)
60
HPEN hPen = (HPEN) malloc(sizeof(PEN));
61
hPen->objectType = GDIOBJ_PEN;
65
HBRUSH CreateSolidBrush(int crColor)
67
HBRUSH hBrush = (HBRUSH) malloc(sizeof(BRUSH));
68
hBrush->objectType = GDIOBJ_BRUSH;
72
HBRUSH CreatePatternBrush(HBITMAP hbmp)
74
HBRUSH hBrush = (HBRUSH) malloc(sizeof(BRUSH));
75
hBrush->objectType = GDIOBJ_BRUSH;
79
int SetRect(HRECT rc, int xLeft, int yTop, int xRight, int yBottom)
88
int CopyRect(HRECT dst, HRECT src)
90
dst->left = src->left;
92
dst->right = src->right;
93
dst->bottom = src->bottom;
97
int FillRect(HDC hdc, HRECT rect, HBRUSH hbr)
99
return 1; /* 0 = failure */
102
int GetPixel(HDC hdc, int nXPos, int nYPos)
107
int SetPixel(HDC hdc, int X, int Y, int crColor)
112
int GetBkColor(HDC hdc)
117
int SetBkColor(HDC hdc, int crColor)
122
int PatBlt(HDC hdc, int nXLeft, int nXYLeft, int nWidth, int nHeight, int rop)
124
/* Raster Operation is either PATCOPY, PATINVERT, DSTINVERT, BLACKNESS or WHITENESS */
127
int BitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, int hdcSrc, int nXSrc, int nYSrc, int rop)
129
return 1; /* 0 = failure */
132
int SelectObject(HDC hdc, HGDIOBJ hgdiobj)
134
if (hgdiobj->objectType == GDIOBJ_BITMAP)
136
//HBITMAP hBitmap = (HBITMAP) hgdiobj;
137
hdc->selectedObject = hgdiobj;
139
else if (hgdiobj->objectType == GDIOBJ_PEN)
141
//HPEN hPen = (HPEN) hgdiobj;
142
hdc->selectedObject = hgdiobj;
144
else if (hgdiobj->objectType == GDIOBJ_BRUSH)
146
//HBRUSH hBrush = (HBRUSH) hgdiobj;
147
hdc->selectedObject = hgdiobj;
149
else if (hgdiobj->objectType == GDIOBJ_RECT)
151
//HRECT hRect = (HRECT) hgdiobj;
152
hdc->selectedObject = hgdiobj;
156
/* Unknown GDI Object Type */
163
int DeleteObject(HGDIOBJ hgdiobj)
165
if (hgdiobj->objectType == GDIOBJ_BITMAP)
167
HBITMAP hBitmap = (HBITMAP) hgdiobj;
171
else if (hgdiobj->objectType == GDIOBJ_PEN)
173
HPEN hPen = (HPEN) hgdiobj;
176
else if (hgdiobj->objectType == GDIOBJ_BRUSH)
178
HBRUSH hBrush = (HBRUSH) hgdiobj;
181
else if (hgdiobj->objectType == GDIOBJ_RECT)
183
HRECT hRect = (HRECT) hgdiobj;
188
/* Unknown GDI Object Type */
196
int DeleteDC(HDC hdc)