home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / sphigs / sph_dos.lha / dos / srgpdemo / showpat.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-26  |  1.5 KB  |  72 lines

  1. #include "srgp.h"
  2.  
  3. #define chipwidth 20
  4. #define chipheight 20
  5. #define vertmarg 5
  6. #define horizmarg 40
  7.  
  8.  
  9. int w, heightofcanvas0;
  10. int i, x, y;
  11. int whichdev;
  12. char str[10];   
  13.  
  14. attribute_group bund;
  15.  
  16. unsigned short redi, greeni, bluei;
  17.  
  18.  
  19. static void ShowPat (int num, char *numstr)
  20. {
  21.    SRGP_setFillBitmapPattern (num);
  22.    SRGP_fillRectangleCoord (x, y, x + chipwidth, y + chipheight);
  23.    SRGP_text (SRGP_defPoint(x + chipwidth+4, y+8), numstr);
  24.    y = y + chipheight+vertmarg;
  25. }
  26.  
  27. main()
  28. {
  29.    SRGP_begin ("SRGP Patterns", SCREEN_WIDTH, SCREEN_HEIGHT, 2, FALSE);
  30.    SRGP_inquireCanvasSize (0, &w, &heightofcanvas0);
  31.    SRGP_text (SRGP_defPoint(5, heightofcanvas0-15),
  32.           "Drawn in REPLACE mode.  Color use shown at right.  Hit key to exit.");
  33.  
  34.    x = 5;
  35.    y = 5;
  36.  
  37.    SRGP_setFillStyle (BITMAP_PATTERN_OPAQUE);
  38.  
  39.    for (i=0; i<=104; i++) {
  40.       sprintf (str, "%2d", i);
  41.       ShowPat(i, str);
  42.       if (y > (heightofcanvas0-40)) {
  43.         y = 5;
  44.         x = x + chipwidth + horizmarg;
  45.       }
  46.    }
  47.  
  48.    SRGP_loadCommonColor (2, "red");
  49.    SRGP_loadCommonColor (3, "green");
  50.    
  51.    SRGP_setColor (2);
  52.    SRGP_setBackgroundColor (3);
  53.  
  54.    y = 5;
  55.    x = x + chipwidth + horizmarg;
  56.  
  57.    for (i=0; i<=35; i++) {
  58.       sprintf (str, "%2d", i);
  59.       ShowPat(i, str);
  60.       if (y > (heightofcanvas0-40)) {
  61.         y = 5;
  62.         x = x + chipwidth + horizmarg;
  63.       }
  64.    }
  65.  
  66.    SRGP_setInputMode (LOCATOR, EVENT);
  67.    SRGP_setKeyboardProcessingMode (RAW);
  68.    SRGP_setInputMode (KEYBOARD, EVENT);
  69.    SRGP_waitEvent (INDEFINITE);
  70.    SRGP_end();
  71. }
  72.