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
29 /***********************************************************************
32 INT WINAPI SetBkMode( HDC hdc, INT mode )
36 if ((mode <= 0) || (mode > BKMODE_LAST))
38 SetLastError(ERROR_INVALID_PARAMETER);
41 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
42 if (dc->funcs->pSetBkMode)
43 ret = dc->funcs->pSetBkMode( dc->physDev, mode );
46 ret = dc->backgroundMode;
47 dc->backgroundMode = mode;
49 GDI_ReleaseObj( hdc );
54 /***********************************************************************
57 INT WINAPI SetROP2( HDC hdc, INT mode )
61 if ((mode < R2_BLACK) || (mode > R2_WHITE))
63 SetLastError(ERROR_INVALID_PARAMETER);
66 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
67 if (dc->funcs->pSetROP2)
68 ret = dc->funcs->pSetROP2( dc->physDev, mode );
74 GDI_ReleaseObj( hdc );
79 /***********************************************************************
82 INT WINAPI SetRelAbs( HDC hdc, INT mode )
86 if ((mode != ABSOLUTE) && (mode != RELATIVE))
88 SetLastError(ERROR_INVALID_PARAMETER);
91 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
92 if (dc->funcs->pSetRelAbs)
93 ret = dc->funcs->pSetRelAbs( dc->physDev, mode );
97 dc->relAbsMode = mode;
99 GDI_ReleaseObj( hdc );
104 /***********************************************************************
105 * SetPolyFillMode (GDI32.@)
107 INT WINAPI SetPolyFillMode( HDC hdc, INT mode )
111 if ((mode <= 0) || (mode > POLYFILL_LAST))
113 SetLastError(ERROR_INVALID_PARAMETER);
116 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
117 if (dc->funcs->pSetPolyFillMode)
118 ret = dc->funcs->pSetPolyFillMode( dc->physDev, mode );
121 ret = dc->polyFillMode;
122 dc->polyFillMode = mode;
124 GDI_ReleaseObj( hdc );
129 /***********************************************************************
130 * SetStretchBltMode (GDI32.@)
132 INT WINAPI SetStretchBltMode( HDC hdc, INT mode )
136 if ((mode <= 0) || (mode > MAXSTRETCHBLTMODE))
138 SetLastError(ERROR_INVALID_PARAMETER);
141 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
142 if (dc->funcs->pSetStretchBltMode)
143 ret = dc->funcs->pSetStretchBltMode( dc->physDev, mode );
146 ret = dc->stretchBltMode;
147 dc->stretchBltMode = mode;
149 GDI_ReleaseObj( hdc );
154 /***********************************************************************
155 * GetBkColor (GDI32.@)
157 COLORREF WINAPI GetBkColor( HDC hdc )
160 DC * dc = DC_GetDCPtr( hdc );
163 ret = dc->backgroundColor;
164 GDI_ReleaseObj( hdc );
170 /***********************************************************************
171 * GetBkMode (GDI32.@)
173 INT WINAPI GetBkMode( HDC hdc )
176 DC * dc = DC_GetDCPtr( hdc );
179 ret = dc->backgroundMode;
180 GDI_ReleaseObj( hdc );
186 /***********************************************************************
187 * GetMapMode (GDI32.@)
189 INT WINAPI GetMapMode( HDC hdc )
192 DC * dc = DC_GetDCPtr( hdc );
196 GDI_ReleaseObj( hdc );
202 /***********************************************************************
203 * GetPolyFillMode (GDI32.@)
205 INT WINAPI GetPolyFillMode( HDC hdc )
208 DC * dc = DC_GetDCPtr( hdc );
211 ret = dc->polyFillMode;
212 GDI_ReleaseObj( hdc );
218 /***********************************************************************
221 INT WINAPI GetROP2( HDC hdc )
224 DC * dc = DC_GetDCPtr( hdc );
228 GDI_ReleaseObj( hdc );
234 /***********************************************************************
235 * GetStretchBltMode (GDI32.@)
237 INT WINAPI GetStretchBltMode( HDC hdc )
240 DC * dc = DC_GetDCPtr( hdc );
243 ret = dc->stretchBltMode;
244 GDI_ReleaseObj( hdc );
250 /***********************************************************************
251 * GetTextColor (GDI32.@)
253 COLORREF WINAPI GetTextColor( HDC hdc )
256 DC * dc = DC_GetDCPtr( hdc );
260 GDI_ReleaseObj( hdc );
266 /***********************************************************************
267 * GetTextAlign (GDI32.@)
269 UINT WINAPI GetTextAlign( HDC hdc )
272 DC * dc = DC_GetDCPtr( hdc );
276 GDI_ReleaseObj( hdc );
282 /***********************************************************************
283 * GetArcDirection (GDI32.@)
285 INT WINAPI GetArcDirection( HDC hdc )
288 DC * dc = DC_GetDCPtr( hdc );
291 ret = dc->ArcDirection;
292 GDI_ReleaseObj( hdc );
298 /***********************************************************************
299 * GetGraphicsMode (GDI32.@)
301 INT WINAPI GetGraphicsMode( HDC hdc )
304 DC * dc = DC_GetDCPtr( hdc );
307 ret = dc->GraphicsMode;
308 GDI_ReleaseObj( hdc );
314 /***********************************************************************
315 * GetBrushOrgEx (GDI32.@)
317 BOOL WINAPI GetBrushOrgEx( HDC hdc, LPPOINT pt )
319 DC * dc = DC_GetDCPtr( hdc );
320 if (!dc) return FALSE;
321 pt->x = dc->brushOrgX;
322 pt->y = dc->brushOrgY;
323 GDI_ReleaseObj( hdc );
328 /***********************************************************************
329 * GetCurrentPositionEx (GDI32.@)
331 BOOL WINAPI GetCurrentPositionEx( HDC hdc, LPPOINT pt )
333 DC * dc = DC_GetDCPtr( hdc );
334 if (!dc) return FALSE;
335 pt->x = dc->CursPosX;
336 pt->y = dc->CursPosY;
337 GDI_ReleaseObj( hdc );
342 /***********************************************************************
343 * GetViewportExtEx (GDI32.@)
345 BOOL WINAPI GetViewportExtEx( HDC hdc, LPSIZE size )
347 DC * dc = DC_GetDCPtr( hdc );
348 if (!dc) return FALSE;
349 size->cx = dc->vportExtX;
350 size->cy = dc->vportExtY;
351 GDI_ReleaseObj( hdc );
356 /***********************************************************************
357 * GetViewportOrgEx (GDI32.@)
359 BOOL WINAPI GetViewportOrgEx( HDC hdc, LPPOINT pt )
361 DC * dc = DC_GetDCPtr( hdc );
362 if (!dc) return FALSE;
363 pt->x = dc->vportOrgX;
364 pt->y = dc->vportOrgY;
365 GDI_ReleaseObj( hdc );
370 /***********************************************************************
371 * GetWindowExtEx (GDI32.@)
373 BOOL WINAPI GetWindowExtEx( HDC hdc, LPSIZE size )
375 DC * dc = DC_GetDCPtr( hdc );
376 if (!dc) return FALSE;
377 size->cx = dc->wndExtX;
378 size->cy = dc->wndExtY;
379 GDI_ReleaseObj( hdc );
384 /***********************************************************************
385 * GetWindowOrgEx (GDI32.@)
387 BOOL WINAPI GetWindowOrgEx( HDC hdc, LPPOINT pt )
389 DC * dc = DC_GetDCPtr( hdc );
390 if (!dc) return FALSE;
393 GDI_ReleaseObj( hdc );
398 /**** 16-bit functions ***/
400 /***********************************************************************
401 * InquireVisRgn (GDI.131)
403 HRGN16 WINAPI InquireVisRgn16( HDC16 hdc )
406 DC * dc = DC_GetDCPtr( hdc );
410 GDI_ReleaseObj( hdc );
416 /***********************************************************************
417 * GetClipRgn (GDI.173)
419 HRGN16 WINAPI GetClipRgn16( HDC16 hdc )
422 DC * dc = DC_GetDCPtr( hdc );
426 GDI_ReleaseObj( hdc );