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
33 /***********************************************************************
36 INT WINAPI SetBkMode( HDC hdc, INT mode )
40 if ((mode <= 0) || (mode > BKMODE_LAST))
42 SetLastError(ERROR_INVALID_PARAMETER);
45 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
46 if (dc->funcs->pSetBkMode)
47 ret = dc->funcs->pSetBkMode( dc->physDev, mode );
50 ret = dc->backgroundMode;
51 dc->backgroundMode = mode;
53 GDI_ReleaseObj( hdc );
58 /***********************************************************************
61 INT WINAPI SetROP2( HDC hdc, INT mode )
65 if ((mode < R2_BLACK) || (mode > R2_WHITE))
67 SetLastError(ERROR_INVALID_PARAMETER);
70 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
71 if (dc->funcs->pSetROP2)
72 ret = dc->funcs->pSetROP2( dc->physDev, mode );
78 GDI_ReleaseObj( hdc );
83 /***********************************************************************
86 INT WINAPI SetRelAbs( HDC hdc, INT mode )
90 if ((mode != ABSOLUTE) && (mode != RELATIVE))
92 SetLastError(ERROR_INVALID_PARAMETER);
95 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
96 if (dc->funcs->pSetRelAbs)
97 ret = dc->funcs->pSetRelAbs( dc->physDev, mode );
100 ret = dc->relAbsMode;
101 dc->relAbsMode = mode;
103 GDI_ReleaseObj( hdc );
108 /***********************************************************************
109 * SetPolyFillMode (GDI32.@)
111 INT WINAPI SetPolyFillMode( HDC hdc, INT mode )
115 if ((mode <= 0) || (mode > POLYFILL_LAST))
117 SetLastError(ERROR_INVALID_PARAMETER);
120 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
121 if (dc->funcs->pSetPolyFillMode)
122 ret = dc->funcs->pSetPolyFillMode( dc->physDev, mode );
125 ret = dc->polyFillMode;
126 dc->polyFillMode = mode;
128 GDI_ReleaseObj( hdc );
133 /***********************************************************************
134 * SetStretchBltMode (GDI32.@)
136 INT WINAPI SetStretchBltMode( HDC hdc, INT mode )
140 if ((mode <= 0) || (mode > MAXSTRETCHBLTMODE))
142 SetLastError(ERROR_INVALID_PARAMETER);
145 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
146 if (dc->funcs->pSetStretchBltMode)
147 ret = dc->funcs->pSetStretchBltMode( dc->physDev, mode );
150 ret = dc->stretchBltMode;
151 dc->stretchBltMode = mode;
153 GDI_ReleaseObj( hdc );
158 /***********************************************************************
159 * GetBkColor (GDI32.@)
161 COLORREF WINAPI GetBkColor( HDC hdc )
164 DC * dc = DC_GetDCPtr( hdc );
167 ret = dc->backgroundColor;
168 GDI_ReleaseObj( hdc );
174 /***********************************************************************
175 * GetBkMode (GDI32.@)
177 INT WINAPI GetBkMode( HDC hdc )
180 DC * dc = DC_GetDCPtr( hdc );
183 ret = dc->backgroundMode;
184 GDI_ReleaseObj( hdc );
190 /***********************************************************************
191 * GetMapMode (GDI32.@)
193 INT WINAPI GetMapMode( HDC hdc )
196 DC * dc = DC_GetDCPtr( hdc );
200 GDI_ReleaseObj( hdc );
206 /***********************************************************************
207 * GetPolyFillMode (GDI32.@)
209 INT WINAPI GetPolyFillMode( HDC hdc )
212 DC * dc = DC_GetDCPtr( hdc );
215 ret = dc->polyFillMode;
216 GDI_ReleaseObj( hdc );
222 /***********************************************************************
225 INT WINAPI GetROP2( HDC hdc )
228 DC * dc = DC_GetDCPtr( hdc );
232 GDI_ReleaseObj( hdc );
238 /***********************************************************************
239 * GetStretchBltMode (GDI32.@)
241 INT WINAPI GetStretchBltMode( HDC hdc )
244 DC * dc = DC_GetDCPtr( hdc );
247 ret = dc->stretchBltMode;
248 GDI_ReleaseObj( hdc );
254 /***********************************************************************
255 * GetTextColor (GDI32.@)
257 COLORREF WINAPI GetTextColor( HDC hdc )
260 DC * dc = DC_GetDCPtr( hdc );
264 GDI_ReleaseObj( hdc );
270 /***********************************************************************
271 * GetTextAlign (GDI32.@)
273 UINT WINAPI GetTextAlign( HDC hdc )
276 DC * dc = DC_GetDCPtr( hdc );
280 GDI_ReleaseObj( hdc );
286 /***********************************************************************
287 * GetArcDirection (GDI32.@)
289 INT WINAPI GetArcDirection( HDC hdc )
292 DC * dc = DC_GetDCPtr( hdc );
295 ret = dc->ArcDirection;
296 GDI_ReleaseObj( hdc );
302 /***********************************************************************
303 * GetGraphicsMode (GDI32.@)
305 INT WINAPI GetGraphicsMode( HDC hdc )
308 DC * dc = DC_GetDCPtr( hdc );
311 ret = dc->GraphicsMode;
312 GDI_ReleaseObj( hdc );
318 /***********************************************************************
319 * GetBrushOrgEx (GDI32.@)
321 BOOL WINAPI GetBrushOrgEx( HDC hdc, LPPOINT pt )
323 DC * dc = DC_GetDCPtr( hdc );
324 if (!dc) return FALSE;
325 pt->x = dc->brushOrgX;
326 pt->y = dc->brushOrgY;
327 GDI_ReleaseObj( hdc );
332 /***********************************************************************
333 * GetCurrentPositionEx (GDI32.@)
335 BOOL WINAPI GetCurrentPositionEx( HDC hdc, LPPOINT pt )
337 DC * dc = DC_GetDCPtr( hdc );
338 if (!dc) return FALSE;
339 pt->x = dc->CursPosX;
340 pt->y = dc->CursPosY;
341 GDI_ReleaseObj( hdc );
346 /***********************************************************************
347 * GetViewportExtEx (GDI32.@)
349 BOOL WINAPI GetViewportExtEx( HDC hdc, LPSIZE size )
351 DC * dc = DC_GetDCPtr( hdc );
352 if (!dc) return FALSE;
353 size->cx = dc->vportExtX;
354 size->cy = dc->vportExtY;
355 GDI_ReleaseObj( hdc );
360 /***********************************************************************
361 * GetViewportOrgEx (GDI32.@)
363 BOOL WINAPI GetViewportOrgEx( HDC hdc, LPPOINT pt )
365 DC * dc = DC_GetDCPtr( hdc );
366 if (!dc) return FALSE;
367 pt->x = dc->vportOrgX;
368 pt->y = dc->vportOrgY;
369 GDI_ReleaseObj( hdc );
374 /***********************************************************************
375 * GetWindowExtEx (GDI32.@)
377 BOOL WINAPI GetWindowExtEx( HDC hdc, LPSIZE size )
379 DC * dc = DC_GetDCPtr( hdc );
380 if (!dc) return FALSE;
381 size->cx = dc->wndExtX;
382 size->cy = dc->wndExtY;
383 GDI_ReleaseObj( hdc );
388 /***********************************************************************
389 * GetWindowOrgEx (GDI32.@)
391 BOOL WINAPI GetWindowOrgEx( HDC hdc, LPPOINT pt )
393 DC * dc = DC_GetDCPtr( hdc );
394 if (!dc) return FALSE;
397 GDI_ReleaseObj( hdc );
402 /**** 16-bit functions ***/
404 /***********************************************************************
405 * InquireVisRgn (GDI.131)
407 HRGN16 WINAPI InquireVisRgn16( HDC16 hdc )
410 DC * dc = DC_GetDCPtr( HDC_32(hdc) );
413 ret = HRGN_16(dc->hVisRgn);
414 GDI_ReleaseObj( HDC_32(hdc) );
420 /***********************************************************************
421 * GetClipRgn (GDI.173)
423 HRGN16 WINAPI GetClipRgn16( HDC16 hdc )
426 DC * dc = DC_GetDCPtr( HDC_32(hdc) );
429 ret = HRGN_16(dc->hClipRgn);
430 GDI_ReleaseObj( HDC_32(hdc) );