Advertisement
Guest User

Untitled

a guest
Apr 21st, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.01 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <g2.h>
  3. #include <g2_X11.h>
  4. #include <math.h>
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8.   int win = 0;
  9.   int i = 1;
  10.   win = g2_open_X11(500,320);
  11.  
  12.   g2_pen(win, 19);
  13.   g2_set_line_width(win, 5);
  14.   g2_line(win, 10, 10, 60, 60);
  15.   g2_line(win, 60, 10, 10, 60);
  16.  
  17.   g2_pen(win, 3);
  18.   g2_rectangle(win, 80, 60, 130, 10);
  19.   g2_set_line_width(win, 0);
  20.   g2_filled_rectangle(win, 150, 60, 200, 10);
  21.  
  22.   g2_pen(win, 7);
  23.   g2_set_line_width(win, 7);
  24.   g2_circle(win, 245, 35, 25);
  25.  
  26.   g2_set_line_width(win, 0);
  27.   g2_filled_circle(win, 315, 35, 25);
  28.  
  29.   g2_set_line_width(win, 5);
  30.   g2_pen(win, 19);
  31.   g2_arc(0, 385, 35, 25, 25, 0, 120);
  32.   g2_pen(win, 3);
  33.   g2_arc(0, 385, 35, 25, 25, 120, 240);
  34.   g2_pen(win, 25);
  35.   g2_arc(0, 385, 35, 25, 25, 240, 360);
  36.  
  37.   g2_set_line_width(win, 0);
  38.   g2_pen(win, 19);
  39.   g2_filled_arc(0, 455, 35, 25, 25, 0, 120);
  40.   g2_pen(win, 3);
  41.   g2_filled_arc(0, 455, 35, 25, 25, 120, 240);
  42.   g2_pen(win, 25);
  43.   g2_filled_arc(0, 455, 35, 25, 25, 240, 360);
  44.  
  45.   for (i = 0; i <= 15; i++)
  46.   {
  47.     if (i == 0)
  48.     {
  49.       g2_pen(win, g2_ink(win, 0.5, 0.4, 1.0));
  50.       g2_filled_circle(win, 20+(i*30), 90, 10);
  51.     }
  52.     if ((i % 2) != 0)
  53.     {
  54.       g2_pen(win, g2_ink(win, 0.5, 0.4, 1.0));
  55.       g2_filled_circle(win, 20+(i*30), 90, 10);
  56.     }
  57.     if ((i % 2) == 0)
  58.     {
  59.       g2_pen(win, g2_ink(win, 1.0, 0.4, 0.35));
  60.       g2_filled_circle(win, 20+(i*30), 90, 10);
  61.     }
  62.   }
  63.  
  64.   for (i = 0; i <= 15; i++)
  65.   {
  66.     if (i == 0)
  67.     {
  68.       g2_set_line_width(win, 0);
  69.       g2_pen(win, g2_ink(win, 0.0, 0.0, 1.0));
  70.       g2_filled_circle(win, 20+(i*30), 130, 10);
  71.       g2_pen(win, 1);
  72.       g2_circle(win, 20+(i*30), 130, 10);
  73.      
  74.     }
  75.     if ((i % 2) != 0)
  76.     {
  77.       g2_set_line_width(win, 0);
  78.       g2_pen(win, g2_ink(win, 0.0+(i*0.0625), 0.0+(i*0.0625), 1.0));
  79.       g2_filled_circle(win, 20+(i*30), 130, 10);
  80.       g2_pen(win, 1);
  81.       g2_circle(win, 20+(i*30), 130, 10);
  82.     }
  83.     if ((i % 2) == 0)
  84.     {
  85.       g2_set_line_width(win, 0);
  86.       g2_pen(win, g2_ink(win, 0.0+(i*0.0625), 0.0+(i*0.0625), 1.0));
  87.       g2_filled_circle(win, 20+(i*30), 130, 10);
  88.       g2_pen(win, 1);
  89.       g2_circle(win, 20+(i*30), 130, 10);
  90.     }
  91.   }
  92.   g2_set_line_width(win, 1);
  93.  
  94.   for (i = 0; i <= 499; i++)
  95.   {
  96.     g2_pen(win, g2_ink(win, 1.0, 1.0-(i*0.002), 1.0-(i*0.002)));
  97.     g2_line(win, 10+i, 190, 10+i, 160);
  98.   }
  99.  
  100.   g2_pen(win, 19);
  101.   for (i = 0; i <= 11; i++)
  102.   {
  103.     g2_line(win, 350, 235, 350, 265+(i*cos(0.523598776)));
  104.   }
  105.  
  106.  
  107.  
  108.  
  109.   g2_pen(win, 1);
  110.   g2_set_font_size(win, 24);
  111.   g2_string(win, 10, 280, "Tento text je napisany pismom velkosti 24");
  112.   g2_set_font_size(win, 15);
  113.   g2_string(win, 10, 260, "Tento text je napisany pismom velkosti 15");
  114.   g2_set_font_size(win, 12);
  115.   g2_string(win, 10, 245, "Tento text je napisany pismom velkosti 12");
  116.   g2_set_font_size(win, 10);
  117.   g2_string(win, 10, 230, "Tento text je napisany pismom velkosti 10");
  118.  
  119.  
  120.  
  121.   getchar();
  122.   g2_close(win);
  123.   return 0;
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement