|
|
1.1 ! root 1: /*------------------------------------------ ! 2: ALTWIND.C -- Alternate and Winding Modes ! 3: -------------------------------------------*/ ! 4: ! 5: #define INCL_GPI ! 6: #include <os2.h> ! 7: ! 8: MRESULT EXPENTRY ClientWndProc (HWND, USHORT, MPARAM, MPARAM) ; ! 9: ! 10: int main (void) ! 11: { ! 12: static CHAR szClientClass [] = "AltWind" ; ! 13: static ULONG flFrameFlags = FCF_TITLEBAR | FCF_SYSMENU | ! 14: FCF_SIZEBORDER | FCF_MINMAX | ! 15: FCF_SHELLPOSITION | FCF_TASKLIST ; ! 16: HAB hab ; ! 17: HMQ hmq ; ! 18: HWND hwndFrame, hwndClient ; ! 19: QMSG qmsg ; ! 20: ! 21: hab = WinInitialize (0) ; ! 22: hmq = WinCreateMsgQueue (hab, 0) ; ! 23: ! 24: WinRegisterClass (hab, szClientClass, ClientWndProc, CS_SIZEREDRAW, 0) ; ! 25: ! 26: hwndFrame = WinCreateStdWindow (HWND_DESKTOP, WS_VISIBLE, ! 27: &flFrameFlags, szClientClass, NULL, ! 28: 0L, NULL, 0, &hwndClient) ; ! 29: ! 30: while (WinGetMsg (hab, &qmsg, NULL, 0, 0)) ! 31: WinDispatchMsg (hab, &qmsg) ; ! 32: ! 33: WinDestroyWindow (hwndFrame) ; ! 34: WinDestroyMsgQueue (hmq) ; ! 35: WinTerminate (hab) ; ! 36: return 0 ; ! 37: } ! 38: ! 39: MRESULT EXPENTRY ClientWndProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2) ! 40: { ! 41: static POINTL aptlFigure[10] = { 10,30, 50,30, 50,90, 90,90, 90,50, ! 42: 30,50, 30,10, 70,10, 70,70, 10,70 } ; ! 43: static SHORT cxClient, cyClient ; ! 44: HPS hps ; ! 45: POINTL aptl[10] ; ! 46: SHORT sIndex ; ! 47: ! 48: switch (msg) ! 49: { ! 50: case WM_SIZE: ! 51: cxClient = SHORT1FROMMP (mp2) ; ! 52: cyClient = SHORT2FROMMP (mp2) ; ! 53: return 0 ; ! 54: ! 55: case WM_PAINT: ! 56: hps = WinBeginPaint (hwnd, NULL, NULL) ; ! 57: GpiErase (hps) ; ! 58: GpiSetPattern (hps, PATSYM_HALFTONE) ; ! 59: ! 60: /*--------------------- ! 61: Alternate Fill Mode ! 62: ---------------------*/ ! 63: ! 64: for (sIndex = 0 ; sIndex < 10 ; sIndex++) ! 65: { ! 66: aptl[sIndex].x = cxClient * aptlFigure[sIndex].x / 200 ; ! 67: aptl[sIndex].y = cyClient * aptlFigure[sIndex].y / 100 ; ! 68: } ! 69: ! 70: GpiBeginArea (hps, BA_BOUNDARY | BA_ALTERNATE) ; ! 71: GpiMove (hps, aptl) ; ! 72: GpiPolyLine (hps, 9L, aptl + 1) ; ! 73: GpiEndArea (hps) ; ! 74: ! 75: /*------------------- ! 76: Winding Fill Mode ! 77: -------------------*/ ! 78: ! 79: for (sIndex = 0 ; sIndex < 10 ; sIndex++) ! 80: aptl[sIndex].x += cxClient / 2 ; ! 81: ! 82: GpiBeginArea (hps, BA_BOUNDARY | BA_WINDING) ; ! 83: GpiMove (hps, aptl) ; ! 84: GpiPolyLine (hps, 9L, aptl + 1) ; ! 85: GpiEndArea (hps) ; ! 86: ! 87: WinEndPaint (hps) ; ! 88: return 0 ; ! 89: } ! 90: return WinDefWindowProc (hwnd, msg, mp1, mp2) ; ! 91: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.