Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>setlinestyle() set current line width, pattern and style</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 setlinestyle()          Set Current Line Width, Pattern and Style

 #include   <graphics.h>

 void       far setlinestyle(linestyle,upattern,thickness);
 int        linestyle;
 unsigned   upattern;
 int        thickness;

    setlinestyle() sets the current line width, pattern and style for all
    the line-drawing functions. These values are stored in the structure
    'linesettingstype' which is defined in <graphics.h> :

     struct linesettingstype {
          int linestyle;
          unsigned upattern;
          int thickness;
     };

    'linestyle' is defined by one of the enumeration 'line_styles' found
    in <graphics.h> :

     Name           Value     Description
     SOLID_LINE       0       Solid line
     DOTTED_LINE      1       Dotted line
     CENTER_LINE      2       Center line
     DASHED_LINE      3       Dashed line
     USERBIT_LINE     4       User-defined line

    'thickness' can be one of two values, normal or thick:

     Name           Value     Description
     NORM_WIDTH       1       1 pixel wide
     THICK_WIDTH      3       3 pixels wide

    'upattern' is only recognized if 'linestyle' is set to USERBIT_LINE;
    the user is defining his own style.  'upattern' is a 16 bit pattern
    where the corresponding line pixel is drawn if that bit is set to 1.
    (If all 16 bits were set (0xFFFF), a solid line would be drawn.)  A
    value for 'upattern' must always be supplied. It is simply ignored it
    'linestyle' is not USERBIT_LINE.


    Returns:    Nothing. If coded, graphresult() returns -11 (graphics
                error) if invalid input is passed.  The current line
                style remains the same.

   -------------------------------- Example ---------------------------------

    The following statements draw two rectangles of thick, dashed lines.

           #include <graphics.h>
           #include <conio.h>

           main()
           {
               int gdriver = DETECT;
               int gmode;

               initgraph(&gdriver,&gmode,"");
               setlinestyle(DASHED_LINE,0,THICK_WIDTH);
               rectangle(100,50,300,100);
               rectangle(200,25,400,75);
               getch();
               closegraph();
           }


See Also: getlinesettings()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson