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>getlinesettings() get current line width, pattern and style</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 getlinesettings()       Get Current Line Width, Pattern and Style

 #include   <graphics.h>

 void far                    getlinesettings(lineinfo);
 struct linesettingstype far *lineinfo;

    getlinesettings() gets 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> and
    pointed to bny 'lineinfo' :

     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 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.)


    Returns:    Nothing.

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

    The following statements save the original line information, draw two
    rectangles of thick, dashed lines, restore the original line settings
    and draw two rectangles with those attributes.

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

           main()
           {
               int gdriver = DETECT;
               int gmode;
               struct linesettingstype *saveinfo;

               initgraph(&gdriver,&gmode,"");
               getlinesettings(&saveinfo);
               setlinestyle(DASHED_LINE,0,THICK_WIDTH);
               rectangle(100,50,300,100);
               rectangle(200,25,400,75);
               setlinestyle(saveinfo.linestyle,saveinfo.upattern,
                            saveinfo.thickness);
               rectangle(100,150,300,200);
               rectangle(200,125,400,175);
               getch();
               closegraph();
           }


See Also: setlinestyle()

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