C program to set the different line style
setlinestyle function is used to set the line style.
General syntax of setlinestyle function is :
setlinestyle( int linestyle, unsigned upattern, int thickness);
It takes 3 argument first one is the line style. There are following line style available with the setlinestyle function with its corresponding integer value.
General syntax of setlinestyle function is :
setlinestyle( int linestyle, unsigned upattern, int thickness);
It takes 3 argument first one is the line style. There are following line style available with the setlinestyle function with its corresponding integer value.
| Line Style | int value | 
|---|---|
| SOLID_LINE | 0 | 
| DOTTED_LINE | 1 | 
| CENTER_LINE | 2 | 
| DASHED_LINE | 3 | 
| USERBIT_LINE | 4 | 
The second argument is to use bit pattern and last one is for line's thickness it can be 1 pixel or 3 pixel wide.
C graphic program to demonstrate setlinestyle function 
#include <graphics.h>
#include <stdio.h>
int main( )
{
int gd=DETECT, gm;
initgraph(&gd,&gm,"C:\\tc\\bgi");
setlinestyle(1,1,1);
line(100,100,400,100);
setlinestyle(DASHED_LINE,1,3);
line(100,150,400,150);
setlinestyle(2,1,1);
line(100,200,400,200);
getch();
closegraph();
return 0;
}


 
0 comments:
Post a Comment