User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







c:graphics.h:getdisplaycolor
click
to support this page (eg 0,42 € or so) Thanks.

getdisplaycolor

Syntax of getdisplaycolor

#include <graphics.h>
int getdisplaycolor( int color );
 

Description of getdisplaycolor

The getdisplaycolor function is available in the winbgim implementation
of BGI graphics. getdisplaycolor is used to get an color that the current
actual display device can display.

Example of getdisplaycolor

/* getdisplaycolor example */
 
#include <graphics.h>
#include <iostream>
using namespace std;
 
int main(void)
{
   int r, g, b; // Components of r, g and b for a color.
   int color_request, color_actual;
 
   /* initialize graphics window */
   initwindow(300, 300);
 
   /* Get a user-defined color */
   cout << "Please enter amounts of red, green and blue: ";
   cin >> r >> g >> b;
 
   /* Compute what this color will display as. */
   color_request = COLOR(r, g, b);
   color_actual = getdisplaycolor(color_request);
   if (IS_BGI_COLOR(color_actual))
   {
cout << "That will display as BGI color number " << color_actual <<
endl;
   }
   else
   {
 cout << "That color will display on this machine with components:
\n"
	    << "Red:   " << RED_VALUE(color_actual)   << '\n'
<< "Green: " << GREEN_VALUE(color_actual) << '\n'
<< "Blue:  " << BLUE_VALUE(color_actual)  << '\n';
   }
}

See also

output of getdisplaycolor example

  no output of example at the moment
  do not hesitate and add it...  
advertising
c/graphics.h/getdisplaycolor.txt · Last modified: 2015/05/06 23:06 (external edit)

Impressum