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

Last change on this file since 6207 was 6207, checked in by sandervl, 24 years ago

don't use open32 memory functions directly

File size: 63.8 KB
Line 
1/* $Id: gdi32.cpp,v 1.73 2001-07-07 19:05:21 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
27#define DBG_LOCALLOG DBG_gdi32
28#include "dbglocal.h"
29
30ODINDEBUGCHANNEL(GDI32-GDI32)
31
32//******************************************************************************
33//******************************************************************************
34//******************************************************************************
35//******************************************************************************
36COLORREF WIN32API SetBkColor(HDC hdc, COLORREF crColor)
37{
38 dprintf(("GDI32: SetBkColor %x to %x", hdc, crColor));
39 return(O32_SetBkColor(hdc, crColor));
40}
41//******************************************************************************
42//******************************************************************************
43COLORREF WIN32API SetTextColor(HDC hdc, COLORREF crColor)
44{
45 COLORREF clr;
46
47 dprintf(("GDI32: SetTextColor %x to %x", hdc, crColor));
48 clr = O32_SetTextColor(hdc, crColor);
49 return(clr);
50}
51//******************************************************************************
52//******************************************************************************
53
54static hFntDefaultGui = NULL;
55HGDIOBJ WIN32API GetStockObject(int arg1)
56{
57 HGDIOBJ obj;
58
59 switch(arg1)
60 {
61 case DEFAULT_GUI_FONT:
62 if(NULL==hFntDefaultGui)
63 hFntDefaultGui = CreateFontA( 9, 0, 0, 0, FW_MEDIUM, FALSE,
64 FALSE, FALSE, ANSI_CHARSET,
65 OUT_DEFAULT_PRECIS,
66 CLIP_DEFAULT_PRECIS,
67 DEFAULT_QUALITY,
68 FIXED_PITCH|FF_MODERN, "WarpSans");
69 obj = hFntDefaultGui;
70 break;
71 default:
72 obj = O32_GetStockObject(arg1);
73 break;
74 }
75 dprintf(("GDI32: GetStockObject %d returned %X\n", arg1, obj));
76 return(obj);
77}
78//******************************************************************************
79//******************************************************************************
80HBRUSH WIN32API CreatePatternBrush(HBITMAP arg1)
81{
82 HBRUSH brush;
83
84 brush = O32_CreatePatternBrush(arg1);
85 dprintf(("GDI32: CreatePatternBrush from bitmap %X returned %X\n", arg1, brush));
86 return(brush);
87}
88//******************************************************************************
89//******************************************************************************
90ODINFUNCTION3(HPEN, CreatePen, int, fnPenStyle, int, nWidth, COLORREF, crColor)
91{
92 //CB: todo: PS_DOT is different in Win32 (. . . . and not - - - -)
93 // Open32 looks like LINETYPE_SHORTDASH instead of LINETYPE_DOT!!!
94 // -> difficult to fix without performance decrease!
95
96 return O32_CreatePen(fnPenStyle,nWidth,crColor);
97}
98//******************************************************************************
99//******************************************************************************
100HPEN WIN32API CreatePenIndirect(const LOGPEN * lplgpn)
101{
102 dprintf(("GDI32: CreatePenIndirect %x", lplgpn));
103 return O32_CreatePenIndirect(lplgpn);
104}
105//******************************************************************************
106//******************************************************************************
107HBRUSH WIN32API CreateDIBPatternBrushPt( const VOID * buffer, UINT usage)
108{
109 dprintf(("GDI32: CreateDIBPatternBrushPt %x %x", buffer, usage));
110 return O32_CreateDIBPatternBrushPt(buffer, usage);
111}
112/*****************************************************************************
113 * Name : HBRUSH CreateDIBPatternBrush
114 * Purpose : The CreateDIBPatternBrush function creates a logical brush that
115 * has the pattern specified by the specified device-independent
116 * bitmap (DIB). The brush can subsequently be selected into any
117 * device context that is associated with a device that supports
118 * raster operations.
119 *
120 * This function is provided only for compatibility with applications
121 * written for versions of Windows earlier than 3.0. For Win32-based
122 * applications, use the CreateDIBPatternBrushPt function.
123 * Parameters: HGLOBAL hglbDIBPacked Identifies a global memory object containing
124 * a packed DIB, which consists of a BITMAPINFO structure immediately
125 * followed by an array of bytes defining the pixels of the bitmap.
126 * UINT fuColorSpec color table data
127 * Variables :
128 * Result : TRUE / FALSE
129 * Remark :
130 * Status : ODIN32 COMPLETELY UNTESTED
131 *
132 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
133 * Markus Montkowski [Wen, 1999/01/12 20:00]
134 *****************************************************************************/
135
136HBRUSH WIN32API CreateDIBPatternBrush( HGLOBAL hglbDIBPacked,
137 UINT fuColorSpec)
138{
139 BITMAPINFO *lpMem;
140 HBRUSH ret = 0;
141
142 lpMem = (BITMAPINFO *)GlobalLock(hglbDIBPacked);
143 if(NULL!=lpMem)
144 {
145 dprintf(("GDI32: CreateDIBPatternBrush (%08xh, %08xh) %x (%d,%d) bpp %d",
146 hglbDIBPacked, fuColorSpec, lpMem, lpMem->bmiHeader.biWidth,
147 lpMem->bmiHeader.biHeight, lpMem->bmiHeader.biBitCount));
148
149 ret = CreateDIBPatternBrushPt( lpMem,
150 fuColorSpec);
151 GlobalUnlock(hglbDIBPacked);
152 }
153 else {
154 dprintf(("ERROR: CreateDIBPatternBrush (%08xh, %08xh) -> INVALID memory handle!!",
155 hglbDIBPacked, fuColorSpec));
156 }
157 return (ret);
158}
159//******************************************************************************
160//******************************************************************************
161HDC WIN32API CreateCompatibleDC( HDC hdc)
162{
163 HDC newHdc;
164
165 newHdc = O32_CreateCompatibleDC(hdc);
166 ULONG oldcp = OSLibGpiQueryCp(hdc);
167 if (!oldcp) /* If new DC is to be created */
168 oldcp = GetDisplayCodepage();
169
170 OSLibGpiSetCp(newHdc, oldcp);
171 dprintf(("CreateCompatibleDC %X returned %x", hdc, newHdc));
172 return newHdc;
173}
174//******************************************************************************
175//******************************************************************************
176ODINFUNCTION1(BOOL, DeleteDC, HDC, hdc)
177{
178 pDCData pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc);
179 if(!pHps)
180 {
181 dprintf(("WARNING: DeleteDC %x; invalid hdc!", hdc));
182 SetLastError(ERROR_INVALID_HANDLE);
183 return 0;
184 }
185 SetLastError(ERROR_SUCCESS);
186
187 DIBSection *dsect = DIBSection::findHDC(hdc);
188 if(dsect)
189 {
190 //remove previously selected dibsection
191 dprintf(("DeleteDC %x, unselect DIB section %x", hdc, dsect->GetBitmapHandle()));
192 dsect->UnSelectDIBObject();
193 }
194
195 //Must call ReleaseDC for window dcs
196 if(pHps->hdcType == TYPE_1) {
197 return ReleaseDC(OS2ToWin32Handle(pHps->hwnd), hdc);
198 }
199
200 return O32_DeleteDC(hdc);
201}
202//******************************************************************************
203//******************************************************************************
204BOOL WIN32API StrokeAndFillPath(HDC hdc)
205{
206 dprintf(("GDI32: StrokeAndFillPath %x", hdc));
207 return O32_StrokeAndFillPath(hdc);
208}
209//******************************************************************************
210//******************************************************************************
211BOOL WIN32API StrokePath(HDC hdc)
212{
213 dprintf(("GDI32: StrokePath %x", hdc));
214 return O32_StrokePath(hdc);
215}
216//******************************************************************************
217//******************************************************************************
218int WIN32API SetBkMode( HDC hdc, int mode)
219{
220 dprintf(("GDI32: SetBkMode %x %d (old %d)", hdc, mode, O32_GetBkMode(hdc)));
221 return O32_SetBkMode(hdc, mode);
222}
223//******************************************************************************
224//******************************************************************************
225COLORREF WIN32API GetPixel( HDC hdc, int x, int y)
226{
227 COLORREF color;
228
229 color = O32_GetPixel(hdc, x, y);
230 dprintf2(("GDI32: GetPixel %x (%d,%d) -> %x", hdc, x, y, color));
231 return color;
232}
233//******************************************************************************
234//******************************************************************************
235COLORREF WIN32API SetPixel( HDC hdc, int x, int y, COLORREF color)
236{
237 dprintf2(("GDI32: SetPixel %x (%d,%d) %x", hdc, x, y, color));
238 return O32_SetPixel(hdc, x, y, color);
239}
240//******************************************************************************
241//Faster version of SetPixel (since it doesn't need to return the original color)
242//Just use SetPixel for now
243//******************************************************************************
244BOOL WIN32API SetPixelV(HDC arg1, int arg2, int arg3, COLORREF arg4)
245{
246 COLORREF rc;
247
248//// dprintf(("GDI32: SetPixelV\n"));
249 rc = O32_SetPixel(arg1, arg2, arg3, arg4);
250 if(rc == GDI_ERROR) // || rc == COLOR_INVALID)
251 return(FALSE);
252 return(TRUE);
253}
254//******************************************************************************
255//******************************************************************************
256BOOL WIN32API GetDCOrgEx(HDC hdc, PPOINT lpPoint)
257{
258 if(lpPoint == NULL) {
259 dprintf(("WARNING: GDI32: GetDCOrgEx %x NULL", hdc));
260 return FALSE;
261 }
262 dprintf(("GDI32: GetDCOrgEx %x (%d,%d)", hdc, lpPoint));
263 return O32_GetDCOrgEx(hdc, lpPoint);
264}
265//******************************************************************************
266//******************************************************************************
267int WIN32API AbortDoc(HDC hdc)
268{
269 dprintf(("GDI32: AbortDoc %x", hdc));
270 return O32_AbortDoc(hdc);
271}
272//******************************************************************************
273//******************************************************************************
274BOOL WIN32API AbortPath(HDC hdc)
275{
276 dprintf(("GDI32: AbortPath %x", hdc));
277 return O32_AbortPath(hdc);
278}
279//******************************************************************************
280//******************************************************************************
281BOOL WIN32API AngleArc( HDC arg1, int arg2, int arg3, DWORD arg4, float arg5, float arg6)
282{
283 dprintf(("GDI32: AngleArc"));
284 return O32_AngleArc(arg1, arg2, arg3, arg4, arg5, arg6);
285}
286//******************************************************************************
287//******************************************************************************
288BOOL WIN32API Arc( HDC arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9)
289{
290 dprintf(("GDI32: Arc"));
291 return O32_Arc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
292}
293//******************************************************************************
294//******************************************************************************
295BOOL WIN32API ArcTo( HDC arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9)
296{
297 dprintf(("GDI32: ArcTo"));
298 return O32_ArcTo(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
299}
300//******************************************************************************
301//******************************************************************************
302BOOL WIN32API BeginPath(HDC hdc)
303{
304 dprintf(("GDI32: BeginPath $x", hdc));
305 return O32_BeginPath(hdc);
306}
307//******************************************************************************
308//******************************************************************************
309BOOL WIN32API Chord( HDC arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9)
310{
311 dprintf(("GDI32: Chord"));
312 return O32_Chord(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
313}
314//******************************************************************************
315//******************************************************************************
316BOOL WIN32API CloseFigure(HDC hdc)
317{
318 dprintf(("GDI32: CloseFigure %x", hdc));
319 return O32_CloseFigure(hdc);
320}
321//******************************************************************************
322//******************************************************************************
323HBRUSH WIN32API CreateBrushIndirect( const LOGBRUSH *pLogBrush)
324{
325 HBRUSH hBrush;
326
327 hBrush = O32_CreateBrushIndirect((LPLOGBRUSH)pLogBrush);
328 dprintf(("GDI32: CreateBrushIndirect %x %x %x returned %x", pLogBrush->lbStyle, pLogBrush->lbColor, pLogBrush->lbHatch, hBrush));
329 return hBrush;
330}
331//******************************************************************************
332//******************************************************************************
333HDC WIN32API CreateDCA(LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput, const DEVMODEA *lpInitData)
334{
335 HDC hdc;
336
337 // 2001-05-28 PH
338 // Ziff Davis Benchmarks come in here with "display".
339 // Obviously, Windows does accept case-insensitive driver names,
340 // whereas Open32 doesn't.
341 if (*lpszDriver == 'd') // quick check
342 {
343 // then do a double-check and use the uppercase constant
344 // instead
345 if (stricmp(lpszDriver, "DISPLAY") == 0)
346 lpszDriver = "DISPLAY";
347 }
348
349 hdc = O32_CreateDC(lpszDriver, lpszDevice, lpszOutput, lpInitData);
350 dprintf(("GDI32: CreateDCA %s %s %s %x returned %x", lpszDriver, lpszDevice, lpszOutput, lpInitData, hdc));
351 return hdc;
352}
353//******************************************************************************
354//******************************************************************************
355HDC WIN32API CreateDCW( LPCWSTR arg1, LPCWSTR arg2, LPCWSTR arg3, const DEVMODEW * arg4)
356{
357 char *astring4, *astring5;
358
359 char *astring1 = UnicodeToAsciiString((LPWSTR)arg1);
360 char *astring2 = UnicodeToAsciiString((LPWSTR)arg2);
361 char *astring3 = UnicodeToAsciiString((LPWSTR)arg3);
362
363 if(arg4)
364 {
365 astring4 = UnicodeToAsciiString((LPWSTR)(arg4->dmDeviceName));
366 astring5 = UnicodeToAsciiString((LPWSTR)(arg4->dmFormName));
367 }
368
369 HDC rc;
370 DEVMODEA devmode;
371
372 dprintf(("GDI32: CreateDCW"));
373
374 if(arg4)
375 {
376 strcpy((char*)devmode.dmDeviceName, astring4);
377 strcpy((char*)devmode.dmFormName, astring5);
378
379 devmode.dmSpecVersion = arg4->dmSpecVersion;
380 devmode.dmDriverVersion = arg4->dmDriverVersion;
381 devmode.dmSize = arg4->dmSize;
382 devmode.dmDriverExtra = arg4->dmDriverExtra;
383 devmode.dmFields = arg4->dmFields;
384 devmode.dmOrientation = arg4->dmOrientation;
385 devmode.dmPaperSize = arg4->dmPaperSize;
386 devmode.dmPaperLength = arg4->dmPaperLength;
387 devmode.dmPaperWidth = arg4->dmPaperWidth;
388 devmode.dmScale = arg4->dmScale;
389 devmode.dmCopies = arg4->dmCopies;
390 devmode.dmDefaultSource = arg4->dmDefaultSource;
391 devmode.dmPrintQuality = arg4->dmPrintQuality;
392 devmode.dmColor = arg4->dmColor;
393 devmode.dmDuplex = arg4->dmDuplex;
394 devmode.dmYResolution = arg4->dmYResolution;
395 devmode.dmTTOption = arg4->dmTTOption;
396 devmode.dmCollate = arg4->dmCollate;
397 devmode.dmLogPixels = arg4->dmLogPixels;
398 devmode.dmBitsPerPel = arg4->dmBitsPerPel;
399 devmode.dmPelsWidth = arg4->dmPelsWidth;
400 devmode.dmPelsHeight = arg4->dmPelsHeight;
401 devmode.dmDisplayFlags = arg4->dmDisplayFlags;
402 devmode.dmDisplayFrequency = arg4->dmDisplayFrequency;
403 devmode.dmICMMethod = arg4->dmICMMethod;
404 devmode.dmICMIntent = arg4->dmICMIntent;
405 devmode.dmMediaType = arg4->dmMediaType;
406 devmode.dmDitherType = arg4->dmDitherType;
407 devmode.dmReserved1 = arg4->dmReserved1;
408 devmode.dmReserved2 = arg4->dmReserved2;
409 rc = CreateDCA(astring1,astring2,astring3,&devmode);
410 }
411 else
412 rc = CreateDCA(astring1,astring2,astring3, NULL);
413
414 FreeAsciiString(astring1);
415 FreeAsciiString(astring2);
416 FreeAsciiString(astring3);
417
418 if(arg4)
419 {
420 FreeAsciiString(astring4);
421 FreeAsciiString(astring5);
422 }
423
424 return rc;
425}
426//******************************************************************************
427//******************************************************************************
428HBRUSH WIN32API CreateHatchBrush( int arg1, COLORREF arg2)
429{
430 dprintf(("GDI32: CreateHatchBrush"));
431 return O32_CreateHatchBrush(arg1, arg2);
432}
433//******************************************************************************
434//******************************************************************************
435HDC WIN32API CreateICA(LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput,
436 const DEVMODEA *lpdvmInit)
437{
438 static char *szDisplay = "DISPLAY";
439
440 dprintf(("GDI32: CreateICA"));
441 //SvL: Open32 tests for "DISPLAY"
442 if(lpszDriver && !strcmp(lpszDriver, "display")) {
443 lpszDriver = szDisplay;
444 }
445 //SvL: Open32 tests lpszDriver for NULL even though it's ignored
446 if(lpszDriver == NULL) {
447 lpszDriver = lpszDevice;
448 }
449 return O32_CreateIC(lpszDriver, lpszDevice, lpszOutput, lpdvmInit);
450}
451//******************************************************************************
452//******************************************************************************
453HDC WIN32API CreateICW( LPCWSTR arg1, LPCWSTR arg2, LPCWSTR arg3, const DEVMODEW * arg4)
454{
455 char *astring4, *astring5;
456
457 char *astring1 = UnicodeToAsciiString((LPWSTR)arg1);
458 char *astring2 = UnicodeToAsciiString((LPWSTR)arg2);
459 char *astring3 = UnicodeToAsciiString((LPWSTR)arg3);
460 if(arg4)
461 {
462 astring4 = UnicodeToAsciiString((LPWSTR)(arg4->dmDeviceName));
463 astring5 = UnicodeToAsciiString((LPWSTR)(arg4->dmFormName));
464 }
465
466 HDC rc;
467 DEVMODEA devmode;
468
469 dprintf(("GDI32: CreateICW"));
470
471 if(arg4)
472 {
473 strcpy((char*)devmode.dmDeviceName, astring4);
474 strcpy((char*)devmode.dmFormName, astring5);
475
476 devmode.dmSpecVersion = arg4->dmSpecVersion;
477 devmode.dmDriverVersion = arg4->dmDriverVersion;
478 devmode.dmSize = arg4->dmSize;
479 devmode.dmDriverExtra = arg4->dmDriverExtra;
480 devmode.dmFields = arg4->dmFields;
481 devmode.dmOrientation = arg4->dmOrientation;
482 devmode.dmPaperSize = arg4->dmPaperSize;
483 devmode.dmPaperLength = arg4->dmPaperLength;
484 devmode.dmPaperWidth = arg4->dmPaperWidth;
485 devmode.dmScale = arg4->dmScale;
486 devmode.dmCopies = arg4->dmCopies;
487 devmode.dmDefaultSource = arg4->dmDefaultSource;
488 devmode.dmPrintQuality = arg4->dmPrintQuality;
489 devmode.dmColor = arg4->dmColor;
490 devmode.dmDuplex = arg4->dmDuplex;
491 devmode.dmYResolution = arg4->dmYResolution;
492 devmode.dmTTOption = arg4->dmTTOption;
493 devmode.dmCollate = arg4->dmCollate;
494 devmode.dmLogPixels = arg4->dmLogPixels;
495 devmode.dmBitsPerPel = arg4->dmBitsPerPel;
496 devmode.dmPelsWidth = arg4->dmPelsWidth;
497 devmode.dmPelsHeight = arg4->dmPelsHeight;
498 devmode.dmDisplayFlags = arg4->dmDisplayFlags;
499 devmode.dmDisplayFrequency = arg4->dmDisplayFrequency;
500 devmode.dmICMMethod = arg4->dmICMMethod;
501 devmode.dmICMIntent = arg4->dmICMIntent;
502 devmode.dmMediaType = arg4->dmMediaType;
503 devmode.dmDitherType = arg4->dmDitherType;
504 devmode.dmReserved1 = arg4->dmReserved1;
505 devmode.dmReserved2 = arg4->dmReserved2;
506
507 rc = CreateICA(astring1,astring2,astring3,&devmode);
508 }
509 else
510 rc = CreateICA(astring1,astring2,astring3, NULL);
511
512 FreeAsciiString(astring1);
513 FreeAsciiString(astring2);
514 FreeAsciiString(astring3);
515 if(arg4)
516 {
517 FreeAsciiString(astring4);
518 FreeAsciiString(astring5);
519 }
520
521 return rc;
522}
523//******************************************************************************
524//******************************************************************************
525ODINFUNCTION1(HBRUSH, CreateSolidBrush, COLORREF, color)
526{
527 return O32_CreateSolidBrush(color);
528}
529//******************************************************************************
530//******************************************************************************
531BOOL WIN32API Ellipse(HDC hdc, int nLeftRect, int nTopRect, int nRightRect,
532 int nBottomRect)
533{
534 dprintf(("GDI32: Ellipse %x (%d,%d)(%d,%d)", nLeftRect, nTopRect, nRightRect, nBottomRect));
535 return O32_Ellipse(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect);
536}
537//******************************************************************************
538//******************************************************************************
539int WIN32API EndDoc( HDC hdc)
540{
541 dprintf(("GDI32: EndDoc %x", hdc));
542 return O32_EndDoc(hdc);
543}
544//******************************************************************************
545//******************************************************************************
546int WIN32API EndPage( HDC hdc)
547{
548 dprintf(("GDI32: EndPage %x", hdc));
549 return O32_EndPage(hdc);
550}
551//******************************************************************************
552//******************************************************************************
553BOOL WIN32API EndPath( HDC hdc)
554{
555 dprintf(("GDI32: EndPath %x", hdc));
556 return O32_EndPath(hdc);
557}
558//******************************************************************************
559//******************************************************************************
560ODINFUNCTION5(BOOL, Rectangle, HDC, hdc, int, left, int, top, int, right, int, bottom)
561{
562 return O32_Rectangle(hdc, left, top, right, bottom);
563}
564//******************************************************************************
565//******************************************************************************
566VOID dumpROP2(INT rop2)
567{
568 CHAR *name;
569
570 switch (rop2)
571 {
572 case R2_BLACK:
573 name = "R2_BLACK";
574 break;
575
576 case R2_COPYPEN:
577 name = "R2_COPYPEN";
578 break;
579
580 case R2_MASKNOTPEN:
581 name = "R2_MASKNOTPEN";
582 break;
583
584 case R2_MASKPEN:
585 name = "R2_MASKPEN";
586 break;
587
588 case R2_MASKPENNOT:
589 name = "R2_MASKPENNOT";
590 break;
591
592 case R2_MERGENOTPEN:
593 name = "R2_MERGENOTPEN";
594 break;
595
596 case R2_MERGEPEN:
597 name = "R2_MERGEPEN";
598 break;
599
600 case R2_MERGEPENNOT:
601 name = "R2_MERGEPENNOT";
602 break;
603
604 case R2_NOP:
605 name = "R2_NOP";
606 break;
607
608 case R2_NOT:
609 name = "R2_NOT";
610 break;
611
612 case R2_NOTCOPYPEN:
613 name = "R2_NOTCOPYPEN";
614 break;
615
616 case R2_NOTMASKPEN:
617 name = "R2_NOTMASKPEN";
618 break;
619
620 case R2_NOTMERGEPEN:
621 name = "R2_NOTMERGEPEN";
622 break;
623
624 case R2_WHITE:
625 name = "R2_WHITE";
626 break;
627
628 case R2_XORPEN:
629 name = "R2_XORPEN";
630 break;
631
632 default:
633 name = "unknown mode!!!";
634 break;
635 }
636
637 dprintf((" ROP2 mode = %s",name));
638}
639//******************************************************************************
640//******************************************************************************
641int WIN32API SetROP2( HDC hdc, int rop2)
642{
643 dprintf(("GDI32: SetROP2 %x %x", hdc, rop2));
644 #ifdef DEBUG
645 dumpROP2(rop2);
646 #endif
647 return O32_SetROP2(hdc, rop2);
648}
649//******************************************************************************
650//******************************************************************************
651int WIN32API EnumObjects( HDC hdc, int objType, GOBJENUMPROC objFunc, LPARAM lParam)
652{
653 //calling convention differences
654 dprintf(("ERROR: GDI32: EnumObjects STUB"));
655// return O32_EnumObjects(arg1, arg2, arg3, arg4);
656 return 0;
657}
658//******************************************************************************
659//******************************************************************************
660int WIN32API Escape( HDC hdc, int nEscape, int cbInput, LPCSTR lpvInData, PVOID lpvOutData)
661{
662 int rc;
663
664 rc = O32_Escape(hdc, nEscape, cbInput, lpvInData, lpvOutData);
665 if(rc == 0) {
666 dprintf(("GDI32: Escape %x %d %d %x %x returned %d (WARNING: might not be implemented!!) ", hdc, nEscape, cbInput, lpvInData, lpvOutData, rc));
667 }
668 else dprintf(("GDI32: Escape %x %d %d %x %x returned %d ", hdc, nEscape, cbInput, lpvInData, lpvOutData, rc));
669
670 return rc;
671}
672//******************************************************************************
673//******************************************************************************
674HPEN WIN32API ExtCreatePen( DWORD arg1, DWORD arg2, const LOGBRUSH * arg3, DWORD arg4, const DWORD * arg5)
675{
676 dprintf(("GDI32: ExtCreatePen"));
677 return O32_ExtCreatePen(arg1, arg2, arg3, arg4, arg5);
678}
679//******************************************************************************
680//******************************************************************************
681BOOL WIN32API ExtFloodFill( HDC arg1, int arg2, int arg3, COLORREF arg4, UINT arg5)
682{
683 dprintf(("GDI32: ExtFloodFill"));
684 return O32_ExtFloodFill(arg1, arg2, arg3, arg4, arg5);
685}
686//******************************************************************************
687//******************************************************************************
688BOOL WIN32API FillPath( HDC arg1)
689{
690 dprintf(("GDI32: FillPath"));
691 return O32_FillPath(arg1);
692}
693//******************************************************************************
694//******************************************************************************
695BOOL WIN32API FlattenPath( HDC arg1)
696{
697 dprintf(("GDI32: FlattenPath"));
698 return O32_FlattenPath(arg1);
699}
700//******************************************************************************
701//******************************************************************************
702BOOL WIN32API FloodFill(HDC arg1, int arg2, int arg3, COLORREF arg4)
703{
704 dprintf(("GDI32: FloodFill"));
705 return O32_FloodFill(arg1, arg2, arg3, arg4);
706}
707//******************************************************************************
708//******************************************************************************
709int WIN32API GetArcDirection( HDC arg1)
710{
711 dprintf(("GDI32: GetArcDirection"));
712 return O32_GetArcDirection(arg1);
713}
714//******************************************************************************
715//******************************************************************************
716BOOL WIN32API GetAspectRatioFilterEx( HDC arg1, PSIZE arg2)
717{
718 dprintf(("GDI32: GetAspectRatioFilterEx"));
719 return O32_GetAspectRatioFilterEx(arg1, arg2);
720}
721//******************************************************************************
722//******************************************************************************
723COLORREF WIN32API GetBkColor(HDC hdc)
724{
725 COLORREF color;
726
727 color = O32_GetBkColor(hdc);
728 dprintf(("GDI32: GetBkColor %x returned %x", hdc, color));
729 return color;
730}
731//******************************************************************************
732//******************************************************************************
733int WIN32API GetBkMode(HDC hdc)
734{
735 int bkmode;
736
737 bkmode = O32_GetBkMode(hdc);
738 dprintf(("GDI32: GetBkMode %x returned %d", hdc, bkmode));
739 return bkmode;
740}
741//******************************************************************************
742//******************************************************************************
743UINT WIN32API GetBoundsRect( HDC arg1, PRECT arg2, UINT arg3)
744{
745 dprintf(("GDI32: GetBoundsRect"));
746 return O32_GetBoundsRect(arg1, arg2, arg3);
747}
748//******************************************************************************
749//******************************************************************************
750BOOL WIN32API GetBrushOrgEx( HDC arg1, PPOINT arg2)
751{
752 dprintf(("GDI32: GetBrushOrgEx"));
753 return O32_GetBrushOrgEx(arg1, arg2);
754}
755//******************************************************************************
756//******************************************************************************
757BOOL WIN32API GetCharABCWidthsA( HDC arg1, UINT arg2, UINT arg3, LPABC arg4)
758{
759 dprintf(("GDI32: GetCharABCWidthsA"));
760 return O32_GetCharABCWidths(arg1, arg2, arg3, arg4);
761}
762//******************************************************************************
763//******************************************************************************
764BOOL WIN32API GetCharABCWidthsW( HDC arg1, UINT arg2, UINT arg3, LPABC arg4)
765{
766 dprintf(("GDI32: GetCharABCWidthsW not properly implemented."));
767 // NOTE: This will not work as is (needs UNICODE support)
768 return O32_GetCharABCWidths(arg1, arg2, arg3, arg4);
769}
770//******************************************************************************
771//******************************************************************************
772BOOL WIN32API GetCharWidth32A( HDC hdc, UINT iFirstChar, UINT iLastChar, PINT pWidthArray)
773{
774 BOOL ret;
775
776 dprintf(("GDI32: GetCharWidth32A %x %x %x %x", hdc, iFirstChar, iLastChar, pWidthArray));
777 ret = O32_GetCharWidth(hdc, iFirstChar, iLastChar, pWidthArray);
778 dprintf(("GDI32: GetCharWidth32A returned %d", ret));
779#ifdef DEBUG
780 if(ret) {
781 for(int i=iFirstChar;i<iLastChar;i++) {
782 if((i >= 'a' && i <= 'z') || (i >= 'A' && i <= 'Z')) {
783 dprintf2(("Char %c -> width %d", i, pWidthArray[i]));
784 }
785 else dprintf2(("Char %x -> width %d", i, pWidthArray[i]));
786 }
787 }
788#endif
789 return ret;
790}
791//******************************************************************************
792//TODO: Cut off Unicode chars?
793//******************************************************************************
794BOOL WIN32API GetCharWidth32W(HDC hdc, UINT iFirstChar, UINT iLastChar, PINT pWidthArray)
795{
796 dprintf(("GDI32: GetCharWidth32W might not work properly %x %x %x %x", hdc, iFirstChar, iLastChar, pWidthArray));
797 return O32_GetCharWidth(hdc, iFirstChar, iLastChar, pWidthArray);
798}
799//******************************************************************************
800//******************************************************************************
801HANDLE WIN32API GetCurrentObject( HDC hdc, UINT arg2)
802{
803 dprintf(("GDI32: GetCurrentObject %x %x", hdc, arg2));
804 return (HANDLE)O32_GetCurrentObject(hdc, arg2);
805}
806//******************************************************************************
807//******************************************************************************
808BOOL WIN32API GetCurrentPositionEx( HDC hdc, PPOINT lpPoint)
809{
810 BOOL rc;
811
812 dprintf(("GDI32: GetCurrentPositionEx %x", hdc));
813 rc = O32_GetCurrentPositionEx(hdc, lpPoint);
814 dprintf(("GDI32: GetCurrentPositionEx returned %d (%d,%d)", rc, lpPoint->x, lpPoint->y));
815 return rc;
816}
817//******************************************************************************
818//******************************************************************************
819int WIN32API GetDeviceCaps(HDC hdc, int nIndex)
820{
821 int rc;
822
823 rc = O32_GetDeviceCaps(hdc, nIndex);
824 dprintf(("GDI32: GetDeviceCaps %X, %d returned %d\n", hdc, nIndex, rc));
825 //SvL: 13-9-'98: NT returns -1 when using 16 bits colors, NOT 65536!
826 if(nIndex == NUMCOLORS && rc > 256)
827 return -1;
828
829 return(rc);
830}
831//******************************************************************************
832//******************************************************************************
833DWORD WIN32API GetKerningPairsA( HDC arg1, DWORD arg2, LPKERNINGPAIR arg3)
834{
835 dprintf(("GDI32: GetKerningPairsA"));
836 return O32_GetKerningPairs(arg1, arg2, arg3);
837}
838//******************************************************************************
839//******************************************************************************
840DWORD WIN32API GetKerningPairsW( HDC arg1, DWORD arg2, LPKERNINGPAIR arg3)
841{
842 dprintf(("GDI32: GetKerningPairsW"));
843 // NOTE: This will not work as is (needs UNICODE support)
844 return O32_GetKerningPairs(arg1, arg2, arg3);
845}
846//******************************************************************************
847//******************************************************************************
848BOOL WIN32API GetMiterLimit( HDC arg1, float * arg2)
849{
850 dprintf(("GDI32: GetMiterLimit"));
851 return O32_GetMiterLimit(arg1, arg2);
852}
853//******************************************************************************
854//******************************************************************************
855COLORREF WIN32API GetNearestColor( HDC arg1, COLORREF arg2)
856{
857 dprintf(("GDI32: GetNearestColor\n"));
858 return O32_GetNearestColor(arg1, arg2);
859}
860//******************************************************************************
861//******************************************************************************
862UINT WIN32API GetOutlineTextMetricsA( HDC arg1, UINT arg2, LPOUTLINETEXTMETRICA arg3)
863{
864 dprintf(("GDI32: GetOutlineTextMetricsA"));
865 return O32_GetOutlineTextMetrics(arg1, arg2, arg3);
866}
867//******************************************************************************
868//******************************************************************************
869UINT WIN32API GetOutlineTextMetricsW( HDC arg1, UINT arg2, LPOUTLINETEXTMETRICW arg3)
870{
871 dprintf(("GDI32: GetOutlineTextMetricsW STUB"));
872 // NOTE: This will not work as is (needs UNICODE support)
873// return O32_GetOutlineTextMetrics(arg1, arg2, arg3);
874 return 0;
875}
876//******************************************************************************
877//******************************************************************************
878INT WIN32API GetPath( HDC hdc, PPOINT arg2, PBYTE arg3, int arg4)
879{
880 dprintf(("GDI32: GetPath %x", hdc));
881 return O32_GetPath(hdc, arg2, arg3, arg4);
882}
883//******************************************************************************
884//******************************************************************************
885int WIN32API GetPolyFillMode( HDC hdc)
886{
887 dprintf(("GDI32: GetPolyFillMode", hdc));
888 return O32_GetPolyFillMode(hdc);
889}
890//******************************************************************************
891//******************************************************************************
892int WIN32API GetROP2( HDC hdc)
893{
894 dprintf(("GDI32: GetROP2 %x", hdc));
895 return O32_GetROP2(hdc);
896}
897//******************************************************************************
898//******************************************************************************
899BOOL WIN32API GetRasterizerCaps(LPRASTERIZER_STATUS arg1, UINT arg2)
900{
901 dprintf(("GDI32: GetRasterizerCaps"));
902 return O32_GetRasterizerCaps(arg1, arg2);
903}
904//******************************************************************************
905//******************************************************************************
906UINT WIN32API GetTextAlign( HDC hdc)
907{
908 dprintf(("GDI32: GetTextAlign %x", hdc));
909 return O32_GetTextAlign(hdc);
910}
911//******************************************************************************
912//******************************************************************************
913int WIN32API GetTextCharacterExtra( HDC hdc)
914{
915 dprintf(("GDI32: GetTextCharacterExtra", hdc));
916 return O32_GetTextCharacterExtra(hdc);
917}
918//******************************************************************************
919//******************************************************************************
920COLORREF WIN32API GetTextColor( HDC hdc)
921{
922 dprintf(("GDI32: GetTextColor %x", hdc));
923 return O32_GetTextColor(hdc);
924}
925//******************************************************************************
926//******************************************************************************
927//******************************************************************************
928//******************************************************************************
929int WIN32API GetTextFaceA( HDC hdc, int arg2, LPSTR arg3)
930{
931 dprintf(("GDI32: GetTextFaceA %x %d %x", hdc, arg2, arg3));
932 return O32_GetTextFace(hdc, arg2, arg3);
933}
934//******************************************************************************
935//******************************************************************************
936int WIN32API GetTextFaceW( HDC arg1, int arg2, LPWSTR arg3)
937{
938 char *astring = (char *)malloc(arg2+1);
939 int rc;
940
941 dprintf(("GDI32: GetTextFaceW"));
942 rc = GetTextFaceA(arg1, arg2, astring);
943 AsciiToUnicode(astring, arg3);
944 free(astring);
945 return rc;
946}
947//******************************************************************************
948//******************************************************************************
949BOOL WIN32API GetTextMetricsA( HDC hdc, LPTEXTMETRICA arg2)
950{
951 BOOL rc;
952
953 rc = O32_GetTextMetrics(hdc, arg2);
954 dprintf(("GDI32: GetTextMetricsA %x %x returned %d", hdc, arg2, rc));
955 return(rc);
956}
957//******************************************************************************
958//******************************************************************************
959BOOL WIN32API GetTextMetricsW( HDC arg1, LPTEXTMETRICW pwtm)
960{
961 BOOL rc;
962 TEXTMETRICA atm;
963
964 dprintf(("GDI32: GetTextMetricsW"));
965
966 rc = O32_GetTextMetrics(arg1, &atm);
967 pwtm->tmHeight = atm.tmHeight;
968 pwtm->tmAscent = atm.tmAscent;
969 pwtm->tmDescent = atm.tmDescent;
970 pwtm->tmInternalLeading = atm.tmInternalLeading;
971 pwtm->tmExternalLeading = atm.tmExternalLeading;
972 pwtm->tmAveCharWidth = atm.tmAveCharWidth;
973 pwtm->tmMaxCharWidth = atm.tmMaxCharWidth;
974 pwtm->tmWeight = atm.tmWeight;
975 pwtm->tmOverhang = atm.tmOverhang;
976 pwtm->tmDigitizedAspectX = atm.tmDigitizedAspectX;
977 pwtm->tmDigitizedAspectY = atm.tmDigitizedAspectY;
978 pwtm->tmFirstChar = atm.tmFirstChar;
979 pwtm->tmLastChar = atm.tmLastChar;
980 pwtm->tmDefaultChar = atm.tmDefaultChar;
981 pwtm->tmBreakChar = atm.tmBreakChar;
982 pwtm->tmItalic = atm.tmItalic;
983 pwtm->tmUnderlined = atm.tmUnderlined;
984 pwtm->tmStruckOut = atm.tmStruckOut;
985 pwtm->tmPitchAndFamily = atm.tmPitchAndFamily;
986 pwtm->tmCharSet = atm.tmCharSet;
987 return(rc);
988}
989//******************************************************************************
990//******************************************************************************
991BOOL WIN32API Pie(HDC hdc, int nLeftRect, int nTopRect, int nRightRect,
992 int nBottomRect, int nXRadial1, int nYRadial1, int nXRadial2,
993 int nYRadial2)
994{
995 dprintf(("GDI32: Pie %x (%d,%d)(%d,%d) (%d,%d) (%d,%d)", hdc, nLeftRect, nTopRect, nRightRect,
996 nBottomRect, nXRadial1, nYRadial1, nXRadial2, nYRadial2));
997
998 //CB: bug in O32_Pie
999 if (nXRadial1 == nXRadial2 && nYRadial1 == nYRadial2)
1000 return O32_Ellipse(hdc,nLeftRect,nTopRect,nRightRect,nBottomRect);
1001 else
1002 return O32_Pie(hdc,nLeftRect,nTopRect,nRightRect,nBottomRect,nXRadial1,nYRadial1,nXRadial2,nYRadial2);
1003}
1004//******************************************************************************
1005//******************************************************************************
1006BOOL WIN32API PolyBezier( HDC arg1, const POINT * arg2, DWORD arg3)
1007{
1008 dprintf(("GDI32: PolyBezier"));
1009 return O32_PolyBezier(arg1, arg2, (int)arg3);
1010}
1011//******************************************************************************
1012//******************************************************************************
1013BOOL WIN32API PolyBezierTo( HDC arg1, const POINT * arg2, DWORD arg3)
1014{
1015 dprintf(("GDI32: PolyBezierTo"));
1016 return O32_PolyBezierTo(arg1, arg2, arg3);
1017}
1018//******************************************************************************
1019//******************************************************************************
1020BOOL WIN32API PolyDraw( HDC arg1, const POINT * arg2, const BYTE * arg3, DWORD arg4)
1021{
1022 dprintf(("GDI32: PolyDraw"));
1023 return O32_PolyDraw(arg1, arg2, arg3, arg4);
1024}
1025//******************************************************************************
1026//******************************************************************************
1027BOOL WIN32API PolyPolygon( HDC arg1, const POINT * arg2, const INT * arg3, UINT arg4)
1028{
1029 dprintf(("GDI32: PolyPolygon"));
1030 return O32_PolyPolygon(arg1, arg2, arg3, arg4);
1031}
1032//******************************************************************************
1033//******************************************************************************
1034BOOL WIN32API PolyPolyline( HDC hdc, const POINT * lppt, const DWORD * lpdwPolyPoints, DWORD cCount)
1035{
1036 dprintf(("GDI32: PolyPolyline %x %x %x %d", hdc, lppt, lpdwPolyPoints, cCount));
1037
1038 return O32_PolyPolyline(hdc,lppt,lpdwPolyPoints,cCount);
1039}
1040//******************************************************************************
1041//******************************************************************************
1042BOOL WIN32API Polygon( HDC hdc, const POINT *lpPoints, int count)
1043{
1044 dprintf(("GDI32: Polygon %x %x %d", hdc, lpPoints, count));
1045 return O32_Polygon(hdc, lpPoints, count);
1046}
1047//******************************************************************************
1048//******************************************************************************
1049BOOL WIN32API PtVisible( HDC hdc, int x, int y)
1050{
1051 dprintf(("GDI32: PtVisible %x (%d,%d)", hdc, x, y));
1052 return O32_PtVisible(hdc, x, y);
1053}
1054//******************************************************************************
1055//******************************************************************************
1056BOOL WIN32API RectVisible( HDC hdc, const RECT *lpRect)
1057{
1058 if(lpRect == NULL) {
1059 dprintf(("WARNING: GDI32: RectVisible %x lpRect == NULL!"));
1060 return FALSE;
1061 }
1062 dprintf(("GDI32: RectVisible %x (%d,%d)(%d,%d)", hdc, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom));
1063 return O32_RectVisible(hdc, lpRect);
1064}
1065//******************************************************************************
1066//******************************************************************************
1067HDC WIN32API ResetDCA( HDC arg1, const DEVMODEA * arg2)
1068{
1069 dprintf(("GDI32: ResetDCA\n"));
1070 return (HDC)O32_ResetDC(arg1, arg2);
1071}
1072//******************************************************************************
1073//******************************************************************************
1074HDC WIN32API ResetDCW( HDC arg1, const DEVMODEW * arg2)
1075{
1076 dprintf(("GDI32: ResetDCW\n"));
1077 // NOTE: This will not work as is (needs UNICODE support)
1078 return (HDC)O32_ResetDC(arg1, (const DEVMODEA *)arg2);
1079}
1080//******************************************************************************
1081//******************************************************************************
1082BOOL WIN32API RestoreDC(HDC hdc, int id)
1083{
1084 BOOL ret;
1085
1086 dprintf(("GDI32: RestoreDC %x %d", hdc, id));
1087
1088 ret = O32_RestoreDC(hdc, id);
1089 if(ret == FALSE) {
1090 dprintf(("ERROR: GDI32: RestoreDC %x %d FAILED", hdc, id));
1091 }
1092 return ret;
1093}
1094//******************************************************************************
1095//******************************************************************************
1096BOOL WIN32API RoundRect( HDC arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7)
1097{
1098 dprintf(("GDI32: RoundRect"));
1099 return O32_RoundRect(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
1100}
1101//******************************************************************************
1102//******************************************************************************
1103int WIN32API SaveDC( HDC hdc)
1104{
1105 int id;
1106
1107 dprintf(("GDI32: SaveDC %x", hdc));
1108 id = O32_SaveDC(hdc);
1109 if(id == 0) {
1110 dprintf(("ERROR: GDI32: SaveDC %x FAILED", hdc));
1111 }
1112 else dprintf(("GDI32: SaveDC %x returned %d", hdc, id));
1113 return id;
1114}
1115//******************************************************************************
1116//******************************************************************************
1117int WIN32API SetArcDirection( HDC arg1, int arg2)
1118{
1119 dprintf(("GDI32: SetArcDirection"));
1120 return O32_SetArcDirection(arg1, arg2);
1121}
1122//******************************************************************************
1123//******************************************************************************
1124UINT WIN32API SetBoundsRect( HDC arg1, const RECT * arg2, UINT arg3)
1125{
1126 dprintf(("GDI32: SetBoundsRect"));
1127 return O32_SetBoundsRect(arg1, arg2, arg3);
1128}
1129//******************************************************************************
1130//******************************************************************************
1131BOOL WIN32API SetBrushOrgEx( HDC arg1, int arg2, int arg3, PPOINT arg4)
1132{
1133 BOOL rc;
1134
1135 rc = O32_SetBrushOrgEx(arg1, arg2, arg3, arg4);
1136 dprintf(("GDI32: SetBrushOrgEx returned %d\n", rc));
1137 return(rc);
1138}
1139//******************************************************************************
1140//******************************************************************************
1141ODINFUNCTION2(DWORD, SetMapperFlags, HDC, hdc, DWORD, dwFlag)
1142{
1143 return O32_SetMapperFlags(hdc, dwFlag);
1144}
1145//******************************************************************************
1146//******************************************************************************
1147ODINFUNCTION3(BOOL, SetMiterLimit, HDC, hdc, float, eNewLimit, float* ,peOldLimit)
1148{
1149 return O32_SetMiterLimit(hdc, eNewLimit, peOldLimit);
1150}
1151//******************************************************************************
1152//******************************************************************************
1153ODINFUNCTION2(int, SetPolyFillMode, HDC, hdc, int, iPolyFillMode)
1154{
1155 return O32_SetPolyFillMode(hdc, iPolyFillMode);
1156}
1157//******************************************************************************
1158//******************************************************************************
1159ODINFUNCTION2(UINT, SetTextAlign, HDC, hdc, UINT, fMode)
1160{
1161 return O32_SetTextAlign(hdc, fMode);
1162}
1163//******************************************************************************
1164//******************************************************************************
1165ODINFUNCTION2(int, SetTextCharacterExtra, HDC, hdc, int, nCharExtra)
1166{
1167 return O32_SetTextCharacterExtra(hdc, nCharExtra);
1168}
1169//******************************************************************************
1170//******************************************************************************
1171ODINFUNCTION3(BOOL, SetTextJustification, HDC, hdc, int, nBreakExtra, int, nBreakCount)
1172{
1173 return O32_SetTextJustification(hdc, nBreakExtra, nBreakCount);
1174}
1175//******************************************************************************
1176//******************************************************************************
1177INT WIN32API StartDocA( HDC arg1, const DOCINFOA *arg2)
1178{
1179 dprintf(("GDI32: StartDocA"));
1180 return O32_StartDoc(arg1, (LPDOCINFOA)arg2);
1181}
1182//******************************************************************************
1183//******************************************************************************
1184INT WIN32API StartDocW( HDC arg1, const DOCINFOW *arg2)
1185{
1186 dprintf(("GDI32: StartDocW STUB"));
1187 // NOTE: This will not work as is (needs UNICODE support)
1188// return O32_StartDoc(arg1, arg2);
1189 return 0;
1190}
1191//******************************************************************************
1192//******************************************************************************
1193int WIN32API StartPage( HDC arg1)
1194{
1195 dprintf(("GDI32: StartPage"));
1196 return O32_StartPage(arg1);
1197}
1198//******************************************************************************
1199//******************************************************************************
1200BOOL WIN32API UnrealizeObject( HGDIOBJ hObject)
1201{
1202 dprintf(("GDI32: UnrealizeObject %x", hObject));
1203 return O32_UnrealizeObject(hObject);
1204}
1205//******************************************************************************
1206//******************************************************************************
1207BOOL WIN32API WidenPath( HDC hdc)
1208{
1209 dprintf(("GDI32: WidenPath %x", hdc));
1210 return O32_WidenPath(hdc);
1211}
1212//******************************************************************************
1213//TODO: Not implemented
1214//******************************************************************************
1215int WIN32API SetAbortProc(HDC hdc, ABORTPROC lpAbortProc)
1216{
1217 dprintf(("GDI32: SetAbortProc - stub (1)w\n"));
1218 return(1);
1219}
1220//******************************************************************************
1221//Selects the current path as a clipping region for a device context, combining
1222//any existing clipping region by using the specified mode
1223//TODO: Can be emulated with SelectClipRegion??
1224//******************************************************************************
1225BOOL WIN32API SelectClipPath(HDC hdc, int iMode)
1226{
1227 dprintf(("GDI32: SelectClipPath, not implemented!(TRUE)\n"));
1228 return(TRUE);
1229}
1230//******************************************************************************
1231//TODO: Sets the color adjustment values for a device context. (used to adjust
1232// the input color of the src bitmap for calls of StretchBlt & StretchDIBits
1233// functions when HALFTONE mode is set
1234//******************************************************************************
1235BOOL WIN32API SetColorAdjustment(HDC hdc, CONST COLORADJUSTMENT *lpca)
1236{
1237 dprintf(("GDI32: SetColorAdjustment, not implemented!(TRUE)\n"));
1238 return(TRUE);
1239}
1240//******************************************************************************
1241//Maps colors to system palette; faster way to update window (instead of redrawing)
1242//We just redraw
1243//******************************************************************************
1244BOOL WIN32API UpdateColors(HDC hdc)
1245{
1246 dprintf(("GDI32: UpdateColors\n"));
1247 return InvalidateRect(WindowFromDC(hdc), NULL, FALSE);
1248}
1249//******************************************************************************
1250//******************************************************************************
1251BOOL WIN32API GdiFlush()
1252{
1253 dprintf(("GDI32: GdiFlush, not implemented (TRUE)\n"));
1254 return(TRUE);
1255}
1256//******************************************************************************
1257//******************************************************************************
1258BOOL WIN32API GdiComment(HDC hdc, UINT cbSize, CONST BYTE *lpData)
1259{
1260 dprintf(("GDI32: GdiComment %x %d %x NOT IMPLEMENTED", hdc, cbSize, lpData));
1261// return O32_GdiComment(hdc, cbSize, lpData);
1262 return TRUE;
1263}
1264//******************************************************************************
1265//******************************************************************************
1266BOOL WIN32API GetCharWidthFloatA(HDC hdc, UINT iFirstChar, UINT iLastChar, PFLOAT pxBUffer)
1267{
1268 dprintf(("GDI32: GetCharWidthFloatA, not implemented\n"));
1269 return(FALSE);
1270}
1271//******************************************************************************
1272//******************************************************************************
1273BOOL WIN32API GetCharWidthFloatW(HDC hdc, UINT iFirstChar, UINT iLastChar, PFLOAT pxBUffer)
1274{
1275 dprintf(("GDI32: GetCharWidthFloatW, not implemented\n"));
1276 return(FALSE);
1277}
1278//******************************************************************************
1279//******************************************************************************
1280BOOL WIN32API GetCharABCWidthsFloatA(HDC hdc, UINT iFirstChar, UINT iLastChar, LPABCFLOAT pxBUffer)
1281{
1282 dprintf(("GDI32: GetCharABCWidthsFloatA, not implemented\n"));
1283 return(FALSE);
1284}
1285//******************************************************************************
1286//******************************************************************************
1287BOOL WIN32API GetCharABCWidthsFloatW(HDC hdc,
1288 UINT iFirstChar,
1289 UINT iLastChar,
1290 LPABCFLOAT pxBUffer)
1291{
1292 dprintf(("GDI32: GetCharABCWidthsFloatA, not implemented\n"));
1293 return(FALSE);
1294}
1295//******************************************************************************
1296//******************************************************************************
1297INT WIN32API ExtEscape(HDC hdc, INT nEscape, INT cbInput, LPCSTR lpszInData,
1298 INT cbOutput, LPSTR lpszOutData)
1299{
1300 dprintf(("GDI32: ExtEscape, %x %x %d %x %d %x not implemented", hdc, nEscape, cbInput, lpszInData, cbOutput, lpszOutData));
1301#ifdef DEBUG
1302 if(cbInput && lpszInData) {
1303 ULONG *tmp = (ULONG *)lpszInData;
1304 for(int i=0;i<cbInput/4;i++) {
1305 dprintf(("GDI32: ExtEscape par %d: %x", i, *tmp++));
1306 }
1307 }
1308#endif
1309 return(0);
1310}
1311//******************************************************************************
1312//******************************************************************************
1313int WIN32API DrawEscape(HDC hdc, int nEscape, int cbInput, LPCSTR lpszInData)
1314{
1315 dprintf(("GDI32: DrawEscape, not implemented\n"));
1316 return(0);
1317}
1318//******************************************************************************
1319//******************************************************************************
1320BOOL WIN32API GetColorAdjustment(HDC hdc, COLORADJUSTMENT *lpca)
1321{
1322 dprintf(("GDI32: GetColorAdjustment, not implemented\n"));
1323 return(FALSE);
1324}
1325//******************************************************************************
1326//******************************************************************************
1327DWORD WIN32API GetGlyphOutlineA(HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm,
1328 DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2)
1329{
1330 dprintf(("GDI32: GetGlyphOutLineA, not implemented (GDI_ERROR)\n"));
1331 return(GDI_ERROR);
1332}
1333//******************************************************************************
1334
1335//******************************************************************************
1336/*KSO Thu 21.05.1998*/
1337DWORD WIN32API GetGlyphOutlineW(HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm,
1338 DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2)
1339{
1340 dprintf(("GDI32: GetGlyphOutLineW, not implemented\n"));
1341 return(GDI_ERROR);
1342}
1343//******************************************************************************
1344
1345//******************************************************************************
1346
1347
1348/* Office 97 stubs - KSO Thu 21.05.1998*/
1349//******************************************************************************
1350BOOL WIN32API GetTextExtentExPointA(/*KSO Thu 21.05.1998*/
1351 HDC hdc,
1352 LPCSTR str,
1353 int count,
1354 int maxExt,
1355 LPINT lpnFit,
1356 LPINT alpDx,
1357 LPSIZE size)
1358{
1359 int index, nFit, extent;
1360 SIZE tSize;
1361
1362 dprintf(("GDI32: GetTextExtendExPointA\n"));
1363
1364 size->cx = size->cy = nFit = extent = 0;
1365 for(index = 0; index < count; index++)
1366 {
1367 if(!O32_GetTextExtentPoint( hdc, str, 1, &tSize )) return FALSE;
1368 if( extent+tSize.cx < maxExt )
1369 {
1370 extent+=tSize.cx;
1371 nFit++;
1372 str++;
1373 if( alpDx )
1374 alpDx[index] = extent;
1375 if( tSize.cy > size->cy ) size->cy = tSize.cy;
1376 }
1377 else break;
1378 }
1379 size->cx = extent;
1380
1381 if (lpnFit != NULL) // check if result is desired
1382 *lpnFit = nFit;
1383
1384 dprintf(("GDI32: GetTextExtendExPointA(%08x '%.*s' %d) returning %d %d %d\n",
1385 hdc,count,str,maxExt,nFit, size->cx,size->cy));
1386 return TRUE;
1387}
1388//******************************************************************************
1389//******************************************************************************
1390BOOL WIN32API GetTextExtentExPointW( /*KSO Thu 21.05.1998*/
1391 HDC arg1,
1392 LPCWSTR arg2,
1393 int arg3,
1394 int arg4,
1395 LPINT arg5,
1396 LPINT arg6,
1397 LPSIZE arg7
1398 )
1399{
1400 char *astring = UnicodeToAsciiString((LPWSTR)arg2);
1401 BOOL rc;
1402
1403 dprintf(("GDI32: GetTextExtendExPointW\n"));
1404 rc = GetTextExtentExPointA(arg1, astring, arg3, arg4, arg5, arg6, arg7);
1405 FreeAsciiString(astring);
1406 return rc;
1407}
1408//******************************************************************************
1409
1410
1411/*****************************************************************************
1412 * Name : BOOL CancelDC
1413 * Purpose : The CancelDC function cancels any pending operation on the
1414 * specified device context (DC).
1415 * Parameters: HDC hdc handle of device context
1416 * Variables :
1417 * Result : TRUE / FALSE
1418 * Remark :
1419 * Status : UNTESTED STUB
1420 *
1421 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1422 *****************************************************************************/
1423
1424BOOL WIN32API CancelDC(HDC hdc)
1425{
1426 dprintf(("GDI32: CancelDC(%08xh) not implemented.\n",
1427 hdc));
1428
1429 return (FALSE);
1430}
1431
1432
1433/*****************************************************************************
1434 * Name : BOOL CombineTransform
1435 * Purpose : The CombineTransform function concatenates two world-space to
1436 * page-space transformations.
1437 * Parameters: LLPXFORM lLPXFORMResult address of combined transformation
1438 * XFORM *lLPXFORM1 address of 1st transformation
1439 * XFORM *lLPXFORM2 address of 2nd transformation
1440 * Variables :
1441 * Result : TRUE / FALSE
1442 * Remark :
1443 * Status : COMPLETELY UNTESTED
1444 *
1445 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1446 * Markus Montkowski [Wen, 1999/01/12 20:18]
1447 *****************************************************************************/
1448
1449BOOL WIN32API CombineTransform(LPXFORM lLPXFORMResult,
1450 CONST XFORM *lLPXFORM1,
1451 CONST XFORM *lLPXFORM2)
1452{
1453 dprintf(("GDI32: CombineTransform(%08xh,%08xh,%08xh).\n",
1454 lLPXFORMResult,
1455 lLPXFORM1,
1456 lLPXFORM2));
1457
1458 XFORM xfrm;
1459 if( IsBadWritePtr( (void*)lLPXFORMResult, sizeof(XFORM)) ||
1460 IsBadReadPtr( (void*)lLPXFORM1, sizeof(XFORM)) ||
1461 IsBadWritePtr( (void*)lLPXFORM2, sizeof(XFORM)) )
1462 return (FALSE);
1463
1464 // Add the translations
1465 lLPXFORMResult->eDx = lLPXFORM1->eDx + lLPXFORM2->eDx;
1466 lLPXFORMResult->eDy = lLPXFORM1->eDy + lLPXFORM2->eDy;
1467
1468 // Multiply the matrixes
1469 xfrm.eM11 = lLPXFORM1->eM11 * lLPXFORM2->eM11 + lLPXFORM1->eM21 * lLPXFORM1->eM12;
1470 xfrm.eM12 = lLPXFORM1->eM11 * lLPXFORM2->eM12 + lLPXFORM1->eM12 * lLPXFORM1->eM22;
1471 xfrm.eM21 = lLPXFORM1->eM21 * lLPXFORM2->eM11 + lLPXFORM1->eM22 * lLPXFORM1->eM21;
1472 xfrm.eM22 = lLPXFORM1->eM21 * lLPXFORM2->eM12 + lLPXFORM1->eM22 * lLPXFORM1->eM22;
1473
1474 // Now copy to resulting XFROM as the pt must not be distinct
1475 lLPXFORMResult->eM11 = xfrm.eM11;
1476 lLPXFORMResult->eM12 = xfrm.eM12;
1477 lLPXFORMResult->eM21 = xfrm.eM21;
1478 lLPXFORMResult->eM22 = xfrm.eM22;
1479
1480 return (TRUE);
1481}
1482
1483
1484/*****************************************************************************
1485 * Name : BOOL FixBrushOrgEx
1486 * Purpose : The FixBrushOrgEx function is not implemented in the Win32 API.
1487 * It is provided for compatibility with Win32s. If called, the
1488 * function does nothing, and returns FALSE.
1489 * Parameters: HDC, int, int, LPPOINT
1490 * Variables :
1491 * Result : TRUE / FALSE
1492 * Remark : not implemented in Win32
1493 * Status : UNTESTED STUB
1494 *
1495 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1496 *****************************************************************************/
1497
1498BOOL WIN32API FixBrushOrgEx(HDC hdc,
1499 int iDummy1,
1500 int iDummy2,
1501 LPPOINT lpPoint)
1502{
1503 dprintf(("GDI32: FixBrushOrgEx(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
1504 hdc,
1505 iDummy1,
1506 iDummy2,
1507 lpPoint));
1508
1509 return (FALSE);
1510}
1511
1512
1513/*****************************************************************************
1514 * Name : DWORD GdiGetBatchLimit
1515 * Purpose : The GdiGetBatchLimit function returns the maximum number of
1516 * function calls that can be accumulated in the calling thread's
1517 * current batch. The system flushes the current batch whenever
1518 * this limit is exceeded.
1519 * Parameters:
1520 * Variables :
1521 * Result : 1
1522 * Remark :
1523 * Status : UNTESTED STUB
1524 *
1525 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1526 *****************************************************************************/
1527
1528DWORD WIN32API GdiGetBatchLimit(VOID)
1529{
1530 dprintf(("GDI32: GdiGetBatchLimit() not implemented (1).\n"));
1531
1532 return (1);
1533}
1534
1535
1536/*****************************************************************************
1537 * Name : DWORD GdiSetBatchLimit
1538 * Purpose : The GdiSetBatchLimit function sets the maximum number of
1539 * functions that can be accumulated in the calling thread's current
1540 * batch. The system flushes the current batch whenever this limit
1541 * is exceeded.
1542 * Parameters: DWORD dwLimit
1543 * Variables :
1544 * Result :
1545 * Remark :
1546 * Status : UNTESTED STUB
1547 *
1548 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1549 *****************************************************************************/
1550
1551DWORD WIN32API GdiSetBatchLimit(DWORD dwLimit)
1552{
1553 dprintf(("GDI32: GdiSetBatchLimit(%08xh) not implemented (1).\n",
1554 dwLimit));
1555
1556 return (1);
1557}
1558
1559
1560/*****************************************************************************
1561 * Name : DWORD GetCharacterPlacementA
1562 * Purpose : The GetCharacterPlacementA function retrieves information about
1563 * a character string, such as character widths, caret positioning,
1564 * ordering within the string, and glyph rendering. The type of
1565 * information returned depends on the dwFlags parameter and is
1566 * based on the currently selected font in the given display context.
1567 * The function copies the information to the specified GCP_RESULTSA
1568 * structure or to one or more arrays specified by the structure.
1569 * Parameters: HDC hdc handle to device context
1570 * LPCSTR lpString pointer to string
1571 * int nCount number of characters in string
1572 * int nMaxExtent maximum extent for displayed string
1573 * LPGCP_RESULTSA *lpResults pointer to buffer for placement result
1574 * DWORD dwFlags placement flags
1575 * Variables :
1576 * Result :
1577 * Remark :
1578 * Status : UNTESTED STUB
1579 *
1580 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1581 *****************************************************************************/
1582
1583DWORD WIN32API GetCharacterPlacementA(HDC hdc,
1584 LPCSTR lpString,
1585 int nCount,
1586 int nMaxExtent,
1587 GCP_RESULTSA * lpResults,
1588 DWORD dwFlags)
1589{
1590 dprintf(("GDI32: GetCharacterPlacementA(%08xh,%s,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
1591 hdc,
1592 lpString,
1593 nCount,
1594 nMaxExtent,
1595 lpResults,
1596 dwFlags));
1597
1598 return (0);
1599}
1600
1601
1602/*****************************************************************************
1603 * Name : DWORD GetCharacterPlacementW
1604 * Purpose : The GetCharacterPlacementW function retrieves information about
1605 * a character string, such as character widths, caret positioning,
1606 * ordering within the string, and glyph rendering. The type of
1607 * information returned depends on the dwFlags parameter and is
1608 * based on the currently selected font in the given display context.
1609 * The function copies the information to the specified GCP_RESULTSW
1610 * structure or to one or more arrays specified by the structure.
1611 * Parameters: HDC hdc handle to device context
1612 * LPCSTR lpString pointer to string
1613 * int nCount number of characters in string
1614 * int nMaxExtent maximum extent for displayed string
1615 * GCP_RESULTSW *lpResults pointer to buffer for placement result
1616 * DWORD dwFlags placement flags
1617 * Variables :
1618 * Result :
1619 * Remark :
1620 * Status : UNTESTED STUB
1621 *
1622 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1623 *****************************************************************************/
1624
1625DWORD WIN32API GetCharacterPlacementW(HDC hdc,
1626 LPCWSTR lpString,
1627 int nCount,
1628 int nMaxExtent,
1629 GCP_RESULTSW *lpResults,
1630 DWORD dwFlags)
1631{
1632 dprintf(("GDI32: GetCharacterPlacementW(%08xh,%s,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
1633 hdc,
1634 lpString,
1635 nCount,
1636 nMaxExtent,
1637 lpResults,
1638 dwFlags));
1639
1640 return (0);
1641}
Note: See TracBrowser for help on using the repository browser.