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

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

Added statistics for font, bitmap, pen, brush & region objects.

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