-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVF14.C
71 lines (54 loc) · 2.23 KB
/
VF14.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*--------------------------------------
VF14.C -- Clipped wavy spline curves
--------------------------------------*/
#define INCL_GPI
#include <os2.h>
#include <stdlib.h>
#include "vectfont.h"
VOID Display_Wavy (HPS hps, LONG cxClient, LONG cyClient)
{
unsigned char szText[] = "Hello!" ;
static LONG cbText = sizeof szText - 1 ;
static LONG lColors[] = { CLR_BLUE, CLR_GREEN, CLR_CYAN, CLR_RED,
CLR_PINK, CLR_YELLOW, CLR_WHITE } ;
INT i ;
POINTL ptl, aptl[8] ;
CreateVectorFont (hps, LCID_MYFONT, "Tms Rmn Italic") ;
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) ;
GpiSetClipPath (hps, ID_PATH, SCP_AND | SCP_ALTERNATE) ;
for (i = 0 ; i < 14 ; i++)
{
aptl[0].x = 0 ;
aptl[0].y = i * cyClient / 14 ;
aptl[1].x = cxClient / 3 ;
aptl[1].y = min (cyClient, 2 * i * cyClient / 14) ;
aptl[2].x = 2 * cxClient / 3 ;
aptl[2].y = max (0L, (2 * i - 14) * cyClient / 14) ;
aptl[3].x = cxClient ;
aptl[3].y = i * cyClient / 14 ;
aptl[4].x = cxClient ;
aptl[4].y = (i + 1) * cyClient / 14 ;
aptl[5].x = 2 * cxClient / 3 ;
aptl[5].y = max (0L, (2 * (i + 1) - 14) * cyClient / 14) ;
aptl[6].x = cxClient / 3 ;
aptl[6].y = min (cyClient, 2 * (i + 1) * cyClient / 14) ;
aptl[7].x = 0 ;
aptl[7].y = (i + 1) * cyClient / 14 ;
GpiSetColor (hps, lColors[i % 7]) ;
GpiBeginArea (hps, BA_BOUNDARY | BA_ALTERNATE) ;
GpiMove (hps, aptl) ; // Splines
GpiPolySpline (hps, 3L, aptl + 1) ;
GpiLine (hps, aptl + 4) ;
GpiPolySpline (hps, 3L, aptl + 5) ;
GpiLine (hps, aptl) ;
GpiEndArea (hps) ;
}
GpiSetCharSet (hps, LCID_DEFAULT) ; // Clean up
GpiDeleteSetId (hps, LCID_MYFONT) ;
}