bar

Overview :

The "bar" function is used to draw a rectangle with the current fill pattern in graphics mode.

Syntax :
void bar(int left, int top, int right, int bottom);
Description :
The "rectangle" function accepts 4 parameters
  • left -> The x co-ordinate of the upper left point of rectangle

  • top -> The y co-ordinate of the upper left point of rectangle

  • right -> The x co-ordinate of the lower right point of rectangle

  • bottom -> The y co-ordinate of the lower right point of rectangle

  • By default the fill pattern is "SOLID" you can fill style by using setfillstyle

"bar" function does not return any value.

Example :
#include <graphics.h>
#include <stdio.h>
#include <conio.h>

int main()
{
    
   int gm,gd=DETECT,maxcolor;
   
   initgraph(&gd,&gm,"C:\\turboc3\\bgi");
   setcolor(10);
   
   setfillstyle(LINE_FILL,4);
   bar(100,100,200,200);
   
   getch();
   closegraph();
   return 0;
}


Comments

comments powered by Disqus