gdilib.c

来自「深圳市微逻辑电子有限公司 巨果&#8226 Kingmos&reg 系统核心」· C语言 代码 · 共 2,460 行 · 第 1/5 页

C
2,460
字号
#include <eframe.h>
#include <eugwme.h>
#include <eapisrv.h>

#include <epcore.h>


typedef BOOL ( WINAPI * PGDI_BITBLT )(HDC hdcDest, int nDestX, int nDestY, int nWidth, int nHeight,HDC hdcSrc, int nSrcX, int nSrcY, DWORD dwRop );

BOOL WINAPI Gdi_BitBlt(HDC hdcDest, 
					   int nDestX, 
					   int nDestY, 
					   int nWidth, 
					   int nHeight,
				       HDC hdcSrc,
					   int nSrcX,
					   int nSrcY,
					   DWORD dwRop )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_BITBLT, 9 );
    cs.arg0 = (DWORD)hdcDest;
    return (DWORD)CALL_SERVER( &cs, nDestX, nDestY, nWidth, nHeight, hdcSrc, nSrcX, nSrcY, dwRop );
#else

	PGDI_BITBLT pBitBlt;// = (PGDI_BITBLT)lpGDIAPI[GDI_BITBLT];
	CALLSTACK cs;
	BOOL  bRetv = FALSE;

	if( API_Enter( API_GDI, GDI_BITBLT, &pBitBlt, &cs ) )
	{
		bRetv = pBitBlt( hdcDest, nDestX, nDestY, nWidth, nHeight, hdcSrc, nSrcX, nSrcY, dwRop );
		API_Leave(  );
	}
	return bRetv;
#endif
}

typedef BOOL ( WINAPI * PGDI_PATBLT )(HDC hdc, int nX, int nY, int nWidth, int nHeight, DWORD dwRop );
BOOL WINAPI Gdi_PatBlt(HDC hdc, int nX, int nY, int nWidth, int nHeight, DWORD dwRop )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_PATBLT, 6 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, nX, nY, nWidth, nHeight, dwRop );
#else

	PGDI_PATBLT pPatBlt;// = (PGDI_PATBLT)lpGDIAPI[GDI_PATBLT];

	CALLSTACK cs;
	BOOL  bRetv = FALSE;

	if( API_Enter( API_GDI, GDI_PATBLT, &pPatBlt, &cs ) )
	{
		bRetv = pPatBlt( hdc, nX, nY, nWidth, nHeight, dwRop );
		API_Leave(  );
	}
	return bRetv;
#endif
}

typedef BOOL ( WINAPI * PGDI_MASKBLT )(HDC hdcdest,int xDest,int yDest,int width,int height,HDC hdcSrc,int xSrc,int ySrc,HBITMAP hbmMask,int xMask,int yMask,DWORD dwRop );
BOOL WINAPI Gdi_MaskBlt(
				 HDC hdcdest,
                 int xDest,
                 int yDest,
                 int width,
                 int height,
                 HDC hdcSrc,
                 int xSrc,
                 int ySrc,
                 HBITMAP hbmMask,
                 int xMask,
                 int yMask,
                 DWORD dwRop )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_MASKBLT, 12 );
    cs.arg0 = (DWORD)hdcdest;
    return (DWORD)CALL_SERVER( &cs, xDest, yDest, width, height, hdcSrc, xSrc, ySrc, hbmMask, xMask, yMask, dwRop );
#else

	PGDI_MASKBLT pMaskBlt;// = (PGDI_MASKBLT)lpGDIAPI[GDI_MASKBLT];

	CALLSTACK cs;
	BOOL  bRetv = FALSE;

	if( API_Enter( API_GDI, GDI_MASKBLT, &pMaskBlt, &cs ) )
	{
		bRetv = pMaskBlt( hdcdest, xDest, yDest, width, height, hdcSrc, xSrc, ySrc, hbmMask, xMask, yMask, dwRop );
		API_Leave(  );
	}
	return bRetv;

#endif
}

typedef BOOL ( WINAPI * PGDI_DRAWEDGE )( HDC hdc, LPCRECT lpcrc, UINT uType, UINT uFlags );
BOOL WINAPI Gdi_DrawEdge( HDC hdc, LPCRECT lpcrc, UINT uType, UINT uFlags )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_DRAWEDGE, 4 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, lpcrc, uType, uFlags );
#else

	PGDI_DRAWEDGE pDrawEdge;// = (PGDI_DRAWEDGE)lpGDIAPI[GDI_DRAWEDGE];

	CALLSTACK cs;
	BOOL  bRetv = FALSE;

	if( API_Enter( API_GDI, GDI_DRAWEDGE, &pDrawEdge, &cs ) )
	{
		lpcrc = MapProcessPtr( lpcrc, (LPPROCESS)cs.lpvData );

		bRetv = pDrawEdge( hdc, lpcrc, uType, uFlags );
		API_Leave(  );
	}
	return bRetv;
#endif
}
///////////////////////////////////////////////////////////////
typedef BOOL ( WINAPI * PGDI_DRAWICON )( HDC hdc, int nX, int nY, HICON );
BOOL WINAPI Gdi_DrawIcon( HDC hdc, int nX, int nY, HICON hIcon )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_DRAWICON, 4 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, nX, nY, hIcon );
#else

	PGDI_DRAWICON pDrawIcon;// = (PGDI_DRAWICON)lpGDIAPI[GDI_DRAWICON];

	CALLSTACK cs;
	BOOL  bRetv = FALSE;

	if( API_Enter( API_GDI, GDI_DRAWICON, &pDrawIcon, &cs ) )
	{
		bRetv = pDrawIcon( hdc, nX, nY, hIcon );
		API_Leave(  );
	}
	return bRetv;
#endif
}

typedef BOOL ( WINAPI * PGDI_DRAWICONEX )( HDC hdc, int x, int y, HICON hIcon, int cxWidth, int cyWidth, UINT uiIndexAnimal,HBRUSH hBrush, UINT uiFlags ); 
BOOL WINAPI Gdi_DrawIconEx( HDC hdc, 
						    int x, 
							int y, 
							HICON hIcon, 
							int cxWidth, 
							int cyWidth, 
							UINT uiIndexAnimal,
							HBRUSH hBrush,
							UINT uiFlags )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_DRAWICONEX, 9 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, x, y, hIcon, cxWidth, cyWidth, uiIndexAnimal, hBrush, uiFlags );
#else

	PGDI_DRAWICONEX pDrawIconEx;// = (PGDI_DRAWICONEX)lpGDIAPI[GDI_DRAWICONEX];

	CALLSTACK cs;
	BOOL  bRetv = FALSE;

	if( API_Enter( API_GDI, GDI_DRAWICONEX, &pDrawIconEx, &cs ) )
	{
		bRetv = pDrawIconEx( hdc, x, y, hIcon, cxWidth, cyWidth, uiIndexAnimal, hBrush, uiFlags );
		API_Leave(  );
	}
	return bRetv;
#endif
}

typedef int ( WINAPI * PGDI_DRAWTEXT )( HDC, LPCTSTR lpcstr, int nCount, LPRECT lpcrc, UINT uFormat );
int WINAPI Gdi_DrawText( HDC hdc, 
						 LPCTSTR lpcstr, 
						 int nCount, 
						 LPRECT lpcrc, 
						 UINT uFormat )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_DRAWTEXT, 5 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, lpcstr, nCount, lpcrc, uFormat );
#else

	PGDI_DRAWTEXT pDrawText;// = (PGDI_DRAWTEXT)lpGDIAPI[GDI_DRAWTEXT];

	CALLSTACK cs;
	int  iRetv = FALSE;

	if( API_Enter( API_GDI, GDI_DRAWTEXT, &pDrawText, &cs ) )
	{
		lpcstr = MapProcessPtr( lpcstr, (LPPROCESS)cs.lpvData );
		lpcrc = MapProcessPtr( lpcrc, (LPPROCESS)cs.lpvData );

		iRetv = pDrawText( hdc, lpcstr, nCount, lpcrc, uFormat );
		API_Leave(  );
	}
	return iRetv;
#endif
}

typedef BOOL ( WINAPI * PGDI_DRAWFOCUSRECT )( HDC hdc, LPCRECT lprc );

BOOL WINAPI Gdi_DrawFocusRect( HDC hdc, LPCRECT lprc )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_DRAWFOCUSRECT, 2 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, lprc );
#else

	PGDI_DRAWFOCUSRECT pDrawFocusRect;// = (PGDI_DRAWFOCUSRECT)lpGDIAPI[GDI_DRAWFOCUSRECT];

	CALLSTACK cs;
	BOOL  bRetv = FALSE;

	if( API_Enter( API_GDI, GDI_DRAWFOCUSRECT, &pDrawFocusRect, &cs ) )
	{
		lprc = MapProcessPtr( lprc, (LPPROCESS)cs.lpvData );

		bRetv = pDrawFocusRect( hdc, lprc );
		API_Leave(  );
	}
	return bRetv;
#endif
}

typedef BOOL ( WINAPI * PGDI_DPTOLP )( HDC hdc, LPPOINT lpPoints, int nCount );
BOOL WINAPI Gdi_DPtoLP( HDC hdc, LPPOINT lpPoints, int nCount )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_DPTOLP, 3 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, lpPoints, nCount );
#else

	PGDI_DPTOLP pDPtoLP;// = (PGDI_DPTOLP)lpGDIAPI[GDI_DPTOLP];

	CALLSTACK cs;
	BOOL  bRetv = FALSE;

	if( API_Enter( API_GDI, GDI_DPTOLP, &pDPtoLP, &cs ) )
	{
		lpPoints = MapProcessPtr( lpPoints, (LPPROCESS)cs.lpvData );

		bRetv = pDPtoLP( hdc, lpPoints, nCount );
		API_Leave(  );
	}
	return bRetv;
#endif
}

typedef BOOL ( WINAPI * PGDI_ELLIPSE ) ( HDC hdc, int left, int top, int right, int bottom );
BOOL WINAPI Gdi_Ellipse( HDC hdc, int left, int top, int right, int bottom )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_ELLIPSE, 5 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, left, top, right, bottom );
#else

	PGDI_ELLIPSE pEllipse;// = (PGDI_EXCLUDECLIPRECT)lpGDIAPI[GDI_EXCLUDECLIPRECT];

	CALLSTACK cs;
	BOOL  iRetv = FALSE;

	if( API_Enter( API_GDI, GDI_ELLIPSE, &pEllipse, &cs ) )
	{

		iRetv = pEllipse( hdc, left, top, right, bottom );
		API_Leave(  );
	}
	return iRetv;
#endif
}

typedef BOOL ( WINAPI * PGDI_ARC ) ( HDC hdc, int left, int top, int right, int bottom, int xStartArc, int yStartArc, int xEndArc, int yEndArc );
BOOL WINAPI Gdi_Arc( HDC hdc, int left, int top, int right, int bottom, int xStartArc, int yStartArc, int xEndArc, int yEndArc )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_ARC, 9 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, left, top, right, bottom, xStartArc, yStartArc, xEndArc, yEndArc );
#else

	PGDI_ARC pfn;// = (PGDI_EXCLUDECLIPRECT)lpGDIAPI[GDI_EXCLUDECLIPRECT];

	CALLSTACK cs;
	BOOL  iRetv = FALSE;

	if( API_Enter( API_GDI, GDI_ARC, &pfn, &cs ) )
	{
		iRetv = pfn( hdc, left, top, right, bottom, xStartArc, yStartArc, xEndArc, yEndArc );
		API_Leave(  );
	}
	return iRetv;
#endif
}

typedef BOOL ( WINAPI * PGDI_EXTTEXTOUT )( HDC hdc, int x, int y, UINT option, LPCRECT lpRect, LPCSTR, UINT count, int * lpNextPos );
BOOL WINAPI Gdi_ExtTextOut( HDC hdc, 
						    int x, 
							int y, 
							UINT option, 
							LPCRECT lpRect, 
							LPCSTR lpcstr, 
							UINT count, 
							int * lpNextPos )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_EXTTEXTOUT, 8 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, x, y, option, lpRect, lpcstr, count, lpNextPos );
#else

	PGDI_EXTTEXTOUT pExtTextOut;// = (PGDI_EXTTEXTOUT)lpGDIAPI[GDI_EXTTEXTOUT];

	CALLSTACK cs;
	BOOL  bRetv = FALSE;

	if( API_Enter( API_GDI, GDI_EXTTEXTOUT, &pExtTextOut, &cs ) )
	{
		lpRect = MapProcessPtr( lpRect, (LPPROCESS)cs.lpvData );
		lpcstr = MapProcessPtr( lpcstr, (LPPROCESS)cs.lpvData );
		lpNextPos = MapProcessPtr( lpNextPos, (LPPROCESS)cs.lpvData );
		

		bRetv = pExtTextOut( hdc, x, y, option, lpRect, lpcstr, count, lpNextPos );
		API_Leave(  );
	}
	return bRetv;
#endif
}

typedef int ( WINAPI * PGDI_EXCLUDECLIPRECT ) ( HDC hdc, int left, int top, int right, int bottom );
int WINAPI Gdi_ExcludeClipRect( HDC hdc, int left, int top, int right, int bottom )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_EXCLUDECLIPRECT, 5 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, left, top, right, bottom );
#else

	PGDI_EXCLUDECLIPRECT pExcludeClipRect;// = (PGDI_EXCLUDECLIPRECT)lpGDIAPI[GDI_EXCLUDECLIPRECT];

	CALLSTACK cs;
	int  iRetv = ERROR;

	if( API_Enter( API_GDI, GDI_EXCLUDECLIPRECT, &pExcludeClipRect, &cs ) )
	{

		iRetv = pExcludeClipRect( hdc, left, top, right, bottom );
		API_Leave(  );
	}
	return iRetv;
#endif
}


typedef BOOL ( WINAPI * PGDI_FILLRECT )( HDC, LPCRECT, HBRUSH hBrush );
BOOL WINAPI Gdi_FillRect( HDC hdc, LPCRECT lpcrc, HBRUSH hBrush )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_FILLRECT, 3 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, lpcrc, hBrush );
#else

	PGDI_FILLRECT pFillRect;// = (PGDI_FILLRECT)lpGDIAPI[GDI_FILLRECT];

	CALLSTACK cs;
	BOOL  bRetv = FALSE;

	if( API_Enter( API_GDI, GDI_FILLRECT, &pFillRect, &cs ) )
	{
		lpcrc = MapProcessPtr( lpcrc, (LPPROCESS)cs.lpvData );

		bRetv = pFillRect( hdc, lpcrc, hBrush );
		API_Leave(  );
	}
	return bRetv;
#endif
}

typedef BOOL ( WINAPI * PGDI_FILLRGN )( HDC hdc, HRGN hrgn, HBRUSH hBrush );
BOOL WINAPI Gdi_FillRgn( HDC hdc, HRGN hrgn, HBRUSH hBrush )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_FILLRGN, 3 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, hrgn, hBrush );
#else

	PGDI_FILLRGN pFillRgn;// = (PGDI_FILLRGN)lpGDIAPI[GDI_FILLRGN];

	CALLSTACK cs;
	BOOL  bRetv = FALSE;

	if( API_Enter( API_GDI, GDI_FILLRGN, &pFillRgn, &cs ) )
	{
		bRetv = pFillRgn( hdc, hrgn, hBrush );
		API_Leave(  );
	}
	return bRetv;
#endif
}

typedef int ( WINAPI * PGDI_INTERSECTCLIPRECT )( HDC hdc, int left, int top, int right, int bottom );
int WINAPI Gdi_IntersectClipRect( HDC hdc, int left, int top, int right, int bottom )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_INTERSECTCLIPRECT, 5 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, left, top, right, bottom );
#else

	PGDI_INTERSECTCLIPRECT pIntersectClipRect;// = (PGDI_INTERSECTCLIPRECT)lpGDIAPI[GDI_INTERSECTCLIPRECT];

	CALLSTACK cs;
	int   iRetv = ERROR;

	if( API_Enter( API_GDI, GDI_INTERSECTCLIPRECT, &pIntersectClipRect, &cs ) )
	{
		iRetv = pIntersectClipRect( hdc, left, top, right, bottom );
		API_Leave(  );
	}
	return iRetv;
#endif
}

typedef COLORREF ( WINAPI * PGDI_GETBKCOLOR )( HDC hdc );
COLORREF WINAPI Gdi_GetBkColor( HDC hdc )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_GETBKCOLOR, 1 );
    cs.arg0 = (DWORD)hdc ;
    return (DWORD)CALL_SERVER( &cs );
#else

	PGDI_GETBKCOLOR pGetBkColor;// = (PGDI_GETBKCOLOR)lpGDIAPI[GDI_GETBKCOLOR];
	CALLSTACK cs;
	COLORREF  clRetv = CLR_INVALID;

	if( API_Enter( API_GDI, GDI_GETBKCOLOR, &pGetBkColor, &cs ) )
	{
		clRetv = pGetBkColor( hdc );
		API_Leave(  );
	}
	return clRetv;
#endif
}

typedef int ( WINAPI * PGDI_GETBKMODE )( HDC hdc );
int WINAPI Gdi_GetBkMode( HDC hdc )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_GETBKMODE, 1 );
    cs.arg0 = (DWORD)hdc ;
    return (DWORD)CALL_SERVER( &cs );
#else

	PGDI_GETBKMODE pGetBkMode;// = (PGDI_GETBKMODE)lpGDIAPI[GDI_GETBKMODE];

	CALLSTACK cs;
	int   iRetv = 0;

	if( API_Enter( API_GDI, GDI_GETBKMODE, &pGetBkMode, &cs ) )
	{
		iRetv = pGetBkMode( hdc );

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?