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

Last change on this file since 10316 was 10316, checked in by sandervl, 22 years ago

Visible & Clip region changes

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