+ Added new keyword to support background transparency

TRANSPARENTCOLORS Yes/No
  default is "No". If set to "Yes" BLACK background color will become
  transparent. Supported for ncurses compilation, otherwise do nothing.
This commit is contained in:
Stanislav Mekhanoshin
2007-06-21 19:03:18 +00:00
parent 0bf406cc77
commit 0d3a3b3ebc
11 changed files with 47 additions and 5 deletions

View File

@@ -329,6 +329,8 @@ public:
int detectadapter ();
void detectinfo (GVidInfo* _info);
static
void setcolorpairs (bool enabletransparent=false);
void resetcurr ();

View File

@@ -222,11 +222,7 @@ int GVid::detectadapter() {
start_color();
/* init colors */
short mycolors[] = { COLOR_BLACK, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN,
COLOR_RED, COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE };
for(int i = 1; i < 64 and i < COLOR_PAIRS; i++)
init_pair(i, mycolors[(~i)&0x07], mycolors[(i>>3)&0x07]);
setcolorpairs();
adapter = V_VGA;
@@ -435,6 +431,20 @@ int GVid::detectadapter() {
return adapter;
}
void GVid::setcolorpairs(bool enabletransparent) {
#if defined(__USE_NCURSES__)
/* init colors */
short mycolors[] = { COLOR_BLACK, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN,
COLOR_RED, COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE };
if(enabletransparent)
use_default_colors();
for(int i = 1; i < 64 and i < COLOR_PAIRS; i++) {
short bg=mycolors[(i>>3)&0x07];
init_pair(i, mycolors[(~i)&0x07], ((bg==COLOR_BLACK) && enabletransparent)?-1:bg);
}
#endif
}
// ------------------------------------------------------------------
// Video info detect