2 * FreeRDP: A Remote Desktop Protocol Client
3 * GDI Drawing Functions
5 * Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 /* GDI Drawing Functions: http://msdn.microsoft.com/en-us/library/dd162760/ */
26 #include <freerdp/freerdp.h>
27 #include <freerdp/gdi/gdi.h>
29 #include <freerdp/gdi/dc.h>
32 * Set current foreground draw mode.\n
34 * @param hdc device context
38 int gdi_GetROP2(HGDI_DC hdc)
44 * Set current foreground draw mode.\n
46 * @param hdc device context
47 * @param fnDrawMode draw mode
48 * @return previous draw mode
51 int gdi_SetROP2(HGDI_DC hdc, int fnDrawMode)
53 int prevDrawMode = hdc->drawMode;
55 if (fnDrawMode > 0 && fnDrawMode <= 16)
56 hdc->drawMode = fnDrawMode;
62 * Get the current background color.\n
64 * @param hdc device context
65 * @return background color
68 GDI_COLOR gdi_GetBkColor(HGDI_DC hdc)
74 * Set the current background color.\n
76 * @param hdc device color
77 * @param crColor new background color
78 * @return previous background color
81 GDI_COLOR gdi_SetBkColor(HGDI_DC hdc, GDI_COLOR crColor)
83 GDI_COLOR previousBkColor = hdc->bkColor;
84 hdc->bkColor = crColor;
85 return previousBkColor;
89 * Get the current background mode.\n
91 * @param hdc device context
92 * @return background mode
95 int gdi_GetBkMode(HGDI_DC hdc)
101 * Set the current background mode.\n
103 * @param hdc device context
104 * @param iBkMode background mode
108 int gdi_SetBkMode(HGDI_DC hdc, int iBkMode)
110 if (iBkMode == GDI_OPAQUE || iBkMode == GDI_TRANSPARENT)
111 hdc->bkMode = iBkMode;
113 hdc->bkMode = GDI_OPAQUE;
119 * Set the current text color.\n
121 * @param hdc device context
122 * @param crColor new text color
123 * @return previous text color
126 GDI_COLOR gdi_SetTextColor(HGDI_DC hdc, GDI_COLOR crColor)
128 GDI_COLOR previousTextColor = hdc->textColor;
129 hdc->textColor = crColor;
130 return previousTextColor;