Similar Programs
- Flood Fill program in C
- Triangle Rotation Program
- Text animation program in C
- C program for fixed point scaling and rotation
- C Program for shearing of triangle, line and rectangle
- C program to plot different types of lines
- Scaling program in C
- Font animation program in C
- Midpoint ellipse drawing program in C
- Circle Midpoint program in C
- Translation program in C
- Bresenhem Circle drawing program in C
- String Generation program in C
- Bresenhem Line drawing program in C
- Plotting a pixel in C
- DDA line drawing program in C
- Boundary fill program in C
- Character Generation program in C
- Triangle Rotation program in C
//program for line attributes(line style) #include <graphics.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> int xa,xb,ya,yb,x1,x2,y1,y2; void pol(int xa,int ya,int xb,int yb) { printf("Enter starting point (x1,y1)"); scanf("%d%d",&xa,&ya); printf("Enter Endpoints(x2,y2)"); scanf("%d%d",&xb,&yb); x1=xa;x2=xb;y1=ya;y2=yb; } void main() { int gd = DETECT, gm,i; initgraph(&gd,&gm, "c:\\tc\\bgi"); setbkcolor(BLUE); do { clrscr(); printf("press\n"); printf("1 for SOLID_LINE\n2 for DOTTED_LINE\n3 for CENTER_LINE\n"); printf("4 for DASHED_LINE\n 5 for USERBIT_LINE\n"); scanf("%d",&i); switch(i) { case 1: pol(xa,ya,xb,yb); setlinestyle(SOLID_LINE,1,1); setcolor(RED); line(x1,y1,x2,y2); getch(); cleardevice(); break; case 2: pol(xa,ya,xb,yb); setlinestyle(DOTTED_LINE,1,1); setcolor(RED); line(x1,y1,x2,y2); getch(); cleardevice(); break;
case 3: pol(xa,ya,xb,yb); setlinestyle(CENTER_LINE,1,1); setcolor(RED); line(x1,y1,x2,y2); getch(); cleardevice(); break;
case 4: pol(xa,ya,xb,yb); setlinestyle(DASHED_LINE,1,1); setcolor(RED); line(x1,y1,x2,y2); getch(); cleardevice(); break; case 5: pol(xa,ya,xb,yb); setlinestyle(USERBIT_LINE,1,1); setcolor(RED); line(x1,y1,x2,y2); getch(); cleardevice(); break;
default:exit(0); } }while(i!=0); getch(); closegraph(); }
0 comments:
Post a Comment