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

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

compile fix

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