The header file graphics.h contains setlinestyle() function which sets the style for all lines drawn by line, lineto, rectangle, drawpoly, and so on.
void setlinestyle(int linestyle, unsigned upattern, int thickness);
Input : x = 200, y = 100 Output : x and y are initialized as (200, 100). For every line, value of y increments by 25 to change the position. The line style keep changing corresponding to value of first parameter(c).
Explanation : linestyle specifies in which of several styles subsequent lines will be drawn (such as solid, dotted, centered, dashed).
upattern is a 16-bit pattern that applies only if linestyle is USERBIT_LINE (4). In that case, whenever a bit in the pattern word is 1, the corresponding pixel in the line is drawn in the current drawing color. A value for ‘upattern’ must always be supplied. It is simply ignored if ‘linestyle’ is not USERBIT_LINE (4).
thickness specifies whether the width of subsequent lines drawn will be normal or thick.
Below is the implementation of setlinestyle() function :
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- How to call function within function in C or C++
- Write a one line C function to round floating point numbers
- Does C support function overloading?
- How can I return multiple values from a function?
- What is the purpose of a function prototype?
- How to declare a pointer to a function?
- C function to Swap strings
- Can we call an undeclared function in C++?
- What is evaluation order of function parameters in C?
- Can we use function on left side of an expression in C and C++?
- Function Pointer in C
- Importance of function prototype in C
- What happens when a function is called before its declaration in C?
- Default arguments and virtual function
- Function overloading and const keyword
- How to measure time taken by a function in C?
- Comparator function of qsort() in C
- Can we access private data members of a class without using a member or a friend function?
- Print substring of a given string without using any string function and loop in C
- How to print range of basic data types without any library function and constant in C?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.