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

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

logging updates

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