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

Last change on this file since 8871 was 8871, checked in by sandervl, 23 years ago

Handle management updates

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