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

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

Set codepage of DC returned by CreateDCA

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