2 * DC device-independent Get/SetXXX functions
4 * Copyright 1993 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 #include "gdi_private.h"
34 /***********************************************************************
37 INT WINAPI SetBkMode( HDC hdc, INT mode )
41 if ((mode <= 0) || (mode > BKMODE_LAST))
43 SetLastError(ERROR_INVALID_PARAMETER);
46 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
47 if (dc->funcs->pSetBkMode)
48 ret = dc->funcs->pSetBkMode( dc->physDev, mode );
51 ret = dc->backgroundMode;
52 dc->backgroundMode = mode;
54 GDI_ReleaseObj( hdc );
59 /***********************************************************************
62 INT WINAPI SetROP2( HDC hdc, INT mode )
66 if ((mode < R2_BLACK) || (mode > R2_WHITE))
68 SetLastError(ERROR_INVALID_PARAMETER);
71 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
72 if (dc->funcs->pSetROP2)
73 ret = dc->funcs->pSetROP2( dc->physDev, mode );
79 GDI_ReleaseObj( hdc );
84 /***********************************************************************
87 INT WINAPI SetRelAbs( HDC hdc, INT mode )
91 if ((mode != ABSOLUTE) && (mode != RELATIVE))
93 SetLastError(ERROR_INVALID_PARAMETER);
96 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
97 if (dc->funcs->pSetRelAbs)
98 ret = dc->funcs->pSetRelAbs( dc->physDev, mode );
101 ret = dc->relAbsMode;
102 dc->relAbsMode = mode;
104 GDI_ReleaseObj( hdc );
109 /***********************************************************************
110 * SetPolyFillMode (GDI32.@)
112 INT WINAPI SetPolyFillMode( HDC hdc, INT mode )
116 if ((mode <= 0) || (mode > POLYFILL_LAST))
118 SetLastError(ERROR_INVALID_PARAMETER);
121 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
122 if (dc->funcs->pSetPolyFillMode)
123 ret = dc->funcs->pSetPolyFillMode( dc->physDev, mode );
126 ret = dc->polyFillMode;
127 dc->polyFillMode = mode;
129 GDI_ReleaseObj( hdc );
134 /***********************************************************************
135 * SetStretchBltMode (GDI32.@)
137 INT WINAPI SetStretchBltMode( HDC hdc, INT mode )
141 if ((mode <= 0) || (mode > MAXSTRETCHBLTMODE))
143 SetLastError(ERROR_INVALID_PARAMETER);
146 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
147 if (dc->funcs->pSetStretchBltMode)
148 ret = dc->funcs->pSetStretchBltMode( dc->physDev, mode );
151 ret = dc->stretchBltMode;
152 dc->stretchBltMode = mode;
154 GDI_ReleaseObj( hdc );
159 /***********************************************************************
160 * GetBkColor (GDI32.@)
162 COLORREF WINAPI GetBkColor( HDC hdc )
165 DC * dc = DC_GetDCPtr( hdc );
168 ret = dc->backgroundColor;
169 GDI_ReleaseObj( hdc );
175 /***********************************************************************
176 * GetBkMode (GDI32.@)
178 INT WINAPI GetBkMode( HDC hdc )
181 DC * dc = DC_GetDCPtr( hdc );
184 ret = dc->backgroundMode;
185 GDI_ReleaseObj( hdc );
191 /***********************************************************************
192 * GetMapMode (GDI32.@)
194 INT WINAPI GetMapMode( HDC hdc )
197 DC * dc = DC_GetDCPtr( hdc );
201 GDI_ReleaseObj( hdc );
207 /***********************************************************************
208 * GetPolyFillMode (GDI32.@)
210 INT WINAPI GetPolyFillMode( HDC hdc )
213 DC * dc = DC_GetDCPtr( hdc );
216 ret = dc->polyFillMode;
217 GDI_ReleaseObj( hdc );
223 /***********************************************************************
226 INT WINAPI GetROP2( HDC hdc )
229 DC * dc = DC_GetDCPtr( hdc );
233 GDI_ReleaseObj( hdc );
239 /***********************************************************************
240 * GetStretchBltMode (GDI32.@)
242 INT WINAPI GetStretchBltMode( HDC hdc )
245 DC * dc = DC_GetDCPtr( hdc );
248 ret = dc->stretchBltMode;
249 GDI_ReleaseObj( hdc );
255 /***********************************************************************
256 * GetTextColor (GDI32.@)
258 COLORREF WINAPI GetTextColor( HDC hdc )
261 DC * dc = DC_GetDCPtr( hdc );
265 GDI_ReleaseObj( hdc );
271 /***********************************************************************
272 * GetTextAlign (GDI32.@)
274 UINT WINAPI GetTextAlign( HDC hdc )
277 DC * dc = DC_GetDCPtr( hdc );
281 GDI_ReleaseObj( hdc );
287 /***********************************************************************
288 * GetArcDirection (GDI32.@)
290 INT WINAPI GetArcDirection( HDC hdc )
293 DC * dc = DC_GetDCPtr( hdc );
296 ret = dc->ArcDirection;
297 GDI_ReleaseObj( hdc );
303 /***********************************************************************
304 * GetGraphicsMode (GDI32.@)
306 INT WINAPI GetGraphicsMode( HDC hdc )
309 DC * dc = DC_GetDCPtr( hdc );
312 ret = dc->GraphicsMode;
313 GDI_ReleaseObj( hdc );
319 /***********************************************************************
320 * GetBrushOrgEx (GDI32.@)
322 BOOL WINAPI GetBrushOrgEx( HDC hdc, LPPOINT pt )
324 DC * dc = DC_GetDCPtr( hdc );
325 if (!dc) return FALSE;
326 pt->x = dc->brushOrgX;
327 pt->y = dc->brushOrgY;
328 GDI_ReleaseObj( hdc );
333 /***********************************************************************
334 * GetCurrentPositionEx (GDI32.@)
336 BOOL WINAPI GetCurrentPositionEx( HDC hdc, LPPOINT pt )
338 DC * dc = DC_GetDCPtr( hdc );
339 if (!dc) return FALSE;
340 pt->x = dc->CursPosX;
341 pt->y = dc->CursPosY;
342 GDI_ReleaseObj( hdc );
347 /***********************************************************************
348 * GetViewportExtEx (GDI32.@)
350 BOOL WINAPI GetViewportExtEx( HDC hdc, LPSIZE size )
352 DC * dc = DC_GetDCPtr( hdc );
353 if (!dc) return FALSE;
354 size->cx = dc->vportExtX;
355 size->cy = dc->vportExtY;
356 GDI_ReleaseObj( hdc );
361 /***********************************************************************
362 * GetViewportOrgEx (GDI32.@)
364 BOOL WINAPI GetViewportOrgEx( HDC hdc, LPPOINT pt )
366 DC * dc = DC_GetDCPtr( hdc );
367 if (!dc) return FALSE;
368 pt->x = dc->vportOrgX;
369 pt->y = dc->vportOrgY;
370 GDI_ReleaseObj( hdc );
375 /***********************************************************************
376 * GetWindowExtEx (GDI32.@)
378 BOOL WINAPI GetWindowExtEx( HDC hdc, LPSIZE size )
380 DC * dc = DC_GetDCPtr( hdc );
381 if (!dc) return FALSE;
382 size->cx = dc->wndExtX;
383 size->cy = dc->wndExtY;
384 GDI_ReleaseObj( hdc );
389 /***********************************************************************
390 * GetWindowOrgEx (GDI32.@)
392 BOOL WINAPI GetWindowOrgEx( HDC hdc, LPPOINT pt )
394 DC * dc = DC_GetDCPtr( hdc );
395 if (!dc) return FALSE;
398 GDI_ReleaseObj( hdc );
403 /**** 16-bit functions ***/
405 /***********************************************************************
406 * InquireVisRgn (GDI.131)
408 HRGN16 WINAPI InquireVisRgn16( HDC16 hdc )
411 DC * dc = DC_GetDCPtr( HDC_32(hdc) );
414 ret = HRGN_16(dc->hVisRgn);
415 GDI_ReleaseObj( HDC_32(hdc) );
421 /***********************************************************************
422 * GetClipRgn (GDI.173)
424 HRGN16 WINAPI GetClipRgn16( HDC16 hdc )
427 DC * dc = DC_GetDCPtr( HDC_32(hdc) );
430 ret = HRGN_16(dc->hClipRgn);
431 GDI_ReleaseObj( HDC_32(hdc) );