VOOZH about

URL: https://www.geeksforgeeks.org/c/setlinestyle-function-c/

⇱ setlinestyle() function in C - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

setlinestyle() function in C

Last Updated : 25 Jan, 2018
The header file graphics.h contains setlinestyle() function which sets the style for all lines drawn by line, lineto, rectangle, drawpoly, and so on. Syntax :
void setlinestyle(int linestyle, unsigned upattern,
 int thickness);
Examples :
Input : x = 200, y = 100
Output : 👁 Image
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). 👁 Image
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. 👁 Image
Below is the implementation of setlinestyle() function : Output :
👁 Image
Comment