📄 dc.h
字号:
//// $Id: dc.h,v 1.6 2000/07/26 07:43:06 weiym Exp $//// dc.h: this head file declares all // internal types and data of GDI module.//// Copyright (c) 1999, 2000, Mr. Wei Yongming.//#ifndef _DC_H #define _DC_H #ifdef __cplusplusextern "C" {#endif /* __cplusplus */#define DCSLOTNUMBER 20// Device Contexttypedef struct{ short DataType; // the data type, always be TYPE_HDC short DCType; // the dc type BOOL inuse; HWND hwnd; // graphics context GAL_GC gc; // background color and mode. gal_pixel bkcolor; int bkmode; // brush attributes int brushtype; gal_pixel brushcolor; POINT BrushOrig; // pen attributes int pentype; gal_pixel pencolor; POINT CurPenPos; // device rect BOOL bIsClient; RECT DevRC; // text attibutes gal_pixel textcolor; PLOGFONT pLogFont; int nDefTabStop; POINT CurTextPos; int cExtra; // Character extra int alExtra; // Above line extra int blExtra; // Bellow line extra // mappping mode and relative parameters. int mapmode; POINT ViewOrig; POINT ViewExtent; POINT WindowOrig; POINT WindowExtent; // clip region information CLIPRGN lcrgn; CLIPRGN ecrgn; PGCRINFO pGCRInfo; int oldage;}DC;typedef DC* PDC;extern DC ScreenDC;// This function convert HDC to PDC.static inline PDC dc_HDC2PDC(HDC hdc){ if(hdc == HDC_SCREEN) return &ScreenDC; return (PDC) hdc;}static inline BOOL dc_IsMemHDC(HDC hdc){ if(hdc == HDC_SCREEN) return FALSE; return (((PDC)hdc)->DCType == TYPE_MEMDC);}static inline BOOL dc_IsScreenHDC(HDC hdc){ return (hdc == HDC_SCREEN);}static inline BOOL dc_IsGeneralHDC(HDC hdc){ if(hdc == HDC_SCREEN) return FALSE; return (((PDC)hdc)->DCType == TYPE_GENDC);}static inline BOOL dc_IsMemDC(PDC pdc){ return (pdc->DCType == TYPE_MEMDC);}static inline BOOL dc_IsScreenDC(PDC pdc){ return (pdc->DCType == TYPE_SCRDC);}static inline BOOL dc_IsGeneralDC(PDC pdc){ return (pdc->DCType == TYPE_GENDC);}static inline BOOL dc_IsVisible (PDC pdc){ PMAINWIN pParent; if (pdc->DCType != TYPE_GENDC) return TRUE; if (pdc->hwnd == HWND_DESKTOP) return TRUE; pParent = ((PMAINWIN)(pdc->hwnd))->pMainWin; if (pParent && !(pParent->dwStyle & WS_VISIBLE)) return FALSE; return ((PMAINWIN)(pdc->hwnd))->dwStyle & WS_VISIBLE;}static inline void coor_LP2SP(PDC pdc, int* x, int* y){ if(pdc == &ScreenDC) return; if (pdc->mapmode == MM_TEXT) { *x += pdc->DevRC.left; *y += pdc->DevRC.top; } else { *x = pdc->DevRC.left + (*x - pdc->WindowOrig.x) * pdc->ViewExtent.x / pdc->WindowExtent.x + pdc->ViewOrig.x; *y = pdc->DevRC.top + (*y - pdc->WindowOrig.y) * pdc->ViewExtent.y / pdc->WindowExtent.y + pdc->ViewOrig.y; }}static inline void coor_SP2LP(PDC pdc, int* x, int* y){ if(pdc == &ScreenDC) return; *x -= pdc->DevRC.left; *y -= pdc->DevRC.top; if (pdc->mapmode != MM_TEXT) { *x = (*x - pdc->ViewOrig.x) * pdc->WindowExtent.x / pdc->ViewExtent.x + pdc->WindowOrig.x; *y = (*y - pdc->ViewOrig.y) * pdc->WindowExtent.y / pdc->ViewExtent.y + pdc->WindowOrig.y; }}static inline void extent_x_LP2SP (PDC pdc, int* extent){ if (pdc == &ScreenDC || pdc->mapmode == MM_TEXT) return; *extent = *extent * pdc->ViewExtent.x / pdc->WindowExtent.x;}static inline void extent_x_SP2LP (PDC pdc, int* extent){ if (pdc == &ScreenDC || pdc->mapmode == MM_TEXT) return; *extent = *extent * pdc->WindowExtent.x / pdc->ViewExtent.x;}static inline void extent_y_LP2SP (PDC pdc, int* extent){ if (pdc == &ScreenDC || pdc->mapmode == MM_TEXT) return; *extent = *extent * pdc->ViewExtent.y / pdc->WindowExtent.y;}static inline void extent_y_SP2LP (PDC pdc, int* extent){ if (pdc == &ScreenDC || pdc->mapmode == MM_TEXT) return; *extent = *extent * pdc->WindowExtent.y / pdc->ViewExtent.y;}#ifdef __cplusplus}#endif /* __cplusplus */#endif // _DC_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -