Add and use the header files mssip.h and sipbase.h.
[wine/multimedia.git] / objects / dcvalues.c
blobeed2d2755f00dfaa728e5720490a7fdabcaefe92
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 "winbase.h"
24 #include "winerror.h"
26 #include "gdi.h"
29 /***********************************************************************
30 * SetBkMode (GDI32.@)
32 INT WINAPI SetBkMode( HDC hdc, INT mode )
34 INT ret;
35 DC *dc;
36 if ((mode <= 0) || (mode > BKMODE_LAST))
38 SetLastError(ERROR_INVALID_PARAMETER);
39 return 0;
41 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
42 if (dc->funcs->pSetBkMode)
43 ret = dc->funcs->pSetBkMode( dc->physDev, mode );
44 else
46 ret = dc->backgroundMode;
47 dc->backgroundMode = mode;
49 GDI_ReleaseObj( hdc );
50 return ret;
54 /***********************************************************************
55 * SetROP2 (GDI32.@)
57 INT WINAPI SetROP2( HDC hdc, INT mode )
59 INT ret;
60 DC *dc;
61 if ((mode < R2_BLACK) || (mode > R2_WHITE))
63 SetLastError(ERROR_INVALID_PARAMETER);
64 return 0;
66 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
67 if (dc->funcs->pSetROP2)
68 ret = dc->funcs->pSetROP2( dc->physDev, mode );
69 else
71 ret = dc->ROPmode;
72 dc->ROPmode = mode;
74 GDI_ReleaseObj( hdc );
75 return ret;
79 /***********************************************************************
80 * SetRelAbs (GDI32.@)
82 INT WINAPI SetRelAbs( HDC hdc, INT mode )
84 INT ret;
85 DC *dc;
86 if ((mode != ABSOLUTE) && (mode != RELATIVE))
88 SetLastError(ERROR_INVALID_PARAMETER);
89 return 0;
91 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
92 if (dc->funcs->pSetRelAbs)
93 ret = dc->funcs->pSetRelAbs( dc->physDev, mode );
94 else
96 ret = dc->relAbsMode;
97 dc->relAbsMode = mode;
99 GDI_ReleaseObj( hdc );
100 return ret;
104 /***********************************************************************
105 * SetPolyFillMode (GDI32.@)
107 INT WINAPI SetPolyFillMode( HDC hdc, INT mode )
109 INT ret;
110 DC *dc;
111 if ((mode <= 0) || (mode > POLYFILL_LAST))
113 SetLastError(ERROR_INVALID_PARAMETER);
114 return 0;
116 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
117 if (dc->funcs->pSetPolyFillMode)
118 ret = dc->funcs->pSetPolyFillMode( dc->physDev, mode );
119 else
121 ret = dc->polyFillMode;
122 dc->polyFillMode = mode;
124 GDI_ReleaseObj( hdc );
125 return ret;
129 /***********************************************************************
130 * SetStretchBltMode (GDI32.@)
132 INT WINAPI SetStretchBltMode( HDC hdc, INT mode )
134 INT ret;
135 DC *dc;
136 if ((mode <= 0) || (mode > MAXSTRETCHBLTMODE))
138 SetLastError(ERROR_INVALID_PARAMETER);
139 return 0;
141 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
142 if (dc->funcs->pSetStretchBltMode)
143 ret = dc->funcs->pSetStretchBltMode( dc->physDev, mode );
144 else
146 ret = dc->stretchBltMode;
147 dc->stretchBltMode = mode;
149 GDI_ReleaseObj( hdc );
150 return ret;
154 /***********************************************************************
155 * GetBkColor (GDI32.@)
157 COLORREF WINAPI GetBkColor( HDC hdc )
159 COLORREF ret = 0;
160 DC * dc = DC_GetDCPtr( hdc );
161 if (dc)
163 ret = dc->backgroundColor;
164 GDI_ReleaseObj( hdc );
166 return ret;
170 /***********************************************************************
171 * GetBkMode (GDI32.@)
173 INT WINAPI GetBkMode( HDC hdc )
175 INT ret = 0;
176 DC * dc = DC_GetDCPtr( hdc );
177 if (dc)
179 ret = dc->backgroundMode;
180 GDI_ReleaseObj( hdc );
182 return ret;
186 /***********************************************************************
187 * GetMapMode (GDI32.@)
189 INT WINAPI GetMapMode( HDC hdc )
191 INT ret = 0;
192 DC * dc = DC_GetDCPtr( hdc );
193 if (dc)
195 ret = dc->MapMode;
196 GDI_ReleaseObj( hdc );
198 return ret;
202 /***********************************************************************
203 * GetPolyFillMode (GDI32.@)
205 INT WINAPI GetPolyFillMode( HDC hdc )
207 INT ret = 0;
208 DC * dc = DC_GetDCPtr( hdc );
209 if (dc)
211 ret = dc->polyFillMode;
212 GDI_ReleaseObj( hdc );
214 return ret;
218 /***********************************************************************
219 * GetROP2 (GDI32.@)
221 INT WINAPI GetROP2( HDC hdc )
223 INT ret = 0;
224 DC * dc = DC_GetDCPtr( hdc );
225 if (dc)
227 ret = dc->ROPmode;
228 GDI_ReleaseObj( hdc );
230 return ret;
234 /***********************************************************************
235 * GetStretchBltMode (GDI32.@)
237 INT WINAPI GetStretchBltMode( HDC hdc )
239 INT ret = 0;
240 DC * dc = DC_GetDCPtr( hdc );
241 if (dc)
243 ret = dc->stretchBltMode;
244 GDI_ReleaseObj( hdc );
246 return ret;
250 /***********************************************************************
251 * GetTextColor (GDI32.@)
253 COLORREF WINAPI GetTextColor( HDC hdc )
255 COLORREF ret = 0;
256 DC * dc = DC_GetDCPtr( hdc );
257 if (dc)
259 ret = dc->textColor;
260 GDI_ReleaseObj( hdc );
262 return ret;
266 /***********************************************************************
267 * GetTextAlign (GDI32.@)
269 UINT WINAPI GetTextAlign( HDC hdc )
271 UINT ret = 0;
272 DC * dc = DC_GetDCPtr( hdc );
273 if (dc)
275 ret = dc->textAlign;
276 GDI_ReleaseObj( hdc );
278 return ret;
282 /***********************************************************************
283 * GetArcDirection (GDI32.@)
285 INT WINAPI GetArcDirection( HDC hdc )
287 INT ret = 0;
288 DC * dc = DC_GetDCPtr( hdc );
289 if (dc)
291 ret = dc->ArcDirection;
292 GDI_ReleaseObj( hdc );
294 return ret;
298 /***********************************************************************
299 * GetGraphicsMode (GDI32.@)
301 INT WINAPI GetGraphicsMode( HDC hdc )
303 INT ret = 0;
304 DC * dc = DC_GetDCPtr( hdc );
305 if (dc)
307 ret = dc->GraphicsMode;
308 GDI_ReleaseObj( hdc );
310 return ret;
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 );
324 return TRUE;
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 );
338 return TRUE;
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 );
352 return TRUE;
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 );
366 return TRUE;
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 );
380 return TRUE;
384 /***********************************************************************
385 * GetWindowOrgEx (GDI32.@)
387 BOOL WINAPI GetWindowOrgEx( HDC hdc, LPPOINT pt )
389 DC * dc = DC_GetDCPtr( hdc );
390 if (!dc) return FALSE;
391 pt->x = dc->wndOrgX;
392 pt->y = dc->wndOrgY;
393 GDI_ReleaseObj( hdc );
394 return TRUE;
398 /**** 16-bit functions ***/
400 /***********************************************************************
401 * InquireVisRgn (GDI.131)
402 * InquireVisRgn16 (GDI32.@)
404 HRGN16 WINAPI InquireVisRgn16( HDC16 hdc )
406 HRGN16 ret = 0;
407 DC * dc = DC_GetDCPtr( hdc );
408 if (dc)
410 ret = dc->hVisRgn;
411 GDI_ReleaseObj( hdc );
413 return ret;
417 /***********************************************************************
418 * GetClipRgn (GDI.173)
420 HRGN16 WINAPI GetClipRgn16( HDC16 hdc )
422 HRGN16 ret = 0;
423 DC * dc = DC_GetDCPtr( hdc );
424 if (dc)
426 ret = dc->hClipRgn;
427 GDI_ReleaseObj( hdc );
429 return ret;