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
30 /***********************************************************************
33 INT WINAPI SetBkMode( HDC hdc, INT mode )
37 if ((mode <= 0) || (mode > BKMODE_LAST))
39 SetLastError(ERROR_INVALID_PARAMETER);
42 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
43 if (dc->funcs->pSetBkMode)
44 ret = dc->funcs->pSetBkMode( dc->physDev, mode );
47 ret = dc->backgroundMode;
48 dc->backgroundMode = mode;
50 GDI_ReleaseObj( hdc );
55 /***********************************************************************
58 INT WINAPI SetROP2( HDC hdc, INT mode )
62 if ((mode < R2_BLACK) || (mode > R2_WHITE))
64 SetLastError(ERROR_INVALID_PARAMETER);
67 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
68 if (dc->funcs->pSetROP2)
69 ret = dc->funcs->pSetROP2( dc->physDev, mode );
75 GDI_ReleaseObj( hdc );
80 /***********************************************************************
83 INT WINAPI SetRelAbs( HDC hdc, INT mode )
87 if ((mode != ABSOLUTE) && (mode != RELATIVE))
89 SetLastError(ERROR_INVALID_PARAMETER);
92 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
93 if (dc->funcs->pSetRelAbs)
94 ret = dc->funcs->pSetRelAbs( dc->physDev, mode );
98 dc->relAbsMode = mode;
100 GDI_ReleaseObj( hdc );
105 /***********************************************************************
106 * SetPolyFillMode (GDI32.@)
108 INT WINAPI SetPolyFillMode( HDC hdc, INT mode )
112 if ((mode <= 0) || (mode > POLYFILL_LAST))
114 SetLastError(ERROR_INVALID_PARAMETER);
117 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
118 if (dc->funcs->pSetPolyFillMode)
119 ret = dc->funcs->pSetPolyFillMode( dc->physDev, mode );
122 ret = dc->polyFillMode;
123 dc->polyFillMode = mode;
125 GDI_ReleaseObj( hdc );
130 /***********************************************************************
131 * SetStretchBltMode (GDI32.@)
133 INT WINAPI SetStretchBltMode( HDC hdc, INT mode )
137 if ((mode <= 0) || (mode > MAXSTRETCHBLTMODE))
139 SetLastError(ERROR_INVALID_PARAMETER);
142 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
143 if (dc->funcs->pSetStretchBltMode)
144 ret = dc->funcs->pSetStretchBltMode( dc->physDev, mode );
147 ret = dc->stretchBltMode;
148 dc->stretchBltMode = mode;
150 GDI_ReleaseObj( hdc );
155 /***********************************************************************
156 * GetBkColor (GDI32.@)
158 COLORREF WINAPI GetBkColor( HDC hdc )
161 DC * dc = DC_GetDCPtr( hdc );
164 ret = dc->backgroundColor;
165 GDI_ReleaseObj( hdc );
171 /***********************************************************************
172 * GetBkMode (GDI32.@)
174 INT WINAPI GetBkMode( HDC hdc )
177 DC * dc = DC_GetDCPtr( hdc );
180 ret = dc->backgroundMode;
181 GDI_ReleaseObj( hdc );
187 /***********************************************************************
188 * GetMapMode (GDI32.@)
190 INT WINAPI GetMapMode( HDC hdc )
193 DC * dc = DC_GetDCPtr( hdc );
197 GDI_ReleaseObj( hdc );
203 /***********************************************************************
204 * GetPolyFillMode (GDI32.@)
206 INT WINAPI GetPolyFillMode( HDC hdc )
209 DC * dc = DC_GetDCPtr( hdc );
212 ret = dc->polyFillMode;
213 GDI_ReleaseObj( hdc );
219 /***********************************************************************
222 INT WINAPI GetROP2( HDC hdc )
225 DC * dc = DC_GetDCPtr( hdc );
229 GDI_ReleaseObj( hdc );
235 /***********************************************************************
236 * GetStretchBltMode (GDI32.@)
238 INT WINAPI GetStretchBltMode( HDC hdc )
241 DC * dc = DC_GetDCPtr( hdc );
244 ret = dc->stretchBltMode;
245 GDI_ReleaseObj( hdc );
251 /***********************************************************************
252 * GetTextColor (GDI32.@)
254 COLORREF WINAPI GetTextColor( HDC hdc )
257 DC * dc = DC_GetDCPtr( hdc );
261 GDI_ReleaseObj( hdc );
267 /***********************************************************************
268 * GetTextAlign (GDI32.@)
270 UINT WINAPI GetTextAlign( HDC hdc )
273 DC * dc = DC_GetDCPtr( hdc );
277 GDI_ReleaseObj( hdc );
283 /***********************************************************************
284 * GetArcDirection (GDI32.@)
286 INT WINAPI GetArcDirection( HDC hdc )
289 DC * dc = DC_GetDCPtr( hdc );
292 ret = dc->ArcDirection;
293 GDI_ReleaseObj( hdc );
299 /***********************************************************************
300 * GetGraphicsMode (GDI32.@)
302 INT WINAPI GetGraphicsMode( HDC hdc )
305 DC * dc = DC_GetDCPtr( hdc );
308 ret = dc->GraphicsMode;
309 GDI_ReleaseObj( hdc );
315 /***********************************************************************
316 * GetBrushOrgEx (GDI32.@)
318 BOOL WINAPI GetBrushOrgEx( HDC hdc, LPPOINT pt )
320 DC * dc = DC_GetDCPtr( hdc );
321 if (!dc) return FALSE;
322 pt->x = dc->brushOrgX;
323 pt->y = dc->brushOrgY;
324 GDI_ReleaseObj( hdc );
329 /***********************************************************************
330 * GetCurrentPositionEx (GDI32.@)
332 BOOL WINAPI GetCurrentPositionEx( HDC hdc, LPPOINT pt )
334 DC * dc = DC_GetDCPtr( hdc );
335 if (!dc) return FALSE;
336 pt->x = dc->CursPosX;
337 pt->y = dc->CursPosY;
338 GDI_ReleaseObj( hdc );
343 /***********************************************************************
344 * GetViewportExtEx (GDI32.@)
346 BOOL WINAPI GetViewportExtEx( HDC hdc, LPSIZE size )
348 DC * dc = DC_GetDCPtr( hdc );
349 if (!dc) return FALSE;
350 size->cx = dc->vportExtX;
351 size->cy = dc->vportExtY;
352 GDI_ReleaseObj( hdc );
357 /***********************************************************************
358 * GetViewportOrgEx (GDI32.@)
360 BOOL WINAPI GetViewportOrgEx( HDC hdc, LPPOINT pt )
362 DC * dc = DC_GetDCPtr( hdc );
363 if (!dc) return FALSE;
364 pt->x = dc->vportOrgX;
365 pt->y = dc->vportOrgY;
366 GDI_ReleaseObj( hdc );
371 /***********************************************************************
372 * GetWindowExtEx (GDI32.@)
374 BOOL WINAPI GetWindowExtEx( HDC hdc, LPSIZE size )
376 DC * dc = DC_GetDCPtr( hdc );
377 if (!dc) return FALSE;
378 size->cx = dc->wndExtX;
379 size->cy = dc->wndExtY;
380 GDI_ReleaseObj( hdc );
385 /***********************************************************************
386 * GetWindowOrgEx (GDI32.@)
388 BOOL WINAPI GetWindowOrgEx( HDC hdc, LPPOINT pt )
390 DC * dc = DC_GetDCPtr( hdc );
391 if (!dc) return FALSE;
394 GDI_ReleaseObj( hdc );
399 /**** 16-bit functions ***/
401 /***********************************************************************
402 * InquireVisRgn (GDI.131)
404 HRGN16 WINAPI InquireVisRgn16( HDC16 hdc )
407 DC * dc = DC_GetDCPtr( HDC_32(hdc) );
410 ret = HRGN_16(dc->hVisRgn);
411 GDI_ReleaseObj( HDC_32(hdc) );
417 /***********************************************************************
418 * GetClipRgn (GDI.173)
420 HRGN16 WINAPI GetClipRgn16( HDC16 hdc )
423 DC * dc = DC_GetDCPtr( HDC_32(hdc) );
426 ret = HRGN_16(dc->hClipRgn);
427 GDI_ReleaseObj( HDC_32(hdc) );