source: trunk/src/gdi32/gdi32.cpp@ 10374

Last change on this file since 10374 was 10374, checked in by sandervl, 22 years ago

Update

File size: 38.1 KB
Line 
1/* $Id: gdi32.cpp,v 1.91 2004-01-11 11:42:15 sandervl Exp $ */
2
3/*
4 * GDI32 apis
5 *
6 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
7 * Copyright 1998 Patrick Haller
8 *
9 * Project Odin Software License can be found in LICENSE.TXT
10 *
11 */
12#include <os2win.h>
13#include <stdlib.h>
14#include <stdarg.h>
15#include <string.h>
16#include <odinwrap.h>
17#include <misc.h>
18#include "callback.h"
19#include "unicode.h"
20#include "dibsect.h"
21#include <codepage.h>
22#include "oslibgpi.h"
23#include "oslibgdi.h"
24#include <dcdata.h>
25#include <winuser32.h>
26#include "font.h"
27#include <stats.h>
28#include <objhandle.h>
29#include <winspool.h>
30
31#define DBG_LOCALLOG DBG_gdi32
32#include "dbglocal.h"
33
34ODINDEBUGCHANNEL(GDI32-GDI32)
35
36//******************************************************************************
37//******************************************************************************
38BOOL WIN32API GdiFlush()
39{
40 //NOP: DIB synchronization is done using exceptions
41 return TRUE;
42}
43//******************************************************************************
44//******************************************************************************
45int WIN32API FillRect(HDC hDC, const RECT * lprc, HBRUSH hbr)
46{
47 int ret;
48
49 //SvL: brush 0 means current selected brush (verified in NT4)
50 if(hbr == 0) {
51 hbr = GetCurrentObject(hDC, OBJ_BRUSH);
52 }
53 else
54 if (hbr <= (HBRUSH) (COLOR_MAX + 1)) {
55 hbr = GetSysColorBrush( (INT) hbr - 1 );
56 }
57 dprintf(("USER32: FillRect %x (%d,%d)(%d,%d) brush %X", hDC, lprc->left, lprc->top, lprc->right, lprc->bottom, hbr));
58 DIBSECTION_CHECK_IF_DIRTY(hDC);
59 ret = O32_FillRect(hDC,lprc,hbr);
60 DIBSECTION_MARK_INVALID(hDC);
61 return ret;
62}
63//******************************************************************************
64//******************************************************************************
65int WIN32API FrameRect( HDC hDC, const RECT * lprc, HBRUSH hbr)
66{
67 int ret;
68
69 dprintf(("USER32: FrameRect %x (%d,%d)(%d,%d) brush %x", hDC, lprc->top, lprc->left, lprc->bottom, lprc->right, hbr));
70 DIBSECTION_CHECK_IF_DIRTY(hDC);
71 ret = O32_FrameRect(hDC,lprc,hbr);
72 DIBSECTION_MARK_INVALID(hDC);
73 return ret;
74}
75//******************************************************************************
76//******************************************************************************
77BOOL WIN32API InvertRect( HDC hDC, const RECT * lprc)
78{
79 int ret;
80
81 if(lprc) {
82 dprintf(("USER32: InvertRect %x (%d,%d)(%d,%d)", hDC, lprc->left, lprc->top, lprc->right, lprc->bottom));
83 }
84 else dprintf(("USER32: InvertRect %x NULL", hDC));
85 DIBSECTION_CHECK_IF_DIRTY(hDC);
86 ret = O32_InvertRect(hDC,lprc);
87 DIBSECTION_MARK_INVALID(hDC);
88 return ret;
89}
90//******************************************************************************
91//******************************************************************************
92BOOL WIN32API StrokeAndFillPath(HDC hdc)
93{
94 DIBSECTION_CHECK_IF_DIRTY(hdc);
95 BOOL ret = O32_StrokeAndFillPath(hdc);
96 DIBSECTION_MARK_INVALID(hdc);
97 return ret;
98}
99//******************************************************************************
100//******************************************************************************
101BOOL WIN32API StrokePath(HDC hdc)
102{
103 DIBSECTION_CHECK_IF_DIRTY(hdc);
104 BOOL ret = O32_StrokePath(hdc);
105 DIBSECTION_MARK_INVALID(hdc);
106 return ret;
107}
108//******************************************************************************
109//******************************************************************************
110COLORREF WIN32API SetBkColor(HDC hdc, COLORREF crColor)
111{
112 return(O32_SetBkColor(hdc, crColor));
113}
114//******************************************************************************
115//******************************************************************************
116COLORREF WIN32API SetTextColor(HDC hdc, COLORREF crColor)
117{
118 return O32_SetTextColor(hdc, crColor);
119}
120//******************************************************************************
121//******************************************************************************
122HGDIOBJ WIN32API GetStockObject(int arg1)
123{
124 HGDIOBJ obj;
125
126 switch(arg1)
127 {
128 case DEFAULT_GUI_FONT:
129 if(NULL==hFntDefaultGui) {
130 hFntDefaultGui = CreateFontA( -9, 0, 0, 0, FW_MEDIUM, FALSE,
131 FALSE, FALSE, ANSI_CHARSET,
132 OUT_DEFAULT_PRECIS,
133 CLIP_DEFAULT_PRECIS,
134 DEFAULT_QUALITY,
135 FIXED_PITCH|FF_MODERN, "WarpSans");
136 //This object can't be deleted by applications
137 ObjSetHandleFlag(hFntDefaultGui, OBJHANDLE_FLAG_NODELETE, TRUE);
138 }
139 obj = hFntDefaultGui;
140 break;
141 default:
142 obj = O32_GetStockObject(arg1);
143 break;
144 }
145 return(obj);
146}
147//******************************************************************************
148//******************************************************************************
149HPEN WIN32API CreatePen(int fnPenStyle, int nWidth, COLORREF crColor)
150{
151 HPEN hPen;
152
153 //CB: todo: PS_DOT is different in Win32 (. . . . and not - - - -)
154 // Open32 looks like LINETYPE_SHORTDASH instead of LINETYPE_DOT!!!
155 // -> difficult to fix without performance decrease!
156
157 hPen = O32_CreatePen(fnPenStyle,nWidth,crColor);
158 if(hPen) STATS_CreatePen(hPen, fnPenStyle,nWidth,crColor);
159 return hPen;
160}
161//******************************************************************************
162//******************************************************************************
163HPEN WIN32API CreatePenIndirect(const LOGPEN * lplgpn)
164{
165 HPEN hPen;
166
167 hPen = O32_CreatePenIndirect(lplgpn);
168 if(hPen) STATS_CreatePenIndirect(hPen, lplgpn);
169 return hPen;
170}
171//******************************************************************************
172//******************************************************************************
173HPEN WIN32API ExtCreatePen(DWORD dwPenStyle, DWORD dwWidth, const LOGBRUSH *lplb,
174 DWORD dwStyleCount, const DWORD *lpStyle)
175{
176 HPEN hPen;
177
178 hPen = O32_ExtCreatePen(dwPenStyle, dwWidth, lplb, dwStyleCount, lpStyle);
179 if(hPen) STATS_ExtCreatePen(hPen, dwPenStyle, dwWidth, lplb, dwStyleCount, lpStyle);
180 return hPen;
181}
182//******************************************************************************
183//******************************************************************************
184HBRUSH WIN32API CreatePatternBrush(HBITMAP hBitmap)
185{
186 HBRUSH hBrush;
187
188 hBrush = O32_CreatePatternBrush(hBitmap);
189 if(hBrush) STATS_CreatePatternBrush(hBrush, hBitmap);
190 return(hBrush);
191}
192//******************************************************************************
193//******************************************************************************
194HBRUSH WIN32API CreateSolidBrush(COLORREF color)
195{
196 HBRUSH hBrush;
197
198 hBrush = O32_CreateSolidBrush(color);
199 if(hBrush) STATS_CreateSolidBrush(hBrush, color);
200 return(hBrush);
201}
202//******************************************************************************
203//******************************************************************************
204HBRUSH WIN32API CreateBrushIndirect( const LOGBRUSH *pLogBrush)
205{
206 HBRUSH hBrush;
207
208 hBrush = O32_CreateBrushIndirect((LPLOGBRUSH)pLogBrush);
209 dprintf(("GDI32: CreateBrushIndirect %x %x %x returned %x", pLogBrush->lbStyle, pLogBrush->lbColor, pLogBrush->lbHatch, hBrush));
210 if(hBrush) STATS_CreateBrushIndirect(hBrush, (LPLOGBRUSH)pLogBrush);
211 return hBrush;
212}
213//******************************************************************************
214//******************************************************************************
215HBRUSH WIN32API CreateHatchBrush(int fnStyle, COLORREF clrref)
216{
217 HBRUSH hBrush;
218
219 hBrush = O32_CreateHatchBrush(fnStyle, clrref);
220 if(hBrush) STATS_CreateHatchBrush(hBrush, fnStyle, clrref);
221 return hBrush;
222}
223//******************************************************************************
224//******************************************************************************
225HBRUSH WIN32API CreateDIBPatternBrushPt( const VOID * buffer, UINT usage)
226{
227 HBRUSH hBrush;
228
229 hBrush = O32_CreateDIBPatternBrushPt(buffer, usage);
230 if(hBrush) STATS_CreateDIBPatternBrushPt(hBrush, buffer, usage);
231 return hBrush;
232}
233/*****************************************************************************
234 * Name : HBRUSH CreateDIBPatternBrush
235 * Purpose : The CreateDIBPatternBrush function creates a logical brush that
236 * has the pattern specified by the specified device-independent
237 * bitmap (DIB). The brush can subsequently be selected into any
238 * device context that is associated with a device that supports
239 * raster operations.
240 *
241 * This function is provided only for compatibility with applications
242 * written for versions of Windows earlier than 3.0. For Win32-based
243 * applications, use the CreateDIBPatternBrushPt function.
244 * Parameters: HGLOBAL hglbDIBPacked Identifies a global memory object containing
245 * a packed DIB, which consists of a BITMAPINFO structure immediately
246 * followed by an array of bytes defining the pixels of the bitmap.
247 * UINT fuColorSpec color table data
248 * Variables :
249 * Result : TRUE / FALSE
250 * Remark :
251 * Status : ODIN32 COMPLETELY UNTESTED
252 *
253 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
254 * Markus Montkowski [Wen, 1999/01/12 20:00]
255 *****************************************************************************/
256
257HBRUSH WIN32API CreateDIBPatternBrush( HGLOBAL hglbDIBPacked,
258 UINT fuColorSpec)
259{
260 BITMAPINFO *lpMem;
261 HBRUSH ret = 0;
262
263 lpMem = (BITMAPINFO *)GlobalLock(hglbDIBPacked);
264 if(NULL!=lpMem)
265 {
266 dprintf(("GDI32: CreateDIBPatternBrush (%08xh, %08xh) %x (%d,%d) bpp %d",
267 hglbDIBPacked, fuColorSpec, lpMem, lpMem->bmiHeader.biWidth,
268 lpMem->bmiHeader.biHeight, lpMem->bmiHeader.biBitCount));
269
270 ret = CreateDIBPatternBrushPt( lpMem,
271 fuColorSpec);
272 GlobalUnlock(hglbDIBPacked);
273 }
274 else {
275 dprintf(("!ERROR!: CreateDIBPatternBrush (%08xh, %08xh) -> INVALID memory handle!!",
276 hglbDIBPacked, fuColorSpec));
277 }
278 return (ret);
279}
280//******************************************************************************
281//******************************************************************************
282int WIN32API SetBkMode( HDC hdc, int mode)
283{
284 return O32_SetBkMode(hdc, mode);
285}
286//******************************************************************************
287//******************************************************************************
288COLORREF WIN32API GetPixel( HDC hdc, int x, int y)
289{
290 return O32_GetPixel(hdc, x, y);
291}
292//******************************************************************************
293//******************************************************************************
294COLORREF WIN32API SetPixel( HDC hdc, int x, int y, COLORREF color)
295{
296 return O32_SetPixel(hdc, x, y, color);
297}
298//******************************************************************************
299//Faster version of SetPixel (since it doesn't need to return the original color)
300//Just use SetPixel for now
301//******************************************************************************
302BOOL WIN32API SetPixelV(HDC arg1, int arg2, int arg3, COLORREF arg4)
303{
304 COLORREF rc;
305
306 rc = O32_SetPixel(arg1, arg2, arg3, arg4);
307 if(rc == GDI_ERROR) // || rc == COLOR_INVALID)
308 return(FALSE);
309 return(TRUE);
310}
311//******************************************************************************
312//******************************************************************************
313BOOL WIN32API GetDCOrgEx(HDC hdc, PPOINT lpPoint)
314{
315 if(lpPoint == NULL) {
316 dprintf(("WARNING: GDI32: GetDCOrgEx %x NULL", hdc));
317 return FALSE;
318 }
319 return O32_GetDCOrgEx(hdc, lpPoint);
320}
321//******************************************************************************
322//******************************************************************************
323BOOL WIN32API AbortPath(HDC hdc)
324{
325 return O32_AbortPath(hdc);
326}
327//******************************************************************************
328//******************************************************************************
329BOOL WIN32API AngleArc( HDC arg1, int arg2, int arg3, DWORD arg4, float arg5, float arg6)
330{
331 return O32_AngleArc(arg1, arg2, arg3, arg4, arg5, arg6);
332}
333//******************************************************************************
334//******************************************************************************
335BOOL WIN32API Arc( HDC arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9)
336{
337 return O32_Arc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
338}
339//******************************************************************************
340//******************************************************************************
341BOOL WIN32API ArcTo( HDC arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9)
342{
343 return O32_ArcTo(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
344}
345//******************************************************************************
346//******************************************************************************
347BOOL WIN32API BeginPath(HDC hdc)
348{
349 return O32_BeginPath(hdc);
350}
351//******************************************************************************
352//******************************************************************************
353BOOL WIN32API Chord( HDC arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9)
354{
355 return O32_Chord(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
356}
357//******************************************************************************
358//******************************************************************************
359BOOL WIN32API CloseFigure(HDC hdc)
360{
361 return O32_CloseFigure(hdc);
362}
363//******************************************************************************
364//******************************************************************************
365BOOL WIN32API Ellipse(HDC hdc, int nLeftRect, int nTopRect, int nRightRect,
366 int nBottomRect)
367{
368 dprintf(("GDI32: Ellipse %x (%d,%d)(%d,%d)", nLeftRect, nTopRect, nRightRect, nBottomRect));
369 return O32_Ellipse(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect);
370}
371//******************************************************************************
372//******************************************************************************
373BOOL WIN32API EndPath( HDC hdc)
374{
375 return O32_EndPath(hdc);
376}
377//******************************************************************************
378//******************************************************************************
379BOOL WIN32API Rectangle(HDC hdc, int left, int top, int right, int bottom)
380{
381 return O32_Rectangle(hdc, left, top, right, bottom);
382}
383//******************************************************************************
384//******************************************************************************
385#ifdef DEBUG
386VOID dumpROP2(INT rop2)
387{
388 CHAR *name;
389
390 switch (rop2)
391 {
392 case R2_BLACK:
393 name = "R2_BLACK";
394 break;
395
396 case R2_COPYPEN:
397 name = "R2_COPYPEN";
398 break;
399
400 case R2_MASKNOTPEN:
401 name = "R2_MASKNOTPEN";
402 break;
403
404 case R2_MASKPEN:
405 name = "R2_MASKPEN";
406 break;
407
408 case R2_MASKPENNOT:
409 name = "R2_MASKPENNOT";
410 break;
411
412 case R2_MERGENOTPEN:
413 name = "R2_MERGENOTPEN";
414 break;
415
416 case R2_MERGEPEN:
417 name = "R2_MERGEPEN";
418 break;
419
420 case R2_MERGEPENNOT:
421 name = "R2_MERGEPENNOT";
422 break;
423
424 case R2_NOP:
425 name = "R2_NOP";
426 break;
427
428 case R2_NOT:
429 name = "R2_NOT";
430 break;
431
432 case R2_NOTCOPYPEN:
433 name = "R2_NOTCOPYPEN";
434 break;
435
436 case R2_NOTMASKPEN:
437 name = "R2_NOTMASKPEN";
438 break;
439
440 case R2_NOTMERGEPEN:
441 name = "R2_NOTMERGEPEN";
442 break;
443
444 case R2_WHITE:
445 name = "R2_WHITE";
446 break;
447
448 case R2_XORPEN:
449 name = "R2_XORPEN";
450 break;
451
452 case R2_NOTXORPEN:
453 name = "R2_NOTXORPEN";
454 break;
455
456 default:
457 name = "unknown mode!!!";
458 break;
459 }
460
461 dprintf((" ROP2 mode = %s",name));
462}
463#endif
464//******************************************************************************
465//******************************************************************************
466int WIN32API SetROP2( HDC hdc, int rop2)
467{
468 #ifdef DEBUG
469 dumpROP2(rop2);
470 #endif
471 return O32_SetROP2(hdc, rop2);
472}
473//******************************************************************************
474//******************************************************************************
475BOOL WIN32API ExtFloodFill( HDC arg1, int arg2, int arg3, COLORREF arg4, UINT arg5)
476{
477 return O32_ExtFloodFill(arg1, arg2, arg3, arg4, arg5);
478}
479//******************************************************************************
480//******************************************************************************
481BOOL WIN32API FillPath( HDC arg1)
482{
483 return O32_FillPath(arg1);
484}
485//******************************************************************************
486//******************************************************************************
487BOOL WIN32API FlattenPath( HDC arg1)
488{
489 return O32_FlattenPath(arg1);
490}
491//******************************************************************************
492//******************************************************************************
493BOOL WIN32API FloodFill(HDC arg1, int arg2, int arg3, COLORREF arg4)
494{
495 return O32_FloodFill(arg1, arg2, arg3, arg4);
496}
497//******************************************************************************
498//******************************************************************************
499int WIN32API GetArcDirection( HDC arg1)
500{
501 return O32_GetArcDirection(arg1);
502}
503//******************************************************************************
504//******************************************************************************
505BOOL WIN32API GetAspectRatioFilterEx( HDC arg1, PSIZE arg2)
506{
507 return O32_GetAspectRatioFilterEx(arg1, arg2);
508}
509//******************************************************************************
510//******************************************************************************
511COLORREF WIN32API GetBkColor(HDC hdc)
512{
513 return O32_GetBkColor(hdc);
514}
515//******************************************************************************
516//******************************************************************************
517int WIN32API GetBkMode(HDC hdc)
518{
519 return O32_GetBkMode(hdc);
520}
521//******************************************************************************
522//******************************************************************************
523UINT WIN32API GetBoundsRect( HDC arg1, PRECT arg2, UINT arg3)
524{
525 return O32_GetBoundsRect(arg1, arg2, arg3);
526}
527//******************************************************************************
528//******************************************************************************
529BOOL WIN32API GetBrushOrgEx( HDC arg1, PPOINT arg2)
530{
531 return O32_GetBrushOrgEx(arg1, arg2);
532}
533//******************************************************************************
534//******************************************************************************
535BOOL WIN32API GetCurrentPositionEx( HDC hdc, PPOINT lpPoint)
536{
537 BOOL rc;
538
539 rc = O32_GetCurrentPositionEx(hdc, lpPoint);
540 dprintf(("GDI32: GetCurrentPositionEx returned %d (%d,%d)", rc, lpPoint->x, lpPoint->y));
541 return rc;
542}
543#ifdef DEBUG
544//******************************************************************************
545//******************************************************************************
546char *GetDeviceCapsString(int nIndex)
547{
548 switch(nIndex) {
549 case DRIVERVERSION:
550 return "DRIVERVERSION";
551 case TECHNOLOGY:
552 return "TECHNOLOGY";
553 case HORZSIZE:
554 return "HORZSIZE";
555 case VERTSIZE:
556 return "VERTSIZE";
557 case HORZRES:
558 return "HORZRES";
559 case VERTRES:
560 return "VERTRES";
561 case BITSPIXEL:
562 return "BITSPIXEL";
563 case PLANES:
564 return "PLANES";
565 case NUMBRUSHES:
566 return "NUMBRUSHES";
567 case NUMPENS:
568 return "NUMPENS";
569 case NUMMARKERS:
570 return "NUMMARKERS";
571 case NUMFONTS:
572 return "NUMFONTS";
573 case NUMCOLORS:
574 return "NUMCOLORS";
575 case PDEVICESIZE:
576 return "PDEVICESIZE";
577 case CURVECAPS:
578 return "CURVECAPS";
579 case LINECAPS:
580 return "LINECAPS";
581 case POLYGONALCAPS:
582 return "POLYGONALCAPS";
583 case TEXTCAPS:
584 return "TEXTCAPS";
585 case CLIPCAPS:
586 return "CLIPCAPS";
587 case RASTERCAPS:
588 return "RASTERCAPS";
589 case ASPECTX:
590 return "ASPECTX";
591 case ASPECTY:
592 return "ASPECTY";
593 case ASPECTXY:
594 return "ASPECTXY";
595 case LOGPIXELSX:
596 return "LOGPIXELSX";
597 case LOGPIXELSY:
598 return "LOGPIXELSY";
599 case SIZEPALETTE:
600 return "SIZEPALETTE";
601 case NUMRESERVED:
602 return "NUMRESERVED";
603 case COLORRES:
604 return "COLORRES";
605 case PHYSICALWIDTH:
606 return "PHYSICALWIDTH";
607 case PHYSICALHEIGHT:
608 return "PHYSICALHEIGHT";
609 case PHYSICALOFFSETX:
610 return "PHYSICALOFFSETX";
611 case PHYSICALOFFSETY:
612 return "PHYSICALOFFSETY";
613 case SCALINGFACTORX:
614 return "SCALINGFACTORX";
615 case SCALINGFACTORY:
616 return "SCALINGFACTORY";
617 }
618 return "unknown";
619}
620#endif
621//******************************************************************************
622//******************************************************************************
623int WIN32API GetDeviceCaps(HDC hdc, int nIndex)
624{
625 int rc;
626
627 rc = O32_GetDeviceCaps(hdc, nIndex);
628 dprintf(("GDI32: GetDeviceCaps %x %s returned %d\n", hdc, GetDeviceCapsString(nIndex), rc));
629 //SvL: 13-9-'98: NT returns -1 when using 16 bits colors, NOT 65536!
630 if(nIndex == NUMCOLORS && rc > 256)
631 return -1;
632
633 return(rc);
634}
635//******************************************************************************
636//******************************************************************************
637BOOL WIN32API GetMiterLimit( HDC arg1, float * arg2)
638{
639 return O32_GetMiterLimit(arg1, arg2);
640}
641//******************************************************************************
642//******************************************************************************
643COLORREF WIN32API GetNearestColor( HDC arg1, COLORREF arg2)
644{
645 return O32_GetNearestColor(arg1, arg2);
646}
647//******************************************************************************
648//******************************************************************************
649INT WIN32API GetPath( HDC hdc, PPOINT arg2, PBYTE arg3, int arg4)
650{
651 return O32_GetPath(hdc, arg2, arg3, arg4);
652}
653//******************************************************************************
654//******************************************************************************
655int WIN32API GetPolyFillMode( HDC hdc)
656{
657 return O32_GetPolyFillMode(hdc);
658}
659//******************************************************************************
660//******************************************************************************
661int WIN32API GetROP2( HDC hdc)
662{
663 return O32_GetROP2(hdc);
664}
665//******************************************************************************
666//******************************************************************************
667BOOL WIN32API GetRasterizerCaps(LPRASTERIZER_STATUS arg1, UINT arg2)
668{
669 return O32_GetRasterizerCaps(arg1, arg2);
670}
671//******************************************************************************
672//******************************************************************************
673UINT WIN32API GetTextAlign( HDC hdc)
674{
675 return O32_GetTextAlign(hdc);
676}
677//******************************************************************************
678//******************************************************************************
679int WIN32API GetTextCharacterExtra( HDC hdc)
680{
681 return O32_GetTextCharacterExtra(hdc);
682}
683//******************************************************************************
684//******************************************************************************
685COLORREF WIN32API GetTextColor( HDC hdc)
686{
687 return O32_GetTextColor(hdc);
688}
689//******************************************************************************
690//******************************************************************************
691BOOL WIN32API Pie(HDC hdc, int nLeftRect, int nTopRect, int nRightRect,
692 int nBottomRect, int nXRadial1, int nYRadial1, int nXRadial2,
693 int nYRadial2)
694{
695 dprintf(("GDI32: Pie %x (%d,%d)(%d,%d) (%d,%d) (%d,%d)", hdc, nLeftRect, nTopRect, nRightRect,
696 nBottomRect, nXRadial1, nYRadial1, nXRadial2, nYRadial2));
697
698 //CB: bug in O32_Pie
699 if (nXRadial1 == nXRadial2 && nYRadial1 == nYRadial2)
700 return O32_Ellipse(hdc,nLeftRect,nTopRect,nRightRect,nBottomRect);
701 else
702 return O32_Pie(hdc,nLeftRect,nTopRect,nRightRect,nBottomRect,nXRadial1,nYRadial1,nXRadial2,nYRadial2);
703}
704//******************************************************************************
705//******************************************************************************
706BOOL WIN32API PolyBezier( HDC arg1, const POINT * arg2, DWORD arg3)
707{
708 return O32_PolyBezier(arg1, arg2, (int)arg3);
709}
710//******************************************************************************
711//******************************************************************************
712BOOL WIN32API PolyBezierTo( HDC arg1, const POINT * arg2, DWORD arg3)
713{
714 return O32_PolyBezierTo(arg1, arg2, arg3);
715}
716//******************************************************************************
717//******************************************************************************
718BOOL WIN32API PolyDraw( HDC hdc, const POINT * arg2, const BYTE * arg3, DWORD arg4)
719{
720 return O32_PolyDraw(hdc, arg2, arg3, arg4);
721}
722//******************************************************************************
723//******************************************************************************
724BOOL WIN32API PolyPolygon( HDC hdc, const POINT * arg2, const INT * arg3, UINT arg4)
725{
726 return O32_PolyPolygon(hdc, arg2, arg3, arg4);
727}
728//******************************************************************************
729//******************************************************************************
730BOOL WIN32API PolyPolyline( HDC hdc, const POINT * lppt, const DWORD * lpdwPolyPoints, DWORD cCount)
731{
732 return O32_PolyPolyline(hdc,lppt,lpdwPolyPoints,cCount);
733}
734//******************************************************************************
735//******************************************************************************
736BOOL WIN32API Polygon( HDC hdc, const POINT *lpPoints, int count)
737{
738 BOOL ret = FALSE;
739#ifdef DEBUG
740 if(lpPoints && count) {
741 for(int i=0;i<count;i++) {
742 dprintf(("Point (%d,%d)", lpPoints[i].x, lpPoints[i].y));
743 }
744 }
745#endif
746 return O32_Polygon(hdc, lpPoints, count);
747}
748//******************************************************************************
749//******************************************************************************
750BOOL WIN32API PtVisible( HDC hdc, int x, int y)
751{
752 dprintf(("GDI32: PtVisible %x (%d,%d)", hdc, x, y));
753 return O32_PtVisible(hdc, x, y);
754}
755//******************************************************************************
756//******************************************************************************
757BOOL WIN32API RectVisible( HDC hdc, const RECT *lpRect)
758{
759 if(lpRect == NULL) {
760 dprintf(("WARNING: GDI32: RectVisible %x lpRect == NULL!"));
761 return FALSE;
762 }
763 dprintf(("GDI32: RectVisible %x (%d,%d)(%d,%d)", hdc, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom));
764 return O32_RectVisible(hdc, lpRect);
765}
766//******************************************************************************
767//******************************************************************************
768BOOL WIN32API RoundRect( HDC arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7)
769{
770 return O32_RoundRect(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
771}
772//******************************************************************************
773//******************************************************************************
774int WIN32API SetArcDirection( HDC arg1, int arg2)
775{
776 return O32_SetArcDirection(arg1, arg2);
777}
778//******************************************************************************
779//******************************************************************************
780UINT WIN32API SetBoundsRect( HDC arg1, const RECT * arg2, UINT arg3)
781{
782 return O32_SetBoundsRect(arg1, arg2, arg3);
783}
784//******************************************************************************
785//******************************************************************************
786BOOL WIN32API SetBrushOrgEx( HDC arg1, int arg2, int arg3, PPOINT arg4)
787{
788 return O32_SetBrushOrgEx(arg1, arg2, arg3, arg4);
789}
790//******************************************************************************
791//******************************************************************************
792DWORD WIN32API SetMapperFlags(HDC hdc, DWORD dwFlag)
793{
794 return O32_SetMapperFlags(hdc, dwFlag);
795}
796//******************************************************************************
797//******************************************************************************
798BOOL WIN32API SetMiterLimit(HDC hdc, float eNewLimit, float* peOldLimit)
799{
800 return O32_SetMiterLimit(hdc, eNewLimit, peOldLimit);
801}
802//******************************************************************************
803//******************************************************************************
804int WIN32API SetPolyFillMode(HDC hdc, int iPolyFillMode)
805{
806 return O32_SetPolyFillMode(hdc, iPolyFillMode);
807}
808//******************************************************************************
809//******************************************************************************
810UINT WIN32API SetTextAlign(HDC hdc, UINT fMode)
811{
812 return O32_SetTextAlign(hdc, fMode);
813}
814//******************************************************************************
815//******************************************************************************
816int WIN32API SetTextCharacterExtra(HDC hdc, int nCharExtra)
817{
818 return O32_SetTextCharacterExtra(hdc, nCharExtra);
819}
820//******************************************************************************
821//******************************************************************************
822BOOL WIN32API SetTextJustification(HDC hdc, int nBreakExtra, int nBreakCount)
823{
824 return O32_SetTextJustification(hdc, nBreakExtra, nBreakCount);
825}
826//******************************************************************************
827//******************************************************************************
828BOOL WIN32API WidenPath( HDC hdc)
829{
830 return O32_WidenPath(hdc);
831}
832//******************************************************************************
833//Selects the current path as a clipping region for a device context, combining
834//any existing clipping region by using the specified mode
835//TODO: Can be emulated with SelectClipRegion??
836//******************************************************************************
837BOOL WIN32API SelectClipPath(HDC hdc, int iMode)
838{
839 dprintf(("GDI32: SelectClipPath, not implemented!(TRUE)\n"));
840 return(TRUE);
841}
842//******************************************************************************
843//TODO: Sets the color adjustment values for a device context. (used to adjust
844// the input color of the src bitmap for calls of StretchBlt & StretchDIBits
845// functions when HALFTONE mode is set
846//******************************************************************************
847BOOL WIN32API SetColorAdjustment(HDC hdc, CONST COLORADJUSTMENT *lpca)
848{
849 dprintf(("GDI32: SetColorAdjustment, not implemented!(TRUE)\n"));
850 return(TRUE);
851}
852//******************************************************************************
853//Maps colors to system palette; faster way to update window (instead of redrawing)
854//We just redraw
855//******************************************************************************
856BOOL WIN32API UpdateColors(HDC hdc)
857{
858 return InvalidateRect(WindowFromDC(hdc), NULL, FALSE);
859}
860//******************************************************************************
861//******************************************************************************
862BOOL WIN32API GdiComment(HDC hdc, UINT cbSize, CONST BYTE *lpData)
863{
864 dprintf(("GDI32: GdiComment %x %d %x NOT IMPLEMENTED", hdc, cbSize, lpData));
865// return O32_GdiComment(hdc, cbSize, lpData);
866 return TRUE;
867}
868//******************************************************************************
869//******************************************************************************
870int WIN32API DrawEscape(HDC hdc, int nEscape, int cbInput, LPCSTR lpszInData)
871{
872 dprintf(("GDI32: DrawEscape, not implemented\n"));
873 return(0);
874}
875//******************************************************************************
876//******************************************************************************
877BOOL WIN32API GetColorAdjustment(HDC hdc, COLORADJUSTMENT *lpca)
878{
879 dprintf(("GDI32: GetColorAdjustment, not implemented\n"));
880 return(FALSE);
881}
882//******************************************************************************
883//******************************************************************************
884
885
886/*****************************************************************************
887 * Name : BOOL CancelDC
888 * Purpose : The CancelDC function cancels any pending operation on the
889 * specified device context (DC).
890 * Parameters: HDC hdc handle of device context
891 * Variables :
892 * Result : TRUE / FALSE
893 * Remark :
894 * Status : UNTESTED STUB
895 *
896 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
897 *****************************************************************************/
898
899BOOL WIN32API CancelDC(HDC hdc)
900{
901 dprintf(("GDI32: CancelDC(%08xh) not implemented.\n",
902 hdc));
903
904 return (FALSE);
905}
906
907/*****************************************************************************
908 * Name : BOOL CombineTransform
909 * Purpose : The CombineTransform function concatenates two world-space to
910 * page-space transformations.
911 * Parameters: LLPXFORM lLPXFORMResult address of combined transformation
912 * XFORM *lLPXFORM1 address of 1st transformation
913 * XFORM *lLPXFORM2 address of 2nd transformation
914 * Variables :
915 * Result : TRUE / FALSE
916 * Remark :
917 * Status : COMPLETELY UNTESTED
918 *
919 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
920 * Markus Montkowski [Wen, 1999/01/12 20:18]
921 *****************************************************************************/
922
923BOOL WIN32API CombineTransform(LPXFORM lLPXFORMResult,
924 CONST XFORM *lLPXFORM1,
925 CONST XFORM *lLPXFORM2)
926{
927 dprintf(("GDI32: CombineTransform(%08xh,%08xh,%08xh).\n",
928 lLPXFORMResult,
929 lLPXFORM1,
930 lLPXFORM2));
931
932 XFORM xfrm;
933 if( IsBadWritePtr( (void*)lLPXFORMResult, sizeof(XFORM)) ||
934 IsBadReadPtr( (void*)lLPXFORM1, sizeof(XFORM)) ||
935 IsBadWritePtr( (void*)lLPXFORM2, sizeof(XFORM)) )
936 return (FALSE);
937
938 // Add the translations
939 lLPXFORMResult->eDx = lLPXFORM1->eDx + lLPXFORM2->eDx;
940 lLPXFORMResult->eDy = lLPXFORM1->eDy + lLPXFORM2->eDy;
941
942 // Multiply the matrixes
943 xfrm.eM11 = lLPXFORM1->eM11 * lLPXFORM2->eM11 + lLPXFORM1->eM21 * lLPXFORM1->eM12;
944 xfrm.eM12 = lLPXFORM1->eM11 * lLPXFORM2->eM12 + lLPXFORM1->eM12 * lLPXFORM1->eM22;
945 xfrm.eM21 = lLPXFORM1->eM21 * lLPXFORM2->eM11 + lLPXFORM1->eM22 * lLPXFORM1->eM21;
946 xfrm.eM22 = lLPXFORM1->eM21 * lLPXFORM2->eM12 + lLPXFORM1->eM22 * lLPXFORM1->eM22;
947
948 // Now copy to resulting XFROM as the pt must not be distinct
949 lLPXFORMResult->eM11 = xfrm.eM11;
950 lLPXFORMResult->eM12 = xfrm.eM12;
951 lLPXFORMResult->eM21 = xfrm.eM21;
952 lLPXFORMResult->eM22 = xfrm.eM22;
953
954 return (TRUE);
955}
956
957
958/*****************************************************************************
959 * Name : BOOL FixBrushOrgEx
960 * Purpose : The FixBrushOrgEx function is not implemented in the Win32 API.
961 * It is provided for compatibility with Win32s. If called, the
962 * function does nothing, and returns FALSE.
963 * Parameters: HDC, int, int, LPPOINT
964 * Variables :
965 * Result : TRUE / FALSE
966 * Remark : not implemented in Win32
967 * Status : UNTESTED STUB
968 *
969 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
970 *****************************************************************************/
971
972BOOL WIN32API FixBrushOrgEx(HDC hdc,
973 int iDummy1,
974 int iDummy2,
975 LPPOINT lpPoint)
976{
977 dprintf(("GDI32: FixBrushOrgEx(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
978 hdc,
979 iDummy1,
980 iDummy2,
981 lpPoint));
982
983 return (FALSE);
984}
985
986
987/*****************************************************************************
988 * Name : DWORD GdiGetBatchLimit
989 * Purpose : The GdiGetBatchLimit function returns the maximum number of
990 * function calls that can be accumulated in the calling thread's
991 * current batch. The system flushes the current batch whenever
992 * this limit is exceeded.
993 * Parameters:
994 * Variables :
995 * Result : 1
996 * Remark :
997 * Status : UNTESTED STUB
998 *
999 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1000 *****************************************************************************/
1001
1002DWORD WIN32API GdiGetBatchLimit(VOID)
1003{
1004 dprintf(("GDI32: GdiGetBatchLimit() not implemented (1).\n"));
1005
1006 return (1);
1007}
1008
1009
1010/*****************************************************************************
1011 * Name : DWORD GdiSetBatchLimit
1012 * Purpose : The GdiSetBatchLimit function sets the maximum number of
1013 * functions that can be accumulated in the calling thread's current
1014 * batch. The system flushes the current batch whenever this limit
1015 * is exceeded.
1016 * Parameters: DWORD dwLimit
1017 * Variables :
1018 * Result :
1019 * Remark :
1020 * Status : UNTESTED STUB
1021 *
1022 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1023 *****************************************************************************/
1024
1025DWORD WIN32API GdiSetBatchLimit(DWORD dwLimit)
1026{
1027 dprintf(("GDI32: GdiSetBatchLimit(%08xh) not implemented (1).\n",
1028 dwLimit));
1029
1030 return (1);
1031}
1032
1033
Note: See TracBrowser for help on using the repository browser.