![]() ![]() To understand these lines lets take a sample line function which draws a line from position (x1,y1) to (x2,y2) – So, first of all, we know that there are three types of lines namely horizontal, vertical and slant lines. In this, we will learn how to draw various types of lines in C using line() function. Now we will learn about various lines that can be drawn using line functions. I hope you understood these three line functions of the C graphics library. So this is the output screenshot which shows the lines drawn by the functions used in the code. The lineto() function draws a line from the current position (30,30) to the position given in parameter i.e (30,200). The linerel() function in this program draws a line from the current position i.e (300,300) to a point (320,350) that is at a relative distance (20,50) from the current position onto the graphics screen. The line() function draws a line from (350,60) position to (200,200) position. In the code above, the setlinestyle(0,0,3) function sets a solid line with a thick width. So the code above illustrates the use of line(), linerel(), and lineto() graphics library functions. Initgraph(
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |