home *** CD-ROM | disk | FTP | other *** search
- /*
- demo some of the BGI predicates
- NOTE - the sizes of the shapes drawn here are for a VGA; you may
- want to modify this somewhat for CGA/EGA output
- */
- #include "bgidef.do"
-
- initGraph(DETECT,0,envSymbol("bgipath"));
- setTextStyle(SANS_SERIF_FONT,HORIZ_DIR,3);
- outText("Welcome to the BGI...Press any key to continue");
- setTextStyle(DEFAULT_FONT,HORIZ_DIR,1);
- inkey();
-
- /*
- text
- */
- clearDevice();
- outTextXY(200,50,"Text Demonstration");
- setTextStyle(0,0,1);
- outTextXY(100,100,"Default Font");
- setTextStyle(1,0,1);
- outTextXY(100,150,"Triplex Font");
- setTextStyle(2,0,1);
- outTextXY(100,200,"Stroked small font");
- setTextStyle(3,0,1);
- outTextXY(100,250,"Stroked Sans-Serif font");
- setTextStyle(4,0,1);
- outTextXY(100,300,"Gothic Font");
- setTextStyle(4,0,4);
- outTextXY(300,300,"Magnified Gothic");
- setTextStyle(0,0,1);
- inkey();
-
- /*
- lines
- */
- clearDevice();
- outTextXY(200,50,"BGI Line Drawing Demonstration");
- line(100,100,100,300); % draw a line
- setLineStyle(1,0,0);
- line(150,100,150,300); % dotted line
- setLineStyle(2,0,0);
- line(200,100,200,300); % centered line
- setLineStyle(3,0,0);
- line(250,100,250,300); % dashed line
- setLineStyle(4,$0F0F,3);
- line(300,100,300,300); % user defined
- setLineStyle(0,0,1);
- outTextXY(20,450,"Press any key to continue...");
- inkey();
-
-
- /*
- circles
- */
- clearDevice();
- outTextXY(350,50,"BGI Circles Demonstration");
- for(i=1;i<150;i=i+5) circle(200,200,i);
- outTextXY(20,450,"Press any key to continue...");
- inkey();
-
- /*
- ellipses
- */
- clearDevice();
- outTextXY(200,50,"BGI Ellipse Demonstration");
- ellipse(200,200,0,360,200,100);
- fillEllipse(300,400,150,50);
- outTextXY(20,450,"Press any key to continue");
- inkey();
-
- /*
- rectangles
- */
- clearDevice();
- outTextXY(200,50,"BGI Rectangle Demonstration");
- for(i=10;i<200;i=i+30) rectangle(i,i+10,i+160,i+100);
- outTextXY(20,450,"Press any key to continue...");
- inkey();
-
- /*
- bar graphs
- */
- clearDevice();
- outTextXY(200,50,"BGI 3-D Bar Graph Demonstration");
- setFillStyle(HATCH_FILL,YELLOW);
- bar3d(100,200,250,300,20,1);
- setFillStyle(WIDE_DOT_FILL,WHITE);
- bar3d(400,100,500,300,10,1);
- outTextXY(100,340,"Bar Graph #1");
- outTextXY(400,340,"Bar Graph #2");
- outTextXY(22,450,"Press any key to continue...");
- readchar();
-
- /*
- pie chart
- */
- clearDevice();
- setFillStyle(CLOSE_DOT_FILL,WHITE);
- outTextXY(200,50,"BGI Pie Chart Demonstration");
- pieSlice(100,200,0,90,100);
- pieSlice(100,200,110,140,100);
- pieSlice(100,200,180,270,100);
- outTextXY(100,320,"Pie Number 1");
- pieSlice(400,200,90,279,100);
- outTextXY(400,320,"Pie Number 2");
- outTextXY(20,400,"Press any key to continue...");
- inkey();
-
- /*
- polygon
- */
- clearDevice();
- outTextXY(100,50,"BGI drawPoly Demonstration");
- setFillStyle(SOLID_FILL,RED);
- drawPoly([50,50,100,100,150,150,200,200,150,200,100,250,50,300,50,50]);
- fillPoly([300,300,330,330,320,360,310,370,300,380]);
- outTextXY(20,450,"Press any key to continue...");
- inkey();
-
- /*
- end of demo
- */
- closeGraph();
- ? "That's all folks..";
-