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 ****/
401 /***********************************************************************
404 INT16 WINAPI
SetBkMode16( HDC16 hdc
, INT16 mode
)
406 return SetBkMode( hdc
, mode
);
409 /***********************************************************************
412 INT16 WINAPI
SetROP216( HDC16 hdc
, INT16 mode
)
414 return SetROP2( hdc
, mode
);
417 /***********************************************************************
420 INT16 WINAPI
SetRelAbs16( HDC16 hdc
, INT16 mode
)
422 return SetRelAbs( hdc
, mode
);
425 /***********************************************************************
426 * SetPolyFillMode (GDI.6)
428 INT16 WINAPI
SetPolyFillMode16( HDC16 hdc
, INT16 mode
)
430 return SetPolyFillMode( hdc
, mode
);
433 /***********************************************************************
434 * SetStretchBltMode (GDI.7)
436 INT16 WINAPI
SetStretchBltMode16( HDC16 hdc
, INT16 mode
)
438 return SetStretchBltMode( hdc
, mode
);
441 /***********************************************************************
442 * GetBkColor (GDI.75)
444 COLORREF WINAPI
GetBkColor16( HDC16 hdc
)
446 return GetBkColor( hdc
);
449 /***********************************************************************
452 INT16 WINAPI
GetBkMode16( HDC16 hdc
)
454 return GetBkMode( hdc
);
457 /***********************************************************************
458 * GetCurrentPosition (GDI.78)
460 DWORD WINAPI
GetCurrentPosition16( HDC16 hdc
)
463 if (!GetCurrentPositionEx( hdc
, &pt32
)) return 0;
464 return MAKELONG( pt32
.x
, pt32
.y
);
467 /***********************************************************************
468 * GetMapMode (GDI.81)
470 INT16 WINAPI
GetMapMode16( HDC16 hdc
)
472 return GetMapMode( hdc
);
475 /***********************************************************************
476 * GetPolyFillMode (GDI.84)
478 INT16 WINAPI
GetPolyFillMode16( HDC16 hdc
)
480 return GetPolyFillMode( hdc
);
483 /***********************************************************************
486 INT16 WINAPI
GetROP216( HDC16 hdc
)
488 return GetROP2( hdc
);
491 /***********************************************************************
494 INT16 WINAPI
GetRelAbs16( HDC16 hdc
)
496 return GetRelAbs( hdc
, 0 );
499 /***********************************************************************
500 * GetStretchBltMode (GDI.88)
502 INT16 WINAPI
GetStretchBltMode16( HDC16 hdc
)
504 return GetStretchBltMode( hdc
);
507 /***********************************************************************
508 * GetTextColor (GDI.90)
510 COLORREF WINAPI
GetTextColor16( HDC16 hdc
)
512 return GetTextColor( hdc
);
515 /***********************************************************************
516 * GetViewportExt (GDI.94)
518 DWORD WINAPI
GetViewportExt16( HDC16 hdc
)
521 if (!GetViewportExtEx( hdc
, &size
)) return 0;
522 return MAKELONG( size
.cx
, size
.cy
);
525 /***********************************************************************
526 * GetViewportOrg (GDI.95)
528 DWORD WINAPI
GetViewportOrg16( HDC16 hdc
)
531 if (!GetViewportOrgEx( hdc
, &pt
)) return 0;
532 return MAKELONG( pt
.x
, pt
.y
);
536 /***********************************************************************
537 * GetWindowExt (GDI.96)
539 DWORD WINAPI
GetWindowExt16( HDC16 hdc
)
542 if (!GetWindowExtEx( hdc
, &size
)) return 0;
543 return MAKELONG( size
.cx
, size
.cy
);
546 /***********************************************************************
547 * GetWindowOrg (GDI.97)
549 DWORD WINAPI
GetWindowOrg16( HDC16 hdc
)
552 if (!GetWindowOrgEx( hdc
, &pt
)) return 0;
553 return MAKELONG( pt
.x
, pt
.y
);
556 /***********************************************************************
557 * InquireVisRgn (GDI.131)
559 HRGN16 WINAPI
InquireVisRgn16( HDC16 hdc
)
562 DC
* dc
= DC_GetDCPtr( hdc
);
566 GDI_ReleaseObj( hdc
);
571 /***********************************************************************
572 * GetBrushOrg (GDI.149)
574 DWORD WINAPI
GetBrushOrg16( HDC16 hdc
)
577 if (!GetBrushOrgEx( hdc
, &pt
)) return 0;
578 return MAKELONG( pt
.x
, pt
.y
);
581 /***********************************************************************
582 * GetClipRgn (GDI.173)
584 HRGN16 WINAPI
GetClipRgn16( HDC16 hdc
)
587 DC
* dc
= DC_GetDCPtr( hdc
);
591 GDI_ReleaseObj( hdc
);
596 /***********************************************************************
597 * GetTextAlign (GDI.345)
599 UINT16 WINAPI
GetTextAlign16( HDC16 hdc
)
601 return GetTextAlign( hdc
);
604 /***********************************************************************
605 * GetCurLogFont (GDI.411)
607 HFONT16 WINAPI
GetCurLogFont16( HDC16 hdc
)
610 DC
* dc
= DC_GetDCPtr( hdc
);
614 GDI_ReleaseObj( hdc
);
619 /***********************************************************************
620 * GetBrushOrgEx (GDI.469)
622 BOOL16 WINAPI
GetBrushOrgEx16( HDC16 hdc
, LPPOINT16 pt
)
625 if (!GetBrushOrgEx( hdc
, &pt32
)) return FALSE
;
631 /***********************************************************************
632 * GetCurrentPositionEx (GDI.470)
634 BOOL16 WINAPI
GetCurrentPositionEx16( HDC16 hdc
, LPPOINT16 pt
)
637 if (!GetCurrentPositionEx( hdc
, &pt32
)) return FALSE
;
643 /***********************************************************************
644 * GetViewportExtEx (GDI.472)
646 BOOL16 WINAPI
GetViewportExtEx16( HDC16 hdc
, LPSIZE16 size
)
649 if (!GetViewportExtEx( hdc
, &size32
)) return FALSE
;
650 size
->cx
= size32
.cx
;
651 size
->cy
= size32
.cy
;
655 /***********************************************************************
656 * GetViewportOrgEx (GDI.473)
658 BOOL16 WINAPI
GetViewportOrgEx16( HDC16 hdc
, LPPOINT16 pt
)
661 if (!GetViewportOrgEx( hdc
, &pt32
)) return FALSE
;
667 /***********************************************************************
668 * GetWindowExtEx (GDI.474)
670 BOOL16 WINAPI
GetWindowExtEx16( HDC16 hdc
, LPSIZE16 size
)
673 if (!GetWindowExtEx( hdc
, &size32
)) return FALSE
;
674 size
->cx
= size32
.cx
;
675 size
->cy
= size32
.cy
;
679 /***********************************************************************
680 * GetWindowOrgEx (GDI.475)
682 BOOL16 WINAPI
GetWindowOrgEx16( HDC16 hdc
, LPPOINT16 pt
)
685 if (!GetWindowOrgEx( hdc
, &pt32
)) return FALSE
;
691 /***********************************************************************
692 * GetArcDirection (GDI.524)
694 INT16 WINAPI
GetArcDirection16( HDC16 hdc
)
696 return GetArcDirection( hdc
);