User Tools

Site Tools


c:graphics.h:getdisplaycolor

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

c:graphics.h:getdisplaycolor [2015/05/06 23:06] (current)
Line 1: Line 1:
 +===== getdisplaycolor =====
 +
 +
 +====Syntax of getdisplaycolor ==== 
 + <code c>
 +#include <graphics.h>
 +int getdisplaycolor( int color );
 +  </code>
 +
 +
 +==== Description of getdisplaycolor ==== 
 +<code c>
 +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.
 +</code>
 +
 +
 +==== Example of getdisplaycolor ====
 +<code c>
 +/* 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';
 +   }
 +}
 +</code>
 +
 +
 +==== See also ====
 +[[getpixel]]
 +[[putpixel]]
 +[[wincolor]]
 +
 +
 +===== 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 Datenschutz