2 * DC device-independent Get/SetXXX functions
4 * Copyright 1993 Alexandre Julliard
16 /***********************************************************************
19 INT WINAPI
SetBkMode( HDC hdc
, INT mode
)
23 if ((mode
<= 0) || (mode
> BKMODE_LAST
))
25 SetLastError(ERROR_INVALID_PARAMETER
);
28 if (!(dc
= DC_GetDCPtr( hdc
))) return 0;
29 if (dc
->funcs
->pSetBkMode
)
30 ret
= dc
->funcs
->pSetBkMode( dc
, mode
);
33 ret
= dc
->backgroundMode
;
34 dc
->backgroundMode
= mode
;
36 GDI_ReleaseObj( hdc
);
41 /***********************************************************************
44 INT WINAPI
SetROP2( HDC hdc
, INT mode
)
48 if ((mode
< R2_BLACK
) || (mode
> R2_WHITE
))
50 SetLastError(ERROR_INVALID_PARAMETER
);
53 if (!(dc
= DC_GetDCPtr( hdc
))) return 0;
54 if (dc
->funcs
->pSetROP2
)
55 ret
= dc
->funcs
->pSetROP2( dc
, mode
);
61 GDI_ReleaseObj( hdc
);
66 /***********************************************************************
69 INT WINAPI
SetRelAbs( HDC hdc
, INT mode
)
73 if ((mode
!= ABSOLUTE
) && (mode
!= RELATIVE
))
75 SetLastError(ERROR_INVALID_PARAMETER
);
78 if (!(dc
= DC_GetDCPtr( hdc
))) return 0;
79 if (dc
->funcs
->pSetRelAbs
)
80 ret
= dc
->funcs
->pSetRelAbs( dc
, mode
);
84 dc
->relAbsMode
= mode
;
86 GDI_ReleaseObj( hdc
);
91 /***********************************************************************
92 * SetPolyFillMode (GDI32.@)
94 INT WINAPI
SetPolyFillMode( HDC hdc
, INT mode
)
98 if ((mode
<= 0) || (mode
> POLYFILL_LAST
))
100 SetLastError(ERROR_INVALID_PARAMETER
);
103 if (!(dc
= DC_GetDCPtr( hdc
))) return 0;
104 if (dc
->funcs
->pSetPolyFillMode
)
105 ret
= dc
->funcs
->pSetPolyFillMode( dc
, mode
);
108 ret
= dc
->polyFillMode
;
109 dc
->polyFillMode
= mode
;
111 GDI_ReleaseObj( hdc
);
116 /***********************************************************************
117 * SetStretchBltMode (GDI32.@)
119 INT WINAPI
SetStretchBltMode( HDC hdc
, INT mode
)
123 if ((mode
<= 0) || (mode
> MAXSTRETCHBLTMODE
))
125 SetLastError(ERROR_INVALID_PARAMETER
);
128 if (!(dc
= DC_GetDCPtr( hdc
))) return 0;
129 if (dc
->funcs
->pSetStretchBltMode
)
130 ret
= dc
->funcs
->pSetStretchBltMode( dc
, mode
);
133 ret
= dc
->stretchBltMode
;
134 dc
->stretchBltMode
= mode
;
136 GDI_ReleaseObj( hdc
);
141 /***********************************************************************
142 * GetBkColor (GDI32.@)
144 COLORREF WINAPI
GetBkColor( HDC hdc
)
147 DC
* dc
= DC_GetDCPtr( hdc
);
150 ret
= dc
->backgroundColor
;
151 GDI_ReleaseObj( hdc
);
157 /***********************************************************************
158 * GetBkMode (GDI32.@)
160 INT WINAPI
GetBkMode( HDC hdc
)
163 DC
* dc
= DC_GetDCPtr( hdc
);
166 ret
= dc
->backgroundMode
;
167 GDI_ReleaseObj( hdc
);
173 /***********************************************************************
174 * GetMapMode (GDI32.@)
176 INT WINAPI
GetMapMode( HDC hdc
)
179 DC
* dc
= DC_GetDCPtr( hdc
);
183 GDI_ReleaseObj( hdc
);
189 /***********************************************************************
190 * GetPolyFillMode (GDI32.@)
192 INT WINAPI
GetPolyFillMode( HDC hdc
)
195 DC
* dc
= DC_GetDCPtr( hdc
);
198 ret
= dc
->polyFillMode
;
199 GDI_ReleaseObj( hdc
);
205 /***********************************************************************
208 INT WINAPI
GetROP2( HDC hdc
)
211 DC
* dc
= DC_GetDCPtr( hdc
);
215 GDI_ReleaseObj( hdc
);
221 /***********************************************************************
222 * GetStretchBltMode (GDI32.@)
224 INT WINAPI
GetStretchBltMode( HDC hdc
)
227 DC
* dc
= DC_GetDCPtr( hdc
);
230 ret
= dc
->stretchBltMode
;
231 GDI_ReleaseObj( hdc
);
237 /***********************************************************************
238 * GetTextColor (GDI32.@)
240 COLORREF WINAPI
GetTextColor( HDC hdc
)
243 DC
* dc
= DC_GetDCPtr( hdc
);
247 GDI_ReleaseObj( hdc
);
253 /***********************************************************************
254 * GetTextAlign (GDI32.@)
256 UINT WINAPI
GetTextAlign( HDC hdc
)
259 DC
* dc
= DC_GetDCPtr( hdc
);
263 GDI_ReleaseObj( hdc
);
269 /***********************************************************************
270 * GetArcDirection (GDI32.@)
272 INT WINAPI
GetArcDirection( HDC hdc
)
275 DC
* dc
= DC_GetDCPtr( hdc
);
278 ret
= dc
->ArcDirection
;
279 GDI_ReleaseObj( hdc
);
285 /***********************************************************************
286 * GetGraphicsMode (GDI32.@)
288 INT WINAPI
GetGraphicsMode( HDC hdc
)
291 DC
* dc
= DC_GetDCPtr( hdc
);
294 ret
= dc
->GraphicsMode
;
295 GDI_ReleaseObj( hdc
);
301 /***********************************************************************
302 * GetBrushOrgEx (GDI32.@)
304 BOOL WINAPI
GetBrushOrgEx( HDC hdc
, LPPOINT pt
)
306 DC
* dc
= DC_GetDCPtr( hdc
);
307 if (!dc
) return FALSE
;
308 pt
->x
= dc
->brushOrgX
;
309 pt
->y
= dc
->brushOrgY
;
310 GDI_ReleaseObj( hdc
);
315 /***********************************************************************
316 * GetCurrentPositionEx (GDI32.@)
318 BOOL WINAPI
GetCurrentPositionEx( HDC hdc
, LPPOINT pt
)
320 DC
* dc
= DC_GetDCPtr( hdc
);
321 if (!dc
) return FALSE
;
322 pt
->x
= dc
->CursPosX
;
323 pt
->y
= dc
->CursPosY
;
324 GDI_ReleaseObj( hdc
);
329 /***********************************************************************
330 * GetViewportExtEx (GDI32.@)
332 BOOL WINAPI
GetViewportExtEx( HDC hdc
, LPSIZE size
)
334 DC
* dc
= DC_GetDCPtr( hdc
);
335 if (!dc
) return FALSE
;
336 size
->cx
= dc
->vportExtX
;
337 size
->cy
= dc
->vportExtY
;
338 GDI_ReleaseObj( hdc
);
343 /***********************************************************************
344 * GetViewportOrgEx (GDI32.@)
346 BOOL WINAPI
GetViewportOrgEx( HDC hdc
, LPPOINT pt
)
348 DC
* dc
= DC_GetDCPtr( hdc
);
349 if (!dc
) return FALSE
;
350 pt
->x
= dc
->vportOrgX
;
351 pt
->y
= dc
->vportOrgY
;
352 GDI_ReleaseObj( hdc
);
357 /***********************************************************************
358 * GetWindowExtEx (GDI32.@)
360 BOOL WINAPI
GetWindowExtEx( HDC hdc
, LPSIZE size
)
362 DC
* dc
= DC_GetDCPtr( hdc
);
363 if (!dc
) return FALSE
;
364 size
->cx
= dc
->wndExtX
;
365 size
->cy
= dc
->wndExtY
;
366 GDI_ReleaseObj( hdc
);
371 /***********************************************************************
372 * GetWindowOrgEx (GDI32.@)
374 BOOL WINAPI
GetWindowOrgEx( HDC hdc
, LPPOINT pt
)
376 DC
* dc
= DC_GetDCPtr( hdc
);
377 if (!dc
) return FALSE
;
380 GDI_ReleaseObj( hdc
);
385 /**** 16-bit functions ****/
388 /***********************************************************************
391 INT16 WINAPI
SetBkMode16( HDC16 hdc
, INT16 mode
)
393 return SetBkMode( hdc
, mode
);
396 /***********************************************************************
399 INT16 WINAPI
SetROP216( HDC16 hdc
, INT16 mode
)
401 return SetROP2( hdc
, mode
);
404 /***********************************************************************
407 INT16 WINAPI
SetRelAbs16( HDC16 hdc
, INT16 mode
)
409 return SetRelAbs( hdc
, mode
);
412 /***********************************************************************
413 * SetPolyFillMode (GDI.6)
415 INT16 WINAPI
SetPolyFillMode16( HDC16 hdc
, INT16 mode
)
417 return SetPolyFillMode( hdc
, mode
);
420 /***********************************************************************
421 * SetStretchBltMode (GDI.7)
423 INT16 WINAPI
SetStretchBltMode16( HDC16 hdc
, INT16 mode
)
425 return SetStretchBltMode( hdc
, mode
);
428 /***********************************************************************
429 * GetBkColor (GDI.75)
431 COLORREF WINAPI
GetBkColor16( HDC16 hdc
)
433 return GetBkColor( hdc
);
436 /***********************************************************************
439 INT16 WINAPI
GetBkMode16( HDC16 hdc
)
441 return GetBkMode( hdc
);
444 /***********************************************************************
445 * GetCurrentPosition (GDI.78)
447 DWORD WINAPI
GetCurrentPosition16( HDC16 hdc
)
450 if (!GetCurrentPositionEx( hdc
, &pt32
)) return 0;
451 return MAKELONG( pt32
.x
, pt32
.y
);
454 /***********************************************************************
455 * GetMapMode (GDI.81)
457 INT16 WINAPI
GetMapMode16( HDC16 hdc
)
459 return GetMapMode( hdc
);
462 /***********************************************************************
463 * GetPolyFillMode (GDI.84)
465 INT16 WINAPI
GetPolyFillMode16( HDC16 hdc
)
467 return GetPolyFillMode( hdc
);
470 /***********************************************************************
473 INT16 WINAPI
GetROP216( HDC16 hdc
)
475 return GetROP2( hdc
);
478 /***********************************************************************
481 INT16 WINAPI
GetRelAbs16( HDC16 hdc
)
483 return GetRelAbs( hdc
, 0 );
486 /***********************************************************************
487 * GetStretchBltMode (GDI.88)
489 INT16 WINAPI
GetStretchBltMode16( HDC16 hdc
)
491 return GetStretchBltMode( hdc
);
494 /***********************************************************************
495 * GetTextColor (GDI.90)
497 COLORREF WINAPI
GetTextColor16( HDC16 hdc
)
499 return GetTextColor( hdc
);
502 /***********************************************************************
503 * GetViewportExt (GDI.94)
505 DWORD WINAPI
GetViewportExt16( HDC16 hdc
)
508 if (!GetViewportExtEx( hdc
, &size
)) return 0;
509 return MAKELONG( size
.cx
, size
.cy
);
512 /***********************************************************************
513 * GetViewportOrg (GDI.95)
515 DWORD WINAPI
GetViewportOrg16( HDC16 hdc
)
518 if (!GetViewportOrgEx( hdc
, &pt
)) return 0;
519 return MAKELONG( pt
.x
, pt
.y
);
523 /***********************************************************************
524 * GetWindowExt (GDI.96)
526 DWORD WINAPI
GetWindowExt16( HDC16 hdc
)
529 if (!GetWindowExtEx( hdc
, &size
)) return 0;
530 return MAKELONG( size
.cx
, size
.cy
);
533 /***********************************************************************
534 * GetWindowOrg (GDI.97)
536 DWORD WINAPI
GetWindowOrg16( HDC16 hdc
)
539 if (!GetWindowOrgEx( hdc
, &pt
)) return 0;
540 return MAKELONG( pt
.x
, pt
.y
);
543 /***********************************************************************
544 * InquireVisRgn (GDI.131)
546 HRGN16 WINAPI
InquireVisRgn16( HDC16 hdc
)
549 DC
* dc
= DC_GetDCPtr( hdc
);
553 GDI_ReleaseObj( hdc
);
558 /***********************************************************************
559 * GetBrushOrg (GDI.149)
561 DWORD WINAPI
GetBrushOrg16( HDC16 hdc
)
564 if (!GetBrushOrgEx( hdc
, &pt
)) return 0;
565 return MAKELONG( pt
.x
, pt
.y
);
568 /***********************************************************************
569 * GetClipRgn (GDI.173)
571 HRGN16 WINAPI
GetClipRgn16( HDC16 hdc
)
574 DC
* dc
= DC_GetDCPtr( hdc
);
578 GDI_ReleaseObj( hdc
);
583 /***********************************************************************
584 * GetTextAlign (GDI.345)
586 UINT16 WINAPI
GetTextAlign16( HDC16 hdc
)
588 return GetTextAlign( hdc
);
591 /***********************************************************************
592 * GetCurLogFont (GDI.411)
594 HFONT16 WINAPI
GetCurLogFont16( HDC16 hdc
)
597 DC
* dc
= DC_GetDCPtr( hdc
);
601 GDI_ReleaseObj( hdc
);
606 /***********************************************************************
607 * GetBrushOrgEx (GDI.469)
609 BOOL16 WINAPI
GetBrushOrgEx16( HDC16 hdc
, LPPOINT16 pt
)
612 if (!GetBrushOrgEx( hdc
, &pt32
)) return FALSE
;
618 /***********************************************************************
619 * GetCurrentPositionEx (GDI.470)
621 BOOL16 WINAPI
GetCurrentPositionEx16( HDC16 hdc
, LPPOINT16 pt
)
624 if (!GetCurrentPositionEx( hdc
, &pt32
)) return FALSE
;
630 /***********************************************************************
631 * GetViewportExtEx (GDI.472)
633 BOOL16 WINAPI
GetViewportExtEx16( HDC16 hdc
, LPSIZE16 size
)
636 if (!GetViewportExtEx( hdc
, &size32
)) return FALSE
;
637 size
->cx
= size32
.cx
;
638 size
->cy
= size32
.cy
;
642 /***********************************************************************
643 * GetViewportOrgEx (GDI.473)
645 BOOL16 WINAPI
GetViewportOrgEx16( HDC16 hdc
, LPPOINT16 pt
)
648 if (!GetViewportOrgEx( hdc
, &pt32
)) return FALSE
;
654 /***********************************************************************
655 * GetWindowExtEx (GDI.474)
657 BOOL16 WINAPI
GetWindowExtEx16( HDC16 hdc
, LPSIZE16 size
)
660 if (!GetWindowExtEx( hdc
, &size32
)) return FALSE
;
661 size
->cx
= size32
.cx
;
662 size
->cy
= size32
.cy
;
666 /***********************************************************************
667 * GetWindowOrgEx (GDI.475)
669 BOOL16 WINAPI
GetWindowOrgEx16( HDC16 hdc
, LPPOINT16 pt
)
672 if (!GetWindowOrgEx( hdc
, &pt32
)) return FALSE
;
678 /***********************************************************************
679 * GetArcDirection (GDI.524)
681 INT16 WINAPI
GetArcDirection16( HDC16 hdc
)
683 return GetArcDirection( hdc
);