Moved the final process init and dependency loading to
[wine/multimedia.git] / objects / dcvalues.c
blob2516398d5e1293ee7fa6aedf29ceee3197c2099b
1 /*
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
21 #include "config.h"
23 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winerror.h"
28 #include "wownt32.h"
30 #include "gdi.h"
33 /***********************************************************************
34 * SetBkMode (GDI32.@)
36 INT WINAPI SetBkMode( HDC hdc, INT mode )
38 INT ret;
39 DC *dc;
40 if ((mode <= 0) || (mode > BKMODE_LAST))
42 SetLastError(ERROR_INVALID_PARAMETER);
43 return 0;
45 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
46 if (dc->funcs->pSetBkMode)
47 ret = dc->funcs->pSetBkMode( dc->physDev, mode );
48 else
50 ret = dc->backgroundMode;
51 dc->backgroundMode = mode;
53 GDI_ReleaseObj( hdc );
54 return ret;
58 /***********************************************************************
59 * SetROP2 (GDI32.@)
61 INT WINAPI SetROP2( HDC hdc, INT mode )
63 INT ret;
64 DC *dc;
65 if ((mode < R2_BLACK) || (mode > R2_WHITE))
67 SetLastError(ERROR_INVALID_PARAMETER);
68 return 0;
70 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
71 if (dc->funcs->pSetROP2)
72 ret = dc->funcs->pSetROP2( dc->physDev, mode );
73 else
75 ret = dc->ROPmode;
76 dc->ROPmode = mode;
78 GDI_ReleaseObj( hdc );
79 return ret;
83 /***********************************************************************
84 * SetRelAbs (GDI32.@)
86 INT WINAPI SetRelAbs( HDC hdc, INT mode )
88 INT ret;
89 DC *dc;
90 if ((mode != ABSOLUTE) && (mode != RELATIVE))
92 SetLastError(ERROR_INVALID_PARAMETER);
93 return 0;
95 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
96 if (dc->funcs->pSetRelAbs)
97 ret = dc->funcs->pSetRelAbs( dc->physDev, mode );
98 else
100 ret = dc->relAbsMode;
101 dc->relAbsMode = mode;
103 GDI_ReleaseObj( hdc );
104 return ret;
108 /***********************************************************************
109 * SetPolyFillMode (GDI32.@)
111 INT WINAPI SetPolyFillMode( HDC hdc, INT mode )
113 INT ret;
114 DC *dc;
115 if ((mode <= 0) || (mode > POLYFILL_LAST))
117 SetLastError(ERROR_INVALID_PARAMETER);
118 return 0;
120 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
121 if (dc->funcs->pSetPolyFillMode)
122 ret = dc->funcs->pSetPolyFillMode( dc->physDev, mode );
123 else
125 ret = dc->polyFillMode;
126 dc->polyFillMode = mode;
128 GDI_ReleaseObj( hdc );
129 return ret;
133 /***********************************************************************
134 * SetStretchBltMode (GDI32.@)
136 INT WINAPI SetStretchBltMode( HDC hdc, INT mode )
138 INT ret;
139 DC *dc;
140 if ((mode <= 0) || (mode > MAXSTRETCHBLTMODE))
142 SetLastError(ERROR_INVALID_PARAMETER);
143 return 0;
145 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
146 if (dc->funcs->pSetStretchBltMode)
147 ret = dc->funcs->pSetStretchBltMode( dc->physDev, mode );
148 else
150 ret = dc->stretchBltMode;
151 dc->stretchBltMode = mode;
153 GDI_ReleaseObj( hdc );
154 return ret;
158 /***********************************************************************
159 * GetBkColor (GDI32.@)
161 COLORREF WINAPI GetBkColor( HDC hdc )
163 COLORREF ret = 0;
164 DC * dc = DC_GetDCPtr( hdc );
165 if (dc)
167 ret = dc->backgroundColor;
168 GDI_ReleaseObj( hdc );
170 return ret;
174 /***********************************************************************
175 * GetBkMode (GDI32.@)
177 INT WINAPI GetBkMode( HDC hdc )
179 INT ret = 0;
180 DC * dc = DC_GetDCPtr( hdc );
181 if (dc)
183 ret = dc->backgroundMode;
184 GDI_ReleaseObj( hdc );
186 return ret;
190 /***********************************************************************
191 * GetMapMode (GDI32.@)
193 INT WINAPI GetMapMode( HDC hdc )
195 INT ret = 0;
196 DC * dc = DC_GetDCPtr( hdc );
197 if (dc)
199 ret = dc->MapMode;
200 GDI_ReleaseObj( hdc );
202 return ret;
206 /***********************************************************************
207 * GetPolyFillMode (GDI32.@)
209 INT WINAPI GetPolyFillMode( HDC hdc )
211 INT ret = 0;
212 DC * dc = DC_GetDCPtr( hdc );
213 if (dc)
215 ret = dc->polyFillMode;
216 GDI_ReleaseObj( hdc );
218 return ret;
222 /***********************************************************************
223 * GetROP2 (GDI32.@)
225 INT WINAPI GetROP2( HDC hdc )
227 INT ret = 0;
228 DC * dc = DC_GetDCPtr( hdc );
229 if (dc)
231 ret = dc->ROPmode;
232 GDI_ReleaseObj( hdc );
234 return ret;
238 /***********************************************************************
239 * GetStretchBltMode (GDI32.@)
241 INT WINAPI GetStretchBltMode( HDC hdc )
243 INT ret = 0;
244 DC * dc = DC_GetDCPtr( hdc );
245 if (dc)
247 ret = dc->stretchBltMode;
248 GDI_ReleaseObj( hdc );
250 return ret;
254 /***********************************************************************
255 * GetTextColor (GDI32.@)
257 COLORREF WINAPI GetTextColor( HDC hdc )
259 COLORREF ret = 0;
260 DC * dc = DC_GetDCPtr( hdc );
261 if (dc)
263 ret = dc->textColor;
264 GDI_ReleaseObj( hdc );
266 return ret;
270 /***********************************************************************
271 * GetTextAlign (GDI32.@)
273 UINT WINAPI GetTextAlign( HDC hdc )
275 UINT ret = 0;
276 DC * dc = DC_GetDCPtr( hdc );
277 if (dc)
279 ret = dc->textAlign;
280 GDI_ReleaseObj( hdc );
282 return ret;
286 /***********************************************************************
287 * GetArcDirection (GDI32.@)
289 INT WINAPI GetArcDirection( HDC hdc )
291 INT ret = 0;
292 DC * dc = DC_GetDCPtr( hdc );
293 if (dc)
295 ret = dc->ArcDirection;
296 GDI_ReleaseObj( hdc );
298 return ret;
302 /***********************************************************************
303 * GetGraphicsMode (GDI32.@)
305 INT WINAPI GetGraphicsMode( HDC hdc )
307 INT ret = 0;
308 DC * dc = DC_GetDCPtr( hdc );
309 if (dc)
311 ret = dc->GraphicsMode;
312 GDI_ReleaseObj( hdc );
314 return ret;
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 );
328 return TRUE;
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 );
342 return TRUE;
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 );
356 return TRUE;
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 );
370 return TRUE;
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 );
384 return TRUE;
388 /***********************************************************************
389 * GetWindowOrgEx (GDI32.@)
391 BOOL WINAPI GetWindowOrgEx( HDC hdc, LPPOINT pt )
393 DC * dc = DC_GetDCPtr( hdc );
394 if (!dc) return FALSE;
395 pt->x = dc->wndOrgX;
396 pt->y = dc->wndOrgY;
397 GDI_ReleaseObj( hdc );
398 return TRUE;
402 /**** 16-bit functions ***/
404 /***********************************************************************
405 * InquireVisRgn (GDI.131)
407 HRGN16 WINAPI InquireVisRgn16( HDC16 hdc )
409 HRGN16 ret = 0;
410 DC * dc = DC_GetDCPtr( HDC_32(hdc) );
411 if (dc)
413 ret = HRGN_16(dc->hVisRgn);
414 GDI_ReleaseObj( HDC_32(hdc) );
416 return ret;
420 /***********************************************************************
421 * GetClipRgn (GDI.173)
423 HRGN16 WINAPI GetClipRgn16( HDC16 hdc )
425 HRGN16 ret = 0;
426 DC * dc = DC_GetDCPtr( HDC_32(hdc) );
427 if (dc)
429 ret = HRGN_16(dc->hClipRgn);
430 GDI_ReleaseObj( HDC_32(hdc) );
432 return ret;