Quelltext /~heha/hs/graphwin.zip/grpht.c

#ifdef _Windows
# include "graphwin.h"
#else
# include <graphics.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void) {
 char *dname[] = { "requests detection", "a CGA", "an MCGA", "an EGA",
   "a 64K EGA", "a monochrome EGA", "an IBM 8514", "a Hercules monochrome",
   "an AT&T 6300 PC", "a VGA", "an IBM 3270 PC"};
 int gdriver, gmode, errorcode;

 detectgraph(&gdriver, &gmode);

 errorcode = graphresult();
 if (errorcode != grOk) {
  printf("Graphics error: %s\n", grapherrormsg(errorcode));
  printf("Press any key to halt:");
  getch();
  exit(1);
 }

#ifndef _Windows
 clrscr();
#endif
 printf("You have %s video display card.\n", dname[gdriver]);
 printf("Press any key to halt:");

 initgraph(&gdriver, &gmode, "o:/bc31/bgi");

 setfillstyle(10,14);
 setcolor(13);
 arc(10,10,270,360, 10);
 bar(10,25,20,50);
 bar3d(10,55,20,70,5,0);
 setcolor(15);
 bar3d(10,75,20,90,5,1);
 circle(20,105,10);
 {
  static int a[]={10,120,10,130,20,120};
  drawpoly(3,a);
 }
 ellipse(20,135,10,120,10,5);
 setfillstyle(2,14);
 fillellipse(20,150,10,5);
 setfillstyle(3,14);
 {
  static int a[]={10,160,10,170,20,160};
  fillpoly(3,a);
 }
 {
  static int a[]={10,180,10,190,30,180,10,180};
  drawpoly(4,a);
  floodfill(12,182,15);
 }
 line(10,200,15,210);
 moveto(10,220);
 linerel(10,10);
 moverel(10,10);
 lineto(10,250);
 pieslice(20,270,0,70,10);
 putpixel(10,280,5);
 rectangle(10,285,20,290);
 setfillstyle(4,14);
 sector(30,320,0,200,10,20);

 setviewport(50,300,150,350,1);
// setbkcolor(1);
 setcolor(5);
 setfillstyle(1,1);
 bar(0,0,200,200);
 setfillstyle(5,14);
 sector(12,10,0,200,10,20);
 circle(30,10,20);
 setviewport(100,300,150,350,0);
 clearviewport();
 circle(30,10,20);

 {
  struct arccoordstype x;
  getarccoords(&x);
  gotoxy(5,1);
  vprintf("Arccoords: %d %d %d %d %d %d\n",&x);
 }
 {
  int x,y;
  getaspectratio(&x,&y);
  gotoxy(5,2);
  printf("Aspect: %d %d",x,y);
 }
 {
  int b,f,m,ps;
  struct palettetype pt, far *defpt;
  b=getbkcolor();
  f=getcolor();
  m=getmaxcolor();
  getpalette(&pt);
  defpt=getdefaultpalette();
  ps=getpalettesize();
  gotoxy(5,3);
  printf("Farben: %d %d %d %d %Fp",b,f,m,ps,defpt);
 }
 gotoxy(5,4);
 printf("%s",getdrivername());
 {
  char buf[8];
  getfillpattern(buf);
  gotoxy(5,5);
  vprintf("Pattern: %04x %04x %04x %04x",buf);
 }
 {
  struct fillsettingstype fi;
  getfillsettings(&fi);
  gotoxy(5,6);
  vprintf("fs: %d %d",&fi);
 }
 {
  int gm;
  gotoxy(5,7);
  gm=getgraphmode();
  printf("%d",gm);
 }
 setviewport(0,0,getmaxx(),getmaxy(),0);
 {
  char bmp[256];
  getimage(11,11,21,21, &bmp);
  putimage(400,400, &bmp, 0);
 }
 {
  struct linesettingstype lst;
  getlinesettings(&lst);
  gotoxy(5,8);
  vprintf("lst: %d %d %d",&lst);
 }
 gotoxy(5,9);
 printf("%d %d %d  %s", getmaxmode(), getmaxx(), getmaxy(), getmodename(0));
 {
  int l,h;
  getmoderange(2,&l,&h);
  gotoxy(5,10);
  printf("%d %d %d", l, h, getpixel(12,27));
 }
 {
  struct textsettingstype tst;
  gettextsettings(&tst);
  gotoxy(5,11);
  vprintf("tst: %d %d %d %d %d",&tst);
 }
 {
  struct viewporttype vpt;
  getviewsettings(&vpt);
  gotoxy(5,12);
  vprintf("vpt: %d %d %d %d %d",&vpt);
 }
 gotoxy(5,13);
 printf("%d %d", getx(), gety());
 printf("%d %d >%s< %d", getx(), gety(), grapherrormsg(graphresult()),
   imagesize(1,1,10,10));
 settextjustify(LEFT_TEXT,TOP_TEXT);
 outtext("test");
 settextstyle(1,0,4);
 putpixel(300,300,1);
 setcolor(1);
 outtextxy(300,300,"Rülps1");
 settextstyle(2,1,4);
 putpixel(300,400,2);
 setcolor(2);
 outtextxy(300,400,"Rülps2");
 settextstyle(3,1,4);
 putpixel(400,400,3);
 setcolor(3);
 outtextxy(400,400,"Rülps3");
 settextstyle(4,0,4);
 putpixel(400,300,4);
 setcolor(4);
 outtextxy(400,300,"Rülps4");
 settextstyle(5,0,4);
 putpixel(500,300,5);
 setcolor(5);
 outtextxy(500,300,"Rülps5");
 settextstyle(6,0,4);
 putpixel(500,400,6);
 setcolor(6);
 outtextxy(500,400,"Rülps6");
 settextstyle(7,0,4);
 putpixel(600,400,7);
 setcolor(7);
 outtextxy(600,400,"R7");
 settextstyle(8,0,4);
 putpixel(600,300,8);
 setcolor(8);
 outtextxy(600,300,"R8");
 settextstyle(9,0,4);
 putpixel(200,300,9);
 setcolor(9);
 outtextxy(200,300,"R9");
 settextstyle(10,0,4);
 putpixel(200,400,10);
 setcolor(10);
 outtextxy(200,400,"R10");
 settextstyle(11,0,4);
 putpixel(100,400,11);
 setcolor(11);
 settextjustify(0,0);
 outtextxy(100,400,"R11");

 getch();
 setbkcolor(1);
 getch();
 setpalette(0,2);		// wie setbkcolor(2)
 setpalette(15,10);
 getch();
/* cleardevice();
 graphdefaults();
 getch();
 arc(10,10,270,360, 10);
 clearviewport();*/
// getch();
/* restorecrtmode();
 getch();*/
 closegraph();
 return 0;
}

/*
_graphfreemem          _graphgetmem
installuserdriver
installuserfont

registerbgidriver      registerfarbgidriver   registerbgifont
registerfarbgifont

setallpalette          setaspectratio
setbkcolor             setcolor               setfillpattern
setfillstyle           setgraphbufsize        setgraphmode
setlinestyle           setpalette             setrgbpalette
settextjustify         settextstyle           setusercharsize
setviewport            setvisualpage          setwritemode
textheight             textwidth*/
Vorgefundene Kodierung: OEM (CP437)1
Umlaute falsch? - Datei sei ANSI-kodiert (CP1252)