FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
drawing.c
1/*
2 * FreeRDP: A Remote Desktop Protocol Implementation
3 * GDI Drawing Functions
4 *
5 * Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
6 * Copyright 2016 Armin Novak <armin.novak@thincast.com>
7 * Copyright 2016 Thincast Technologies GmbH
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
22/* GDI Drawing Functions: http://msdn.microsoft.com/en-us/library/dd162760/ */
23
24#include <freerdp/config.h>
25
26#include <stdio.h>
27#include <string.h>
28#include <stdlib.h>
29
30#include <freerdp/freerdp.h>
31#include <freerdp/gdi/gdi.h>
32
33#include <freerdp/gdi/dc.h>
34#include "drawing.h"
35
45INT32 gdi_GetROP2(HGDI_DC hdc)
46{
47 return hdc->drawMode;
48}
49
60INT32 gdi_SetROP2(HGDI_DC hdc, INT32 fnDrawMode)
61{
62 INT32 prevDrawMode = hdc->drawMode;
63
64 if (fnDrawMode > 0 && fnDrawMode <= 16)
65 hdc->drawMode = fnDrawMode;
66
67 return prevDrawMode;
68}
69
79UINT32 gdi_GetBkColor(HGDI_DC hdc)
80{
81 return hdc->bkColor;
82}
83
94UINT32 gdi_SetBkColor(HGDI_DC hdc, UINT32 crColor)
95{
96 UINT32 previousBkColor = hdc->bkColor;
97 hdc->bkColor = crColor;
98 return previousBkColor;
99}
100
110INT32 gdi_GetBkMode(HGDI_DC hdc)
111{
112 return hdc->bkMode;
113}
114
125INT32 gdi_SetBkMode(HGDI_DC hdc, INT32 iBkMode)
126{
127 if (iBkMode == GDI_OPAQUE || iBkMode == GDI_TRANSPARENT)
128 {
129 INT32 previousBkMode = hdc->bkMode;
130 hdc->bkMode = iBkMode;
131 return previousBkMode;
132 }
133
134 return TRUE;
135}
136
146UINT32 gdi_SetTextColor(HGDI_DC hdc, UINT32 crColor)
147{
148 UINT32 previousTextColor = hdc->textColor;
149 hdc->textColor = crColor;
150 return previousTextColor;
151}