Annotation of pmsdk/samples/vectfont/vf13.c, revision 1.1.1.1

1.1       root        1: /*--------------------------
                      2:    VF13.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_Spokes (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:      GpiSetClipPath (hps, ID_PATH, SCP_AND | SCP_ALTERNATE) ;
                     33: 
                     34:      dMaxRadius = sqrt (pow (cxClient / 2.0, 2.0) +
                     35:                         pow (cyClient / 2.0, 2.0)) ;
                     36:                                                        // Draw spokes
                     37:      for (i = 0 ; i < 360 ; i++)
                     38:           {
                     39:           GpiSetColor (hps, lColors[i % iNumColors]) ;
                     40: 
                     41:           ptl.x = cxClient / 2 ;
                     42:           ptl.y = cyClient / 2 ;
                     43:           GpiMove (hps, &ptl) ;
                     44: 
                     45:           ptl.x += (LONG) (dMaxRadius * cos (i * 6.28 / 360)) ;
                     46:           ptl.y += (LONG) (dMaxRadius * sin (i * 6.28 / 360)) ;
                     47:           GpiLine (hps, &ptl) ;
                     48:           }
                     49:      GpiSetCharSet (hps, LCID_DEFAULT) ;               // Clean up
                     50:      GpiDeleteSetId (hps, LCID_MYFONT) ;
                     51:      }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.