wine/include/gdi.h
Alexandre Julliard 85ed45e377 Release 980822
Sat Aug 22 17:46:19 1998  Ulrich Weigand <weigand@informatik.uni-erlangen.de>

	* [include/dosexe.h] [include/module.h] [include/pe_image.h] 
	  [include/process.h] [include/windows.h] [loader/dos/module.c]
	  [loader/module.c] [loader/ne/module.c] [loader/pe_image.c]
	  [scheduler/process.c] [win32/process.c]
	Partially implemented CreateProcess32.

	* [win32/device.c] [relay32/kernel32.spec] [scheduler/k32obj.c]
	  [misc/registry.c] [win32/file.c]
	Partially implemented VxDCall (VMM registry services).

	* [files/dos_fs.c]
	DOSFS_FindNext made thread-safe.

	* [include/sig_context.h] [include/syslevel.h] [loader/signal.c]
	  [scheduler/syslevel.c] [tools/build.c]
	Replaced CALLTO16_Current_fs by SYSLEVEL_Win16CurrentTeb.

	* [win32/kernel32.c]
	Bugfix: QT_Thunk/FT_Thunk should return 'long' in DX:AX, not EAX.

	* [if1632/relay.c] [relay32/builtin32.c] [windows/msgbox.c]
	  [msdos/int20.c] [msdos/int21.c]
	Use ExitProcess instead of TASK_KillCurrentTask.

	* [include/task.h] [include/thread.h] [loader/task.c] 
	  [scheduler/thread.c] [include/queue.h] [windows/message.c] 
	  [windows/queue.c] [windows/win.c]
	Prevent Win32 threads from entering the TASK_Reschedule loop.
	(Note: Win32 messaging still doesn't work correctly; this patch
	is just preventing the system from crashing when Win32 threads
	call messaging functions. Messages will probably still get lost.)

	* [scheduler/critsection.c]
	Deactivated the use of SEM_UNDO for the SYSTEM_LOCK semaphore;
	for some reason, this leads to problems after threads terminate... 

Sat Aug 22 15:00:00 1998  Jürgen Schmied <juergen.schmied@metronet.de>

	* [include/authors.h]
	New file, includes all names of the developer (former shell.c)

	* [Makefile.in][configure][configure.in][dlls/Makefile.in]
	  [dlls/shell32/Makefile.in][shres.rc]
	Created dlls/shell32 and moved the shell32 stuff in it.
	Started to create internal resources.

	* [dlls/shell32/*]
	Split the shell32 implementation into smaller files.
	New classes: IContextMenu, IExtractIcon, IShellView.
	Implemented Shell_GetImageList().
	shell32 links to comctl32 now dynamically so it can use
	internal/external implementations.

	* [documentation/internal-dll] [documentation/shell32]
	New, could anybody do a spellcheck?

	* [include/commctrl.h]
	Many new LV constants, structures, functions.

	* [controls/comctl32undoc.c]
	Rewrote the DSA* functions.

	* [windows/winpos.c]
	SetShellWindow32, GetShellWindow32.

Sat Aug 22 14:02:15 1998  Alexander Lukyanov <lav@long.yar.ru>

	* [loader/resource.c]
	Mark last accelerator as such in LoadAccelerators32W.

	* [relay32/shell32.spec] [misc/shell.c]
	Add stubs for SHGetSpecialFolderPath[AW].

Sat Aug 22 02:07:42 1998  Adrian Harvey <adrian@select.com.au>

	* [include/file.h] [file/file.c] [msdos/int21.c] [msdos/vxd.c]
	  [misc/lzexpand.c] [win32/kernel32.c] [documentation/filehandles]
	Fixed file handle handling.  Created universal HFILE16 to HFILE32
	translation macro from msdos/int21 code by Ove Kaaven.
	Used macro in all Win16 functions so that win32 handles are translated
	to avoid DOS/Win16 stdxx handles.
	Removed handle translation from int21.c where Win16 functions are
	called.  Changed remaining calls to use new macro names.
	Documented filehandle handling and differences between win 16 & 32.

Fri Aug 21 20:32:49 1998  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [server/process.c] [server/thread.c]
	Implemented object wait queues and synchronization.

Fri Aug 21 18:40:02 1998  Huw D M Davies <daviesh@abacus.physics.ox.ac.uk>

	* [graphics/psdrv/*]
	DEVMODE dmPaper{Width|Length} fields are in 0.1mm.
	Select a 100 pixel default font in CreateDC.

Thu Aug 20 22:47:39 1998  Uwe Bonnes  <bon@elektron.ikp.physik.tu-darmstadt.de>

	* [objects/bitmap.c]
	Handle bits=32 in SetBitmapBits32 and GetBitmapBits32.

	* [msdos/int21.c]
	Add handling of Int21 0A and 37.

	* [misc/commdlg.c]
	Use MapHModuleLS and MapHModuleSL when translating HINSTANCE16 to
	HINSTANCE32 and vice versa.

	* [win32/file.c]
	CreateFile32A: Abort if filename == NULL.

Thu Aug 20 12:28:31 1998  Marcus Meissner <marcus@jet.franken.de>

	* [*/*]
	Lots of missing prototypes added, some parameter types adapted to match
	SDK.

	* [debugger/stabs.c]
	Don't loop forever if we don't find wine or one of the libxxx.so.

	* [loader/ne/module.c]
	Implemented MapHModuleLS,MapHModuleSL,MapHinstLS,MapHinstSL.

	* [misc/network.c]
	Implemented WNetGetUser32A.

	* [misc/shellord.c]
	Implemented ILRemoveLastID.

	* [multimedia/dsound.c]
	Fixed StarCraft memory leak.

	* [graphics/ddraw.c]
	Removed some unnecessary simple relaying functions, tried polishing
	up the Xlib implementation (still doesn't work), temp. removed Xshm
	code (to be remerged with working Xlib code).

Tue Aug 18 22:29:17 1998  Ove Kaaven <ovek@arcticnet.no>

	* [multimedia/mmio.c] [multimedia/mmsystem.c]
	Fixed most mmio bugs, fully implementing mmioSetBuffer
	buffering, ability to read memory files, and the
	sndPlaySound() SND_MEMORY flag. Most mmio-using programs
	now work fine.

	* [include/dosexe.h] [include/miscemu.h] [include/module.h]
	  [loader/module.c] [loader/task.c] [msdos/dosmem.c]
	Improved DOS VM flexibility and portability somewhat. (Did
	I get the #ifdefs right this time, BSD-ers?)

	* [msdos/int21.c]
	Made "Get Current PSP address" work as expected in a DOS VM.

	* [loader/dos/*]
	Began improving flexibility and portability somewhat. It
	should be easier to add DPMI RMCB callbacks now. The
	DOS VM no longer leaves big files lying around in /tmp
	after a crash.

Tue Aug 18 12:38:31 1998 Turchanov Sergey <turchanov@usa.net>

	* [relay32/winmm.spec]
	This patch allows WinAmp to play WAV files (at least in PCM
	format).

Sun Aug 16 05:34:13 1998  Pablo Saratxaga <srtxg@chanae.alphanet.ch>

	* [windows/keyboard.c]
	Corrected keyboard code to properly handle keys : ? ~ and "
	on non US keyboards.

Sat Aug 15 18:47:14 1998  Brian Craft <bcboy@dorothy.wanglab.brandeis.edu>

	* [windows/win.c]
	Fixed severe bug in EnumChildWindwos().

Thu Aug 13 21:05:35 1998  Eric Kohl <ekohl@abo.rhein-zeitung.de>

	* [controls/tooltips.c]
	Fixed some bugs. Added subclassing support.

	* [controls/toolbar.c]
	Improved tooltip integration. Fixed some bugs.

	* [controls/commctrl.c]
	Changed control registration and added some documentation.
	Fixed ShowHideMenuCtl.

	* [controls/rebar.c][include/rebar.h][include/commctrl.h]
	Improved rebar implementation (still no display).

	* [controls/pager.c][include/pager.h][include/commctrl.h]
	Improved pager implementation (still no display).

	* [misc/imagelist.c]
	Fixed a bug.

	* [documentation/common_controls]
	Updated.

Sun Aug  9 19:50:20 1998  James Juran <jrj120@psu.edu>

	* [Makefile.in] [documentation/Makefile.in] 
	  [programs/Makefile.in] [programs/*/Makefile.in]
	Added uninstall rules, cleaned up install rules a little bit.

Sun Aug  9 13:21:35 1998  Andreas Mohr <100.30936@germany.net>

	* [loader/ne/module.c] [if1632/kernel.spec]
	Added the undocumented HIWORD of GetModuleHandle (hFirstModule).

	* [loader/ne/segment.c]
	Wine forgot to set some NE_SEGFLAGS_*.
	Combined with another loader change, this fixed the
	"BLINKER -- error in loading module" or ghost MessageBox problem
	that about 1% of all Windows programs have.
	Some BLINKER programs still don't work, though.
	But I'm working on it, with great help from Blinkinc.

	* [loader/task.c]
	InitTask needs to decrement the SP register by two as Win95 does.

Sun Aug  9 02:41:28 1998  Ulrich Weigand <weigand@informatik.uni-erlangen.de>

	* [if1632/kernel.spec] [relay32/kernel32.spec] [scheduler/syslevel.c]
	  [loader/main.c] [win32/ordinals.c] [include/syslevel.h] 
	  [scheduler/Makefile.in]
	Implemented Win95 'syslevel' routines (including Win16Lock).

	* [if1632/relay.c] [if1632/thunk.c] [tools/build.c] [loader/task.c]
	  [loader/ne/segment.c] [win32/kernel32.c] [memory/selector.c]
	  [include/stackframe.h] [include/thread.h]
	16-bit %fs handling revised.  Use Win16Lock where appropriate.

	* [include/thread.h] [scheduler/synchro.c] [windows/message.c] 
	  [windows/queue.c] [win32/process.c]
	Implemented MsgWaitForMultipleObjects.

	* [files/change.c] [files/Makefile.in] [scheduler/k32obj.c] 
	  [win32/newfns.c]
	Implemented (dummy) file change notification objects.

	* [debugger/dbg.y] [scheduler/process.c] [scheduler/thread.c]
	  [include/process.h] [include/thread.h]
	Suspend all threads except current when hitting debugger break point.

	* [objects/dib.c]
	Bugfix for CreateDIBSection.
1998-08-22 19:03:56 +00:00

442 lines
16 KiB
C

/*
* GDI definitions
*
* Copyright 1993 Alexandre Julliard
*/
#ifndef __WINE_GDI_H
#define __WINE_GDI_H
#include "windows.h"
#include "ldt.h"
#include "local.h"
#include "x11drv.h"
#include "path.h"
#include <math.h>
/* GDI objects magic numbers */
#define PEN_MAGIC 0x4f47
#define BRUSH_MAGIC 0x4f48
#define FONT_MAGIC 0x4f49
#define PALETTE_MAGIC 0x4f4a
#define BITMAP_MAGIC 0x4f4b
#define REGION_MAGIC 0x4f4c
#define DC_MAGIC 0x4f4d
#define DISABLED_DC_MAGIC 0x4f4e
#define META_DC_MAGIC 0x4f4f
#define METAFILE_MAGIC 0x4f50
#define METAFILE_DC_MAGIC 0x4f51
#define MAGIC_DONTCARE 0xffff
typedef struct tagGDIOBJHDR
{
HANDLE16 hNext;
WORD wMagic;
DWORD dwCount;
} GDIOBJHDR;
#define OBJ_PEN 1
#define OBJ_BRUSH 2
#define OBJ_DC 3
#define OBJ_METADC 4
#define OBJ_PAL 5
#define OBJ_FONT 6
#define OBJ_BITMAP 7
#define OBJ_REGION 8
#define OBJ_METAFILE 9
#define OBJ_MEMDC 10
#define OBJ_EXTPEN 11
#define OBJ_ENHMETADC 12
#define OBJ_ENHMETAFILE 13
typedef struct tagDeviceCaps
{
WORD version; /* 0: driver version */
WORD technology; /* 2: device technology */
WORD horzSize; /* 4: width of display in mm */
WORD vertSize; /* 6: height of display in mm */
WORD horzRes; /* 8: width of display in pixels */
WORD vertRes; /* 10: width of display in pixels */
WORD bitsPixel; /* 12: bits per pixel */
WORD planes; /* 14: color planes */
WORD numBrushes; /* 16: device-specific brushes */
WORD numPens; /* 18: device-specific pens */
WORD numMarkers; /* 20: device-specific markers */
WORD numFonts; /* 22: device-specific fonts */
WORD numColors; /* 24: size of color table */
WORD pdeviceSize; /* 26: size of PDEVICE structure */
WORD curveCaps; /* 28: curve capabilities */
WORD lineCaps; /* 30: line capabilities */
WORD polygonalCaps; /* 32: polygon capabilities */
WORD textCaps; /* 34: text capabilities */
WORD clipCaps; /* 36: clipping capabilities */
WORD rasterCaps; /* 38: raster capabilities */
WORD aspectX; /* 40: relative width of device pixel */
WORD aspectY; /* 42: relative height of device pixel */
WORD aspectXY; /* 44: relative diagonal width of device pixel */
WORD pad1[21]; /* 46-86: reserved */
WORD logPixelsX; /* 88: pixels / logical X inch */
WORD logPixelsY; /* 90: pixels / logical Y inch */
WORD pad2[6]; /* 92-102: reserved */
WORD sizePalette; /* 104: entries in system palette */
WORD numReserved; /* 106: reserved entries */
WORD colorRes; /* 108: color resolution */
} DeviceCaps;
/* Device independent DC information */
typedef struct
{
int flags;
const DeviceCaps *devCaps;
HRGN16 hClipRgn; /* Clip region (may be 0) */
HRGN16 hVisRgn; /* Visible region (must never be 0) */
HRGN16 hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */
HPEN16 hPen;
HBRUSH16 hBrush;
HFONT16 hFont;
HBITMAP16 hBitmap;
HBITMAP16 hFirstBitmap; /* Bitmap selected at creation of the DC */
HANDLE16 hDevice;
HPALETTE16 hPalette;
GdiPath path;
WORD ROPmode;
WORD polyFillMode;
WORD stretchBltMode;
WORD relAbsMode;
WORD backgroundMode;
COLORREF backgroundColor;
COLORREF textColor;
int backgroundPixel;
int textPixel;
short brushOrgX;
short brushOrgY;
WORD textAlign; /* Text alignment from SetTextAlign() */
short charExtra; /* Spacing from SetTextCharacterExtra() */
short breakTotalExtra; /* Total extra space for justification */
short breakCount; /* Break char. count */
short breakExtra; /* breakTotalExtra / breakCount */
short breakRem; /* breakTotalExtra % breakCount */
BYTE bitsPerPixel;
INT32 MapMode;
INT32 GraphicsMode; /* Graphics mode */
INT32 DCOrgX; /* DC origin */
INT32 DCOrgY;
FARPROC16 lpfnPrint; /* AbortProc for Printing */
INT32 CursPosX; /* Current position */
INT32 CursPosY;
INT32 ArcDirection;
XFORM xformWorld2Wnd; /* World-to-window transformation */
XFORM xformWorld2Vport; /* World-to-viewport transformation */
XFORM xformVport2World; /* Inverse of the above transformation */
BOOL32 vport2WorldValid; /* Is xformVport2World valid? */
} WIN_DC_INFO;
typedef X11DRV_PDEVICE X_DC_INFO; /* Temporary */
typedef struct tagDC
{
GDIOBJHDR header;
HDC32 hSelf; /* Handle to this DC */
const struct tagDC_FUNCS *funcs; /* DC function table */
void *physDev; /* Physical device (driver-specific) */
INT32 saveLevel;
DWORD dwHookData;
FARPROC16 hookProc;
INT32 wndOrgX; /* Window origin */
INT32 wndOrgY;
INT32 wndExtX; /* Window extent */
INT32 wndExtY;
INT32 vportOrgX; /* Viewport origin */
INT32 vportOrgY;
INT32 vportExtX; /* Viewport extent */
INT32 vportExtY;
WIN_DC_INFO w;
union
{
X_DC_INFO x;
/* other devices (e.g. printer) */
} u;
} DC;
/* Device functions for the Wine driver interface */
typedef struct tagDC_FUNCS
{
BOOL32 (*pArc)(DC*,INT32,INT32,INT32,INT32,INT32,INT32,INT32,INT32);
BOOL32 (*pBitBlt)(DC*,INT32,INT32,INT32,INT32,DC*,INT32,INT32,DWORD);
BOOL32 (*pChord)(DC*,INT32,INT32,INT32,INT32,INT32,INT32,INT32,INT32);
BOOL32 (*pCreateDC)(DC*,LPCSTR,LPCSTR,LPCSTR,const DEVMODE16*);
BOOL32 (*pDeleteDC)(DC*);
BOOL32 (*pDeleteObject)(HGDIOBJ16);
BOOL32 (*pEllipse)(DC*,INT32,INT32,INT32,INT32);
BOOL32 (*pEnumDeviceFonts)(DC*,LPLOGFONT16,DEVICEFONTENUMPROC,LPARAM);
INT32 (*pEscape)(DC*,INT32,INT32,SEGPTR,SEGPTR);
INT32 (*pExcludeClipRect)(DC*,INT32,INT32,INT32,INT32);
INT32 (*pExcludeVisRect)(DC*,INT32,INT32,INT32,INT32);
BOOL32 (*pExtFloodFill)(DC*,INT32,INT32,COLORREF,UINT32);
BOOL32 (*pExtTextOut)(DC*,INT32,INT32,UINT32,const RECT32*,LPCSTR,UINT32,const INT32*);
BOOL32 (*pGetCharWidth)(DC*,UINT32,UINT32,LPINT32);
COLORREF (*pGetPixel)(DC*,INT32,INT32);
BOOL32 (*pGetTextExtentPoint)(DC*,LPCSTR,INT32,LPSIZE32);
BOOL32 (*pGetTextMetrics)(DC*,TEXTMETRIC32A*);
INT32 (*pIntersectClipRect)(DC*,INT32,INT32,INT32,INT32);
INT32 (*pIntersectVisRect)(DC*,INT32,INT32,INT32,INT32);
BOOL32 (*pLineTo)(DC*,INT32,INT32);
BOOL32 (*pMoveToEx)(DC*,INT32,INT32,LPPOINT32);
INT32 (*pOffsetClipRgn)(DC*,INT32,INT32);
BOOL32 (*pOffsetViewportOrg)(DC*,INT32,INT32);
BOOL32 (*pOffsetWindowOrg)(DC*,INT32,INT32);
BOOL32 (*pPaintRgn)(DC*,HRGN32);
BOOL32 (*pPatBlt)(DC*,INT32,INT32,INT32,INT32,DWORD);
BOOL32 (*pPie)(DC*,INT32,INT32,INT32,INT32,INT32,INT32,INT32,INT32);
BOOL32 (*pPolyPolygon)(DC*,LPPOINT32,LPINT32,UINT32);
BOOL32 (*pPolyPolyline)(DC*,LPPOINT32,LPDWORD,DWORD);
BOOL32 (*pPolygon)(DC*,LPPOINT32,INT32);
BOOL32 (*pPolyline)(DC*,LPPOINT32,INT32);
BOOL32 (*pPolyBezier)(DC*,POINT32, LPPOINT32,DWORD);
UINT32 (*pRealizePalette)(DC*);
BOOL32 (*pRectangle)(DC*,INT32,INT32,INT32,INT32);
BOOL32 (*pRestoreDC)(DC*,INT32);
BOOL32 (*pRoundRect)(DC*,INT32,INT32,INT32,INT32,INT32,INT32);
INT32 (*pSaveDC)(DC*);
BOOL32 (*pScaleViewportExt)(DC*,INT32,INT32,INT32,INT32);
BOOL32 (*pScaleWindowExt)(DC*,INT32,INT32,INT32,INT32);
INT32 (*pSelectClipRgn)(DC*,HRGN32);
HANDLE32 (*pSelectObject)(DC*,HANDLE32);
HPALETTE32 (*pSelectPalette)(DC*,HPALETTE32,BOOL32);
COLORREF (*pSetBkColor)(DC*,COLORREF);
WORD (*pSetBkMode)(DC*,WORD);
VOID (*pSetDeviceClipping)(DC*);
INT32 (*pSetDIBitsToDevice)(DC*,INT32,INT32,DWORD,DWORD,INT32,INT32,UINT32,UINT32,LPCVOID,const BITMAPINFO*,UINT32);
INT32 (*pSetMapMode)(DC*,INT32);
DWORD (*pSetMapperFlags)(DC*,DWORD);
COLORREF (*pSetPixel)(DC*,INT32,INT32,COLORREF);
WORD (*pSetPolyFillMode)(DC*,WORD);
WORD (*pSetROP2)(DC*,WORD);
WORD (*pSetRelAbs)(DC*,WORD);
WORD (*pSetStretchBltMode)(DC*,WORD);
WORD (*pSetTextAlign)(DC*,WORD);
INT32 (*pSetTextCharacterExtra)(DC*,INT32);
DWORD (*pSetTextColor)(DC*,DWORD);
INT32 (*pSetTextJustification)(DC*,INT32,INT32);
BOOL32 (*pSetViewportExt)(DC*,INT32,INT32);
BOOL32 (*pSetViewportOrg)(DC*,INT32,INT32);
BOOL32 (*pSetWindowExt)(DC*,INT32,INT32);
BOOL32 (*pSetWindowOrg)(DC*,INT32,INT32);
BOOL32 (*pStretchBlt)(DC*,INT32,INT32,INT32,INT32,DC*,INT32,INT32,INT32,INT32,DWORD);
INT32 (*pStretchDIBits)(DC*,INT32,INT32,INT32,INT32,INT32,INT32,INT32,INT32,LPSTR,LPBITMAPINFO,WORD,DWORD);
} DC_FUNCTIONS;
/* DC hook codes */
#define DCHC_INVALIDVISRGN 0x0001
#define DCHC_DELETEDC 0x0002
#define DCHF_INVALIDATEVISRGN 0x0001
#define DCHF_VALIDATEVISRGN 0x0002
/* DC flags */
#define DC_MEMORY 0x0001 /* It is a memory DC */
#define DC_SAVED 0x0002 /* It is a saved DC */
#define DC_DIRTY 0x0004 /* hVisRgn has to be updated */
#define DC_THUNKHOOK 0x0008 /* DC hook is in the 16-bit code */
/* Last 32 bytes are reserved for stock object handles */
#define GDI_HEAP_SIZE 0xffe0
/* First handle possible for stock objects (must be >= GDI_HEAP_SIZE) */
#define FIRST_STOCK_HANDLE GDI_HEAP_SIZE
/* Stock objects handles */
#define NB_STOCK_OBJECTS (DEFAULT_GUI_FONT + 1)
#define STOCK_WHITE_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+WHITE_BRUSH))
#define STOCK_LTGRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+LTGRAY_BRUSH))
#define STOCK_GRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+GRAY_BRUSH))
#define STOCK_DKGRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+DKGRAY_BRUSH))
#define STOCK_BLACK_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+BLACK_BRUSH))
#define STOCK_NULL_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+NULL_BRUSH))
#define STOCK_HOLLOW_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+HOLLOW_BRUSH))
#define STOCK_WHITE_PEN ((HPEN16)(FIRST_STOCK_HANDLE+WHITE_PEN))
#define STOCK_BLACK_PEN ((HPEN16)(FIRST_STOCK_HANDLE+BLACK_PEN))
#define STOCK_NULL_PEN ((HPEN16)(FIRST_STOCK_HANDLE+NULL_PEN))
#define STOCK_OEM_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+OEM_FIXED_FONT))
#define STOCK_ANSI_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+ANSI_FIXED_FONT))
#define STOCK_ANSI_VAR_FONT ((HFONT16)(FIRST_STOCK_HANDLE+ANSI_VAR_FONT))
#define STOCK_SYSTEM_FONT ((HFONT16)(FIRST_STOCK_HANDLE+SYSTEM_FONT))
#define STOCK_DEVICE_DEFAULT_FONT ((HFONT16)(FIRST_STOCK_HANDLE+DEVICE_DEFAULT_FONT))
#define STOCK_DEFAULT_PALETTE ((HPALETTE16)(FIRST_STOCK_HANDLE+DEFAULT_PALETTE))
#define STOCK_SYSTEM_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+SYSTEM_FIXED_FONT))
#define STOCK_DEFAULT_GUI_FONT ((HFONT16)(FIRST_STOCK_HANDLE+DEFAULT_GUI_FONT))
#define FIRST_STOCK_FONT STOCK_OEM_FIXED_FONT
#define LAST_STOCK_FONT STOCK_DEFAULT_GUI_FONT
#define LAST_STOCK_HANDLE ((DWORD)STOCK_DEFAULT_GUI_FONT)
/* Device <-> logical coords conversion */
/* A floating point version of the POINT structure */
typedef struct tagFLOAT_POINT
{
FLOAT x, y;
} FLOAT_POINT;
/* Rounds a floating point number to integer. The world-to-viewport
* transformation process is done in floating point internally. This function
* is then used to round these coordinates to integer values.
*/
static __inline__ INT32 GDI_ROUND(FLOAT val)
{
return (int)floor(val + 0.5);
}
/* Performs a viewport-to-world transformation on the specified point (which
* is in floating point format). Returns TRUE if successful, else FALSE.
*/
static __inline__ BOOL32 INTERNAL_DPTOLP_FLOAT(DC *dc, FLOAT_POINT *point)
{
FLOAT x, y;
/* Check that the viewport-to-world transformation is valid */
if (!dc->w.vport2WorldValid)
return FALSE;
/* Perform the transformation */
x = point->x;
y = point->y;
point->x = x * dc->w.xformVport2World.eM11 +
y * dc->w.xformVport2World.eM21 +
dc->w.xformVport2World.eDx;
point->y = x * dc->w.xformVport2World.eM12 +
y * dc->w.xformVport2World.eM22 +
dc->w.xformVport2World.eDy;
return TRUE;
}
/* Performs a viewport-to-world transformation on the specified point (which
* is in integer format). Returns TRUE if successful, else FALSE.
*/
static __inline__ BOOL32 INTERNAL_DPTOLP(DC *dc, LPPOINT32 point)
{
FLOAT_POINT floatPoint;
/* Perform operation with floating point */
floatPoint.x=(FLOAT)point->x;
floatPoint.y=(FLOAT)point->y;
if (!INTERNAL_DPTOLP_FLOAT(dc, &floatPoint))
return FALSE;
/* Round to integers */
point->x = GDI_ROUND(floatPoint.x);
point->y = GDI_ROUND(floatPoint.y);
return TRUE;
}
/* Performs a world-to-viewport transformation on the specified point (which
* is in floating point format).
*/
static __inline__ void INTERNAL_LPTODP_FLOAT(DC *dc, FLOAT_POINT *point)
{
FLOAT x, y;
/* Perform the transformation */
x = point->x;
y = point->y;
point->x = x * dc->w.xformWorld2Vport.eM11 +
y * dc->w.xformWorld2Vport.eM21 +
dc->w.xformWorld2Vport.eDx;
point->y = x * dc->w.xformWorld2Vport.eM12 +
y * dc->w.xformWorld2Vport.eM22 +
dc->w.xformWorld2Vport.eDy;
}
/* Performs a world-to-viewport transformation on the specified point (which
* is in integer format).
*/
static __inline__ void INTERNAL_LPTODP(DC *dc, LPPOINT32 point)
{
FLOAT_POINT floatPoint;
/* Perform operation with floating point */
floatPoint.x=(FLOAT)point->x;
floatPoint.y=(FLOAT)point->y;
INTERNAL_LPTODP_FLOAT(dc, &floatPoint);
/* Round to integers */
point->x = GDI_ROUND(floatPoint.x);
point->y = GDI_ROUND(floatPoint.y);
}
#define XDPTOLP(dc,x) \
(((x)-(dc)->vportOrgX) * (dc)->wndExtX / (dc)->vportExtX+(dc)->wndOrgX)
#define YDPTOLP(dc,y) \
(((y)-(dc)->vportOrgY) * (dc)->wndExtY / (dc)->vportExtY+(dc)->wndOrgY)
#define XLPTODP(dc,x) \
(((x)-(dc)->wndOrgX) * (dc)->vportExtX / (dc)->wndExtX+(dc)->vportOrgX)
#define YLPTODP(dc,y) \
(((y)-(dc)->wndOrgY) * (dc)->vportExtY / (dc)->wndExtY+(dc)->vportOrgY)
/* Device <-> logical size conversion */
#define XDSTOLS(dc,x) \
((x) * (dc)->wndExtX / (dc)->vportExtX)
#define YDSTOLS(dc,y) \
((y) * (dc)->wndExtY / (dc)->vportExtY)
#define XLSTODS(dc,x) \
((x) * (dc)->vportExtX / (dc)->wndExtX)
#define YLSTODS(dc,y) \
((y) * (dc)->vportExtY / (dc)->wndExtY)
/* GDI local heap */
extern WORD GDI_HeapSel;
#define GDI_HEAP_ALLOC(size) \
LOCAL_Alloc( GDI_HeapSel, LMEM_FIXED, (size) )
#define GDI_HEAP_ALLOC_MOVEABLE(size) \
LOCAL_Alloc( GDI_HeapSel, LMEM_MOVEABLE, (size) )
#define GDI_HEAP_REALLOC(handle,size) \
LOCAL_ReAlloc( GDI_HeapSel, (handle), (size), LMEM_FIXED )
#define GDI_HEAP_FREE(handle) \
LOCAL_Free( GDI_HeapSel, (handle) )
#define GDI_HEAP_LOCK(handle) \
LOCAL_Lock( GDI_HeapSel, (handle) )
#define GDI_HEAP_LOCK_SEGPTR(handle) \
LOCAL_LockSegptr( GDI_HeapSel, (handle) )
#define GDI_HEAP_UNLOCK(handle) \
((((HGDIOBJ16)(handle) >= FIRST_STOCK_HANDLE) && \
((HGDIOBJ16)(handle)<=LAST_STOCK_HANDLE)) ? \
0 : LOCAL_Unlock( GDI_HeapSel, (handle) ))
extern BOOL32 GDI_Init(void);
extern HGDIOBJ16 GDI_AllocObject( WORD, WORD );
extern BOOL32 GDI_FreeObject( HGDIOBJ16 );
extern GDIOBJHDR * GDI_GetObjPtr( HGDIOBJ16, WORD );
extern BOOL32 DRIVER_RegisterDriver( LPCSTR name, const DC_FUNCTIONS *funcs );
extern const DC_FUNCTIONS *DRIVER_FindDriver( LPCSTR name );
extern BOOL32 DRIVER_UnregisterDriver( LPCSTR name );
extern BOOL32 DIB_Init(void);
extern Display * display;
extern Screen * screen;
extern Window rootWindow;
extern int screenWidth, screenHeight, screenDepth;
#endif /* __WINE_GDI_H */