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

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

refuse DeleteObject for DEFAULT_GUI_FONT handle

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