-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVF15.C
53 lines (44 loc) · 1.82 KB
/
VF15.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*--------------------------
VF15.C -- Clipped Spokes
--------------------------*/
#define INCL_GPI
#include <os2.h>
#include <math.h>
#include "vectfont.h"
VOID Display_ModSpokes (HPS hps, LONG cxClient, LONG cyClient)
{
unsigned char szText[] = "WOW" ;
static LONG cbText = sizeof szText - 1 ;
static LONG lColors[] = { CLR_BLUE, CLR_GREEN, CLR_CYAN,
CLR_RED, CLR_PINK, CLR_YELLOW,
CLR_WHITE } ;
double dMaxRadius ;
INT i, iNumColors = sizeof lColors / sizeof lColors[0] ;
POINTL ptl ;
CreateVectorFont (hps, LCID_MYFONT, "Tms Rmn") ;
GpiSetCharSet (hps, LCID_MYFONT) ;
ScaleFontToBox (hps, cbText, szText, cxClient, cyClient) ;
QueryStartPointInTextBox (hps, cbText, szText, &ptl) ;
ColorClient (hps, cxClient, cyClient, CLR_BLACK) ;
GpiBeginPath (hps, ID_PATH) ;
GpiCharStringAt (hps, &ptl, cbText, szText) ; // Text string
GpiEndPath (hps) ;
GpiSetLineWidthGeom (hps, 6L) ; // 1/12 inch
GpiModifyPath (hps, ID_PATH, MPATH_STROKE) ;
GpiSetClipPath (hps, ID_PATH, SCP_AND | SCP_ALTERNATE) ;
dMaxRadius = sqrt (pow (cxClient / 2.0, 2.0) +
pow (cyClient / 2.0, 2.0)) ;
// Draw spokes
for (i = 0 ; i < 360 ; i++)
{
GpiSetColor (hps, lColors[i % iNumColors]) ;
ptl.x = cxClient / 2 ;
ptl.y = cyClient / 2 ;
GpiMove (hps, &ptl) ;
ptl.x += (LONG) (dMaxRadius * cos (i * 6.28 / 360)) ;
ptl.y += (LONG) (dMaxRadius * sin (i * 6.28 / 360)) ;
GpiLine (hps, &ptl) ;
}
GpiSetCharSet (hps, LCID_DEFAULT) ; // Clean up
GpiDeleteSetId (hps, LCID_MYFONT) ;
}