Beispiel #1
0
  void draw_frame(const std::string& title, int x, int y, int w, int h)
  {
    for (int _y = y; _y < y + h; _y++)
    {
      for (int _x = x; _x < x + w; _x++)
      {
        if (_y == y && _x == x)                           putchar(_x, _y, 218);
        else if (_y == y && _x == (x + w - 1))            putchar(_x, _y, 191);
        else if (_y == (y + h - 1) && _x == x)            putchar(_x, _y, 192);
        else if (_y == (y + h - 1) && _x == (x + w - 1))  putchar(_x, _y, 217);
        else if (_x == x || (_x == x + w - 1))            putchar(_x, _y, 179);
        else if (_y == y || (_y == y + h - 1))            putchar(_x, _y, 196);
        else                                              putchar(_x, _y, ' ');
      }
    }

    color_t current_fore = get_foreground_color();
    color_t current_back = get_background_color();

    set_foreground_color(color_black);
    set_background_color(color_white);

    io::printf(x + w / 2, y, CENTER, "%s", title.c_str());

    set_foreground_color(current_fore);
    set_background_color(current_back);
  }
Beispiel #2
0
    void GLWindow::set_theme(Theme theme)
    {
      GLfloat fg[4]={1,1,1,1};
      GLfloat bg[4]={0,0,0,1};

      if(theme==DARK)
	{
	  set_foreground_color(fg);
	  set_background_color(bg);
	}
      else
	{
	  set_foreground_color(bg);
	  set_background_color(fg);
	}
    }
Beispiel #3
0
int start_color(void)
{
	T((T_CALLED("start_color()")));

	if (set_original_colors() != TRUE)
	{
		set_foreground_color(COLOR_WHITE, _nc_outch);
		set_background_color(COLOR_BLACK, _nc_outch);
	}

	if (max_pairs != -1)
		COLOR_PAIRS = SP->_pair_count = max_pairs;
	else
		returnCode(ERR);
	SP->_color_pairs = typeCalloc(unsigned short, max_pairs);
	SP->_color_pairs[0] = PAIR_OF(COLOR_WHITE, COLOR_BLACK);
	if (max_colors != -1)
		COLORS = SP->_color_count = max_colors;
	else
		returnCode(ERR);
	SP->_coloron = 1;

	SP->_color_table = malloc(sizeof(color_t) * COLORS);
	if (hue_lightness_saturation)
	    memcpy(SP->_color_table, hls_palette, sizeof(color_t) * COLORS);
	else
	    memcpy(SP->_color_table, cga_palette, sizeof(color_t) * COLORS);

	T(("started color: COLORS = %d, COLOR_PAIRS = %d", COLORS, COLOR_PAIRS));

	returnCode(OK);
}
Beispiel #4
0
int		do_video_set_fg_color(void)
{
  char		*arg;

  arg = parse_next_arg();
  set_foreground_color(arg);
  return (0);
}
Beispiel #5
0
void clear_surface(term_data* td)
{
	cairo_t* cr;
	cr = cairo_create(td->surface);
	set_foreground_color(cr, TERM_DARK);
	cairo_paint(cr);
	cairo_destroy(cr);
}
Beispiel #6
0
void drawn_progress_bar(cairo_surface_t *surface, font_info *font, int x, int y, float curr, float max, byte color, int len)
{
	cairo_t *cr;
	int temp;
	cairo_rectangle_t r;
	float percent;
	measurements size;
	
	 size.w = font->w;
	size.h = font->h;
	
	if (surface != NULL)
	{
	cr = cairo_create(surface);
	
	if (max > 0)
		percent = curr / max;
	else
		percent = 0;
	
	init_cairo_rect(&r, (size.w * x)+ 1, (size.h) * y + 1,  (size.w * len) - 1, size.h - 2);
	cairo_clear(surface, r, TERM_DARK);
	
	temp = cairo_get_line_width(cr);
	set_foreground_color(cr, color);
	
	if (percent > 0)
	{
		cairo_set_line_width(cr, size.h);
		cairo_move_to(cr, r.x, r.y + (r.height * 0.5));
		cairo_line_to(cr, (size.w * ((len * percent) + x)), r.y + (r.height * 0.5));
		cairo_stroke(cr);
	}
	if (max > 0)
	{
		cairo_set_line_width(cr, 1);
		
		set_foreground_color(cr, TERM_SLATE);
		c_rect(cr, r);
		cairo_stroke(cr);
		
		cairo_set_line_width(cr, temp);
	}
		cairo_destroy(cr);
	}
}
Beispiel #7
0
void clear_chars(term_data* td, int x, int y, int n)
{
	cairo_t* cr;
	cr = cairo_create(td->surface);
	set_foreground_color(cr, TERM_DARK);
	cairo_rectangle(cr, x * td->font.w, y * td->font.h, n * td->font.w, td->font.h);
	cairo_fill(cr);
	cairo_destroy(cr);
}
Beispiel #8
0
void rub_bar(GdkDrawable *drawable, GdkGC *gc, int barWidth)
{
	int width, height;
	gdk_drawable_get_size(drawable, &width, &height);
	set_foreground_color(gc, 65535*255/255, 65535*255/255, 65535*255/255);
	gdk_draw_rectangle(drawable, gc, TRUE, 0, 0, barWidth, height);
	gdk_draw_rectangle(drawable, gc, TRUE, 0, height-barWidth, width, barWidth);
	gdk_draw_rectangle(drawable, gc, TRUE, 0, 0, width, barWidth);
	gdk_draw_rectangle(drawable, gc, TRUE, width-barWidth,0, barWidth, height);
}
Beispiel #9
0
void color_chars(term_data* td, int x, int y, int n, byte a, bool trans)
{
	cairo_t* cr;
	cr = cairo_create(td->surface);
	set_foreground_color(cr, a);
	cairo_rectangle(cr, x * td->font.w, y * td->font.h, n * td->font.w, td->font.h);
	if (trans) cairo_set_operator(cr, CAIRO_OPERATOR_ADD);
	cairo_fill(cr);
	cairo_destroy(cr);
}
Beispiel #10
0
void OSDPretty::Load() {
  QSettings s;
  s.beginGroup(kSettingsGroup);

  foreground_color_ = QColor(s.value("foreground_color", 0).toInt());
  background_color_ = QColor(s.value("background_color", kPresetBlue).toInt());
  background_opacity_ = s.value("background_opacity", 0.85).toDouble();
  popup_display_ = s.value("popup_display", -1).toInt();
  popup_pos_ = s.value("popup_pos", QPoint(0, 0)).toPoint();
  font_.fromString(s.value("font", "Verdana,9,-1,5,50,0,0,0,0,0").toString());
  disable_duration_ = s.value("disable_duration", false).toBool();

  set_font(font());
  set_foreground_color(foreground_color());
}
Beispiel #11
0
/*
 * Erase the whole term.
 */
void cairo_clear(cairo_surface_t *surface, cairo_rectangle_t r, byte c)
{
	cairo_t *cr = NULL;
	
	if ((surface != NULL) &&(cairo_surface_status(surface) == CAIRO_STATUS_SUCCESS))
	{
	cr = cairo_create(surface);
	
	if (cr !=NULL)
	{
		cairo_save(cr);
		c_rect(cr, r);
		set_foreground_color(cr, c);
		cairo_fill(cr);
		cairo_close_path(cr);
		cairo_restore(cr);
	}
	
		cairo_destroy(cr);
	}
}
Beispiel #12
0
void draw_toy_text(cairo_t *cr, font_info *font, measurements *actual, int x, int y, int n, byte a, cptr s)
{
	char str[255];
	cairo_rectangle_t r;
	
	set_cairo_font_size(cr, font);
	
	init_cairo_rect(&r, x * font->w, y * font->h,  font->w * n, font->h);
	
	c_rect(cr,r);
	cairo_stroke(cr);
	
	my_strcpy(str, s, n + 1);
	
	if (cr !=NULL)
	{
		set_foreground_color(cr, a);
		cairo_move_to(cr, x * (font->w), (y + 1) * font->h - font->descent);
		cairo_show_text(cr, str);
	}
}
Beispiel #13
0
void cairo_cursor(cairo_surface_t *surface, cairo_rectangle_t r, byte c)
{
	cairo_t *cr;
	
	if (surface != NULL)
	{
	cr = cairo_create(surface);
	if (cr !=NULL)
	{
		cairo_save(cr);
		c_rect(cr, r);
		
		set_foreground_color(cr, c);
	
		cairo_set_operator(cr, CAIRO_OPERATOR_ADD);
		cairo_fill(cr);
		cairo_close_path(cr);
		cairo_restore(cr);
	}
		cairo_destroy(cr);
	}
}
Beispiel #14
0
void draw_text(cairo_surface_t *surface, font_info *font, measurements *actual, int x, int y, int n, byte a, cptr s)
{
	cairo_t *cr;
	
	if (surface != NULL)
	{
	cairo_rectangle_t r;
	PangoLayout *layout;
	PangoFontDescription *temp_font;
		
	cr = cairo_create(surface);
	#ifndef USE_PANGO
	draw_toy_text(cr, font, actual, x, y, n, a, s);
	#else
	
	if (cr !=NULL)
	{
	init_cairo_rect(&r, x * font->w, y * font->h,  actual->w * n, actual->h);
	
	cairo_clear(surface, r, TERM_DARK);
		
	/* Create a PangoLayout, set the font and text */
	layout = pango_cairo_create_layout(cr); 
	
	temp_font = pango_font_description_from_string(font->name);
	set_foreground_color(cr, a);
	pango_layout_set_text(layout, s, n);
	pango_layout_set_font_description(layout, temp_font);
	
	/* Draw the text to the pixmap */
	cairo_move_to(cr, x * font->w, y * font->h);
	
	pango_cairo_show_layout(cr, layout);
	g_object_unref(G_OBJECT(layout));
	}
	#endif
	cairo_destroy(cr);
	}
}
Beispiel #15
0
void write_chars(term_data* td, int x, int y, int n, byte a, const char* text)
{
	PangoLayout *layout;
	PangoFontDescription* font;
	cairo_t *cr;
	
	clear_chars(td, x, y, n);
	
	cr = cairo_create(td->surface);
	set_foreground_color(cr, a);
	
	layout = pango_cairo_create_layout(cr);
	font = pango_font_description_from_string(td->font.name);
	pango_layout_set_font_description (layout, font);
	pango_layout_set_text (layout, text, n);
	
	cairo_move_to(cr, x * td->font.w, y * td->font.h);
	pango_cairo_show_layout (cr, layout);

	g_object_unref (layout);
	pango_font_description_free(font);
	cairo_destroy(cr);
}
Beispiel #16
0
ttext &ttext::set_foreground_color(const SDL_Color color)
{
	set_foreground_color((color.r << 16) + (color.g << 8) + color.b);

	return *this;
}
Beispiel #17
0
void _nc_do_color(int pair, bool reverse, int (*outc)(int))
{
    short fg, bg;

    if (reverse)
    	pair = -pair;

    if (pair == 0)
    {
	if (orig_pair)
	{
	    TPUTS_TRACE("orig_pair");
	    tputs(orig_pair, 1, outc);
	}
	else if (set_color_pair)
	{
	    TPUTS_TRACE("set_color_pair");
	    tputs(tparm(set_color_pair, pair), 1, outc);
	}
	else
	{
	    set_foreground_color(COLOR_WHITE, outc);
	    set_background_color(COLOR_BLACK, outc);
	}
    }
    else
    {
	if (set_color_pair)
	{
	    TPUTS_TRACE("set_color_pair");
	    tputs(tparm(set_color_pair, pair), 1, outc);
	}
	else
	{
	    if ( pair_content(pair, &fg, &bg) == ERR)
		  return;
	    if (reverse) {
		short xx = fg;
		fg = bg;
		bg = xx;
	    }

	    T(("setting colors: pair = %d, fg = %d, bg = %d", pair, fg, bg));

	    if (fg == C_MASK || bg == C_MASK)
	    {
		if (set_original_colors() != TRUE)
		{
			if (fg == C_MASK)
				set_foreground_color(COLOR_WHITE, outc);
			if (bg == C_MASK)
				set_background_color(COLOR_BLACK, outc);
		}
	    }
	    if (fg != C_MASK)
	    {
		set_foreground_color(fg, outc);
	    }
	    if (bg != C_MASK)
	    {
		set_background_color(bg, outc);
	    }
	}
    }
}
Beispiel #18
0
void brush_bar(GdkDrawable *drawable, GdkGC *gc, int barWidth, int no)
{
	int width, height;
	GdkPoint points[3];

	gdk_drawable_get_size(drawable, &width, &height);
	set_foreground_color(gc, 65535*222/255, 65535*217/255, 65535*202/255);
	switch (no) {
		case 1:
			gdk_draw_rectangle(drawable, gc, TRUE, 0, height/4, barWidth-1, height/2);
			points[0].x = 7, points[0].y = height/2-5;
			points[1].x = 2, points[1].y = height/2;
			points[2].x = 7, points[2].y = height/2+5;
			set_foreground_color(gc, 65535*255/255, 65535*255/255, 65535*255/255);
			gdk_draw_polygon(drawable, gc, TRUE, points, 3);
			break;
		case 2:
			gdk_draw_rectangle(drawable, gc, TRUE, 0, 3*height/4, barWidth-1, height/4-1);
			gdk_draw_rectangle(drawable, gc, TRUE, 0, height-barWidth+1, width/4, barWidth-1);
			points[0].x = 3, points[0].y = height-10;
			points[1].x = 3, points[1].y = height-3;
			points[2].x = 10, points[2].y = height-3;
			set_foreground_color(gc, 65535*255/255, 65535*255/255, 65535*255/255);
			gdk_draw_polygon(drawable, gc, TRUE, points, 3);
			break;
		case 3:
			gdk_draw_rectangle(drawable, gc, TRUE, width/4, height-barWidth+1, width/2-1, barWidth-1);
			points[0].x = width/2, points[0].y = height-2;
			points[1].x = width/2+5, points[1].y = height-7;
			points[2].x = width/2-5, points[2].y = height-7;
			set_foreground_color(gc, 65535*255/255, 65535*255/255, 65535*255/255);
			gdk_draw_polygon(drawable, gc, TRUE, points, 3);
			break;
		case 4:
			gdk_draw_rectangle(drawable, gc, TRUE, width*3/4, height-barWidth+1, width/4, barWidth-1);
			gdk_draw_rectangle(drawable, gc, TRUE, width-barWidth+1, height*3/4, barWidth-1, height/4);
			points[0].x = width-10, points[0].y = height-3;
			points[1].x = width-3, points[1].y = height-3;
			points[2].x = width-3, points[2].y = height-10;
			set_foreground_color(gc, 65535*255/255, 65535*255/255, 65535*255/255);
			gdk_draw_polygon(drawable, gc, TRUE, points, 3);
			break;
		case 5:
			gdk_draw_rectangle(drawable, gc, TRUE, width-barWidth+1, height/4, barWidth-1, height/2);
			points[0].x = width-7, points[0].y = height/2-5;
			points[1].x = width-2, points[1].y = height/2;
			points[2].x = width-7, points[2].y = height/2+5;
			set_foreground_color(gc, 65535*255/255, 65535*255/255, 65535*255/255);
			gdk_draw_polygon(drawable, gc, TRUE, points, 3);
			break;
		case 6:
			gdk_draw_rectangle(drawable, gc, TRUE, width*3/4, 0, width/4, barWidth-1);
			gdk_draw_rectangle(drawable, gc, TRUE, width-MARGIN+1, 0, barWidth-1, height/4);
			points[0].x = width-10, points[0].y = 3;
			points[1].x = width-3, points[1].y = 3;
			points[2].x = width-3, points[2].y = 10;
			set_foreground_color(gc, 65535*255/255, 65535*255/255, 65535*255/255);
			gdk_draw_polygon(drawable, gc, TRUE, points, 3);
			break;
		case 7:
			gdk_draw_rectangle(drawable, gc, TRUE, width/4, 0, width/2, barWidth-1);
			points[0].x = width/2, points[0].y = 2;
			points[1].x = width/2-5, points[1].y = 7;
			points[2].x = width/2+5, points[2].y = 7;
			set_foreground_color(gc, 65535*255/255, 65535*255/255, 65535*255/255);
			gdk_draw_polygon(drawable, gc, TRUE, points, 3);
			break;
		case 8:
			gdk_draw_rectangle(drawable, gc, TRUE, 0, 0, barWidth-1, height/4);
			gdk_draw_rectangle(drawable, gc, TRUE, 0, 0, width/4, barWidth-1);
			points[0].x = 3, points[0].y = 3;
			points[1].x = 3, points[1].y = 10;
			points[2].x = 10, points[2].y = 3;
			set_foreground_color(gc, 65535*255/255, 65535*255/255, 65535*255/255);
			gdk_draw_polygon(drawable, gc, TRUE, points, 3);
			break;
	}
}
Beispiel #19
0
/***********************************************************************
* draw a frame
***********************************************************************/
static void draw_frame(CellPadData *data)
{
    int8_t i;

    // all 32bit colors are ARGB, the framebuffer format
    set_foreground_color(0xFFFFFFFF);     // white, opac

    // set the right background color for current view
    set_background_color(bg_color_menu[view]);    

    draw_background();

    #ifdef HAVE_STARFIELD
    // first draw stars, keeping them under text lines
    move_star();
    #endif

    // print headline string, coordinates in canvas
    print_text(4, 4, "PS3 VSH Menu");

    // print all menu entries for view, and the current selected entry in green
    for(i = 0; i < max_menu[view]; i++)
    {
        i == line ? set_foreground_color(0xFF00FF00) : set_foreground_color(0xFFFFFFFF);

        print_text(4, 8 + ((FONT_H +1) * (i + 1)), entry_str[view][i]);
    }

    // (re)set back after draw last line
    set_foreground_color(0xFFFFFFFF);

    // ...

    // second menu, red one:
    if(view == 1)
    {
        /*
          hexdump pad data: store in text 8 buttons in a row
          in "%.4x" format plus 1 for ':', last one will be
          replaced by terminator, no need to add 1
        */
        char templn[8 * (4 + 1)];
        uint16_t tmp_x;

        // test text alignment
        sprintf(templn, "*%p, %d bytes;", data, data->len * sizeof(uint16_t));
        tmp_x = get_aligned_x(templn, CENTER);
        print_text(tmp_x, 180, templn);

        // hexdump first 32 buttons
        uint16_t x = 0, y = 200;
        for(i = 0; i < 32; i++)
        {
            sprintf(&templn[x], "%.4x:", data->button[i]);
            x += 5;
            templn[x] = '\0';

            if(x %8 == 0)
            {
                // overwrite last ':' with terminator
                templn[x -1] = '\0';
                tmp_x = get_aligned_x(templn, CENTER);
                print_text(tmp_x, y, templn);
                x = 0, y += (FONT_H +1);        // additional px to next line
            }
        }

        // update temp color
        uint32_t tmp_c = ARGB(a, r, g, b);

        // start draw text with updated color
        set_foreground_color(tmp_c);

        // print its value 
        sprintf(templn, "%.8x", tmp_c);
        tmp_x = get_aligned_x(templn, RIGHT) -4; // additional px from R margin
        print_text(tmp_x, 4, templn);

        // testing sine
        float amp = f_sinf(10);
        sprintf(templn, "%.4f", amp);
        tmp_x = get_aligned_x(templn, RIGHT) -4;
        print_text(tmp_x, 4 + (FONT_H +1), templn);

        read_meminfo(templn);
        tmp_x = get_aligned_x(templn, RIGHT) -4;
        print_text(tmp_x, CANVAS_H - (FONT_H +1) -4, templn); // additional px from lower border
    }

    // ...

}
Beispiel #20
0
NCURSES_SP_NAME(start_color) (NCURSES_SP_DCL0)
{
    int result = ERR;
    int maxpairs = 0, maxcolors = 0;

    T((T_CALLED("start_color(%p)"), (void *) SP_PARM));

    if (SP_PARM == 0) {
	result = ERR;
    } else if (SP_PARM->_coloron) {
	result = OK;
    } else {
	maxpairs = MaxPairs;
	maxcolors = MaxColors;
	if (reset_color_pair(NCURSES_SP_ARG) != TRUE) {
	    set_foreground_color(NCURSES_SP_ARGx
				 default_fg(NCURSES_SP_ARG),
				 NCURSES_SP_NAME(_nc_outch));
	    set_background_color(NCURSES_SP_ARGx
				 default_bg(NCURSES_SP_ARG),
				 NCURSES_SP_NAME(_nc_outch));
	}
#if !NCURSES_EXT_COLORS
	/*
	 * Without ext-colors, we cannot represent more than 256 color pairs.
	 */
	if (maxpairs > 256)
	    maxpairs = 256;
#endif

	if (maxpairs > 0 && maxcolors > 0) {
	    SP_PARM->_pair_limit = maxpairs;

#if NCURSES_EXT_FUNCS
	    /*
	     * If using default colors, allocate extra space in table to
	     * allow for default-color as a component of a color-pair.
	     */
	    SP_PARM->_pair_limit += (1 + (2 * maxcolors));
#endif
	    SP_PARM->_pair_count = maxpairs;
	    SP_PARM->_color_count = maxcolors;
#if !USE_REENTRANT
	    COLOR_PAIRS = maxpairs;
	    COLORS = maxcolors;
#endif

	    SP_PARM->_color_pairs = TYPE_CALLOC(colorpair_t, SP_PARM->_pair_limit);
	    if (SP_PARM->_color_pairs != 0) {
		SP_PARM->_color_table = TYPE_CALLOC(color_t, maxcolors);
		if (SP_PARM->_color_table != 0) {
		    SP_PARM->_color_pairs[0] = PAIR_OF(default_fg(NCURSES_SP_ARG),
						       default_bg(NCURSES_SP_ARG));
		    init_color_table(NCURSES_SP_ARG);

		    T(("started color: COLORS = %d, COLOR_PAIRS = %d",
		       COLORS, COLOR_PAIRS));

		    SP_PARM->_coloron = 1;
		    result = OK;
		} else if (SP_PARM->_color_pairs != 0) {
		    FreeAndNull(SP_PARM->_color_pairs);
		}
	    }
	} else {
	    result = OK;
	}
    }
    returnCode(result);
}
Beispiel #21
0
NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_DCLx
			       int old_pair,
			       int pair,
			       int reverse,
			       NCURSES_SP_OUTC outc)
{
#ifdef USE_TERM_DRIVER
    CallDriver_4(SP_PARM, td_docolor, old_pair, pair, reverse, outc);
#else
    NCURSES_COLOR_T fg = COLOR_DEFAULT;
    NCURSES_COLOR_T bg = COLOR_DEFAULT;
    NCURSES_COLOR_T old_fg = -1;
    NCURSES_COLOR_T old_bg = -1;

    if (!ValidPair(pair)) {
	return;
    } else if (pair != 0) {
	if (set_color_pair) {
	    TPUTS_TRACE("set_color_pair");
	    NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
				    TPARM_1(set_color_pair, pair),
				    1, outc);
	    return;
	} else if (SP_PARM != 0) {
	    if (pair_content((NCURSES_COLOR_T) pair, &fg, &bg) == ERR)
		return;
	}
    }

    if (old_pair >= 0
	&& SP_PARM != 0
	&& pair_content((NCURSES_COLOR_T) old_pair, &old_fg, &old_bg) != ERR) {
	if ((isDefaultColor(fg) && !isDefaultColor(old_fg))
	    || (isDefaultColor(bg) && !isDefaultColor(old_bg))) {
#if NCURSES_EXT_FUNCS
	    /*
	     * A minor optimization - but extension.  If "AX" is specified in
	     * the terminal description, treat it as screen's indicator of ECMA
	     * SGR 39 and SGR 49, and assume the two sequences are independent.
	     */
	    if (SP_PARM->_has_sgr_39_49
		&& isDefaultColor(old_bg)
		&& !isDefaultColor(old_fg)) {
		NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx "\033[39m", 1, outc);
	    } else if (SP_PARM->_has_sgr_39_49
		       && isDefaultColor(old_fg)
		       && !isDefaultColor(old_bg)) {
		NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx "\033[49m", 1, outc);
	    } else
#endif
		reset_color_pair(NCURSES_SP_ARG);
	}
    } else {
	reset_color_pair(NCURSES_SP_ARG);
    }

#if NCURSES_EXT_FUNCS
    if (isDefaultColor(fg))
	fg = (NCURSES_COLOR_T) default_fg(NCURSES_SP_ARG);
    if (isDefaultColor(bg))
	bg = (NCURSES_COLOR_T) default_bg(NCURSES_SP_ARG);
#endif

    if (reverse) {
	NCURSES_COLOR_T xx = fg;
	fg = bg;
	bg = xx;
    }

    TR(TRACE_ATTRS, ("setting colors: pair = %d, fg = %d, bg = %d", pair,
		     fg, bg));

    if (!isDefaultColor(fg)) {
	set_foreground_color(NCURSES_SP_ARGx fg, outc);
    }
    if (!isDefaultColor(bg)) {
	set_background_color(NCURSES_SP_ARGx bg, outc);
    }
#endif
}