setcolor

Overview :

This function is set the color of the pixel in the graphics mode.

Syntax :
void setcolor(int color);

or


void setcolor(color name);
Description :

The "setcolor" function accepts 1 parameters

  • color -> It is the integer value ranging from 0 to getmaxcolor supported by the graphics system

  • color name -> In this parameter you have to give the name of the color to be set


"setcolor" function does not return any value.
Example :
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main()
{

   int gm,gd=DETECT;
   clrscr();

   initgraph(&gd,&gm,"C:\\turboc3\\bgi");

   setcolor(10);


   outtextxy(10,10,"The color corresponding to the integer value of 10");

   setcolor(RED);

   outtextxy(50,10,"Now the color is set to RED");

   getch();
   closegraph();
   return 0;
}

Comments

comments powered by Disqus