colour.c File Reference

#include <curses.h>

Go to the source code of this file.

Data Structures

struct  colour_pair

Functions

 FILE_LICENCE (GPL2_OR_LATER)
int colour_content (short colour, short *red, short *green, short *blue)
 Identify the RGB components of a given colour value.
int init_pair (short pair, short fcol, short bcol)
 Initialise colour pair.
int pair_content (short pair, short *fcol, short *bcol)
 Get colours of colour pair.

Variables

static struct colour_pair cpairs [COLOUR_PAIRS]


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER   ) 

int colour_content ( short  colour,
short *  red,
short *  green,
short *  blue 
)

Identify the RGB components of a given colour value.

Parameters:
colour colour value
*red address to store red component
*green address to store green component
*blue address to store blue component
Return values:
rc return status code

Definition at line 23 of file colour.c.

References COLOUR_BLUE, COLOUR_GREEN, COLOUR_RED, and OK.

00023                                                                            {
00024         *red = ( ( colour & COLOUR_RED ) ? 1 : 0 );
00025         *green = ( ( colour & COLOUR_GREEN ) ? 1 : 0 );
00026         *blue = ( ( colour & COLOUR_BLUE ) ? 1 : 0 );
00027         return OK;
00028 }

int init_pair ( short  pair,
short  fcol,
short  bcol 
)

Initialise colour pair.

Parameters:
pair colour pair number
fcol foreground colour
bcol background colour

Definition at line 37 of file colour.c.

References colour_pair::bcol, COLOUR_PAIRS, ERR, colour_pair::fcol, and OK.

Referenced by login_ui(), pxe_menu_select(), and settings_ui().

00037                                                      {
00038         struct colour_pair *cpair;
00039 
00040         if ( ( pair < 1 ) || ( pair >= COLOUR_PAIRS ) )
00041                 return ERR;
00042         
00043         cpair = &cpairs[pair];
00044         cpair->fcol = fcol;
00045         cpair->bcol = bcol;
00046         return OK;
00047 }

int pair_content ( short  pair,
short *  fcol,
short *  bcol 
)

Get colours of colour pair.

Parameters:
pair colour pair number
Return values:
fcol foreground colour
bcol background colour

Definition at line 56 of file colour.c.

References colour_pair::bcol, COLOUR_PAIRS, ERR, colour_pair::fcol, and OK.

Referenced by ansiscr_putc().

00056                                                           {
00057         struct colour_pair *cpair;
00058 
00059         if ( ( pair < 0 ) || ( pair >= COLOUR_PAIRS ) )
00060                 return ERR;
00061         
00062         cpair = &cpairs[pair];
00063         *fcol = cpair->fcol;
00064         *bcol = cpair->bcol;
00065         return OK;
00066 }


Variable Documentation

struct colour_pair cpairs[COLOUR_PAIRS] [static]

Initial value:

 {
        [0] = { COLOUR_WHITE, COLOUR_BLACK },
}

Definition at line 10 of file colour.c.


Generated on Tue Apr 6 20:01:46 2010 for gPXE by  doxygen 1.5.7.1