|
|
1.1 root 1: /*--------------------------
2: VF15.C -- Clipped Spokes
3: --------------------------*/
4:
5: #define INCL_GPI
6: #include <os2.h>
7: #include <math.h>
8: #include "vectfont.h"
9:
10: VOID Display_ModSpokes (HPS hps, LONG cxClient, LONG cyClient)
11: {
12: static CHAR szText[] = "WOW" ;
13: static LONG cbText = sizeof szText - 1 ;
14: static LONG lColors[] = { CLR_BLUE, CLR_GREEN, CLR_CYAN,
15: CLR_RED, CLR_PINK, CLR_YELLOW,
16: CLR_WHITE } ;
17: double dMaxRadius ;
18: INT i, iNumColors = sizeof lColors / sizeof lColors[0] ;
19: POINTL ptl ;
20:
21: CreateVectorFont (hps, LCID_MYFONT, "Tms Rmn") ;
22: GpiSetCharSet (hps, LCID_MYFONT) ;
23: ScaleFontToBox (hps, cbText, szText, cxClient, cyClient) ;
24: QueryStartPointInTextBox (hps, cbText, szText, &ptl) ;
25:
26: ColorClient (hps, cxClient, cyClient, CLR_BLACK) ;
27:
28: GpiBeginPath (hps, ID_PATH) ;
29: GpiCharStringAt (hps, &ptl, cbText, szText) ; // Text string
30: GpiEndPath (hps) ;
31:
32: GpiSetLineWidthGeom (hps, 6L) ; // 1/12 inch
33: GpiModifyPath (hps, ID_PATH, MPATH_STROKE) ;
34: GpiSetClipPath (hps, ID_PATH, SCP_AND | SCP_ALTERNATE) ;
35:
36: dMaxRadius = sqrt (pow (cxClient / 2.0, 2.0) +
37: pow (cyClient / 2.0, 2.0)) ;
38: // Draw spokes
39: for (i = 0 ; i < 360 ; i++)
40: {
41: GpiSetColor (hps, lColors[i % iNumColors]) ;
42:
43: ptl.x = cxClient / 2 ;
44: ptl.y = cyClient / 2 ;
45: GpiMove (hps, &ptl) ;
46:
47: ptl.x += (LONG) (dMaxRadius * cos (i * 6.28 / 360)) ;
48: ptl.y += (LONG) (dMaxRadius * sin (i * 6.28 / 360)) ;
49: GpiLine (hps, &ptl) ;
50: }
51: GpiSetCharSet (hps, LCID_DEFAULT) ; // Clean up
52: GpiDeleteSetId (hps, LCID_MYFONT) ;
53: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.