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

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

PF: CreateCompatibleDC workaround for WGSS bug (current position of new DC must be (0,0))

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