当前位置: 首页>>代码示例>>C++>>正文


C++ GrSetGCForeground函数代码示例

本文整理汇总了C++中GrSetGCForeground函数的典型用法代码示例。如果您正苦于以下问题:C++ GrSetGCForeground函数的具体用法?C++ GrSetGCForeground怎么用?C++ GrSetGCForeground使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GrSetGCForeground函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: menu_draw_scrollbar

/* draws the scrollbar; calculates it and all */
void menu_draw_scrollbar(menu_st *menulist)
{
	int per = menulist->screen_items * 100 / menulist->num_items;
	int height = (menulist->h - 2) * (per < 3 ? 3 : per) / 100;
	int y_top = ((((menulist->h - 3) - height) * 100) * menulist->sel /
			(menulist->num_items - 1)) / 100 + menulist->y + 1;
	int y_bottom = y_top + height;

	/* only draw if appropriate */
	if(menulist->screen_items >= menulist->num_items)
		return;

	/* draw the containing box */
	GrSetGCForeground(menulist->menu_gc,
				appearance_get_color( CS_SCRLBDR ));
	GrRect(menulist->menu_wid, menulist->menu_gc, menulist->w - 8,
			menulist->y, 8, menulist->h - 1);

	/* erase the scrollbar */
	GrSetGCForeground(menulist->menu_gc,
				appearance_get_color( CS_SCRLCTNR ));
	GrFillRect(menulist->menu_wid, menulist->menu_gc, menulist->w - (8 - 1),
			menulist->y + 1, (8 - 2), y_top - (menulist->y + 1));
	GrFillRect(menulist->menu_wid, menulist->menu_gc, menulist->w - (8 - 1),
			y_bottom, (8 - 2), (menulist->h - 3) - y_bottom);

	/* draw the bar */
	GrSetGCForeground(menulist->menu_gc,
				appearance_get_color( CS_SCRLKNOB ));
	GrFillRect(menulist->menu_wid, menulist->menu_gc, menulist->w -
			(8 - 1), y_top, (8 - 2), height);

	/* restore the fg */
	GrSetGCForeground(menulist->menu_gc, BLACK);
}
开发者ID:ProjectZeroSlackr,项目名称:Floydzilla,代码行数:36,代码来源:mlist.c

示例2: kmbitmap

static void kmbitmap(void){
	
	GrSetGCUseBackground(keyman_gc, GR_FALSE); 
	GrSetGCForeground(keyman_gc, BLACK); 
	switch(wnow.shupict){
		case 0:GrBitmap(mainmenu_pixmap, keyman_gc, wnow.XLOC,(wnow.YLOC-(wnow.MAPSCROLL % 16)), 16, 16, keymap1_black);break;
		case 1:GrBitmap(mainmenu_pixmap, keyman_gc, wnow.XLOC,(wnow.YLOC-(wnow.MAPSCROLL % 16)), 16, 16, keymap2_black);break;
		case 2:GrBitmap(mainmenu_pixmap, keyman_gc, wnow.XLOC,(wnow.YLOC-(wnow.MAPSCROLL % 16)), 16, 16, keymap3_black);break;
	}
	GrSetGCForeground(keyman_gc, GRAY); 
	switch(wnow.shupict){
		case 0:GrBitmap(mainmenu_pixmap, keyman_gc, wnow.XLOC,(wnow.YLOC-(wnow.MAPSCROLL % 16)), 16, 16, keymap1_gray);break;
		case 1:GrBitmap(mainmenu_pixmap, keyman_gc, wnow.XLOC,(wnow.YLOC-(wnow.MAPSCROLL % 16)), 16, 16, keymap2_gray);break;
		case 2:GrBitmap(mainmenu_pixmap, keyman_gc, wnow.XLOC,(wnow.YLOC-(wnow.MAPSCROLL % 16)), 16, 16, keymap3_gray);break;
	} 
	GrSetGCForeground(keyman_gc, LTGRAY); 
	switch(wnow.shupict){
		case 0:GrBitmap(mainmenu_pixmap, keyman_gc, wnow.XLOC,(wnow.YLOC-(wnow.MAPSCROLL % 16)), 16, 16, keymap1_ltgray);break;
		case 1:GrBitmap(mainmenu_pixmap, keyman_gc, wnow.XLOC,(wnow.YLOC-(wnow.MAPSCROLL % 16)), 16, 16, keymap2_ltgray);break;
		case 2:GrBitmap(mainmenu_pixmap, keyman_gc, wnow.XLOC,(wnow.YLOC-(wnow.MAPSCROLL % 16)), 16, 16, keymap3_ltgray);break;
	}
	GrSetGCForeground(keyman_gc, WHITE); 
	switch(wnow.shupict){
		case 0:GrBitmap(mainmenu_pixmap, keyman_gc, wnow.XLOC,(wnow.YLOC-(wnow.MAPSCROLL % 16)), 16, 16, keymap1_white);break;
		case 1:GrBitmap(mainmenu_pixmap, keyman_gc, wnow.XLOC,(wnow.YLOC-(wnow.MAPSCROLL % 16)), 16, 16, keymap2_white);break;
		case 2:GrBitmap(mainmenu_pixmap, keyman_gc, wnow.XLOC,(wnow.YLOC-(wnow.MAPSCROLL % 16)), 16, 16, keymap3_white);break;
	}

}
开发者ID:iPodLinux-Community,项目名称:Floydzilla,代码行数:29,代码来源:keyman.c

示例3: draw_rook

/* Draw the rook */
void draw_rook(int coord_x, int coord_y, int color)
{
	GR_POINT rook[] = {
		{coord_x+1, coord_y+1}, {coord_x+3, coord_y+1},
		{coord_x+3, coord_y+3}, {coord_x+5, coord_y+3},
		{coord_x+5, coord_y+1}, {coord_x+7, coord_y+1},
		{coord_x+7, coord_y+3}, {coord_x+9, coord_y+3},
		{coord_x+9, coord_y+1}, {coord_x+11, coord_y+1}, 
		{coord_x+11, coord_y+4}, {coord_x+9, coord_y+4},
		{coord_x+9, coord_y+8}, {coord_x+11, coord_y+8},
		{coord_x+11, coord_y+11}, {coord_x+1, coord_y+11}, 
		{coord_x+1, coord_y+8}, {coord_x+3, coord_y+8}, 
		{coord_x+3, coord_y+4}, {coord_x+1, coord_y+4},
		{coord_x+1, coord_y+1}
	};

	if(color == 0)
	{
		GrSetGCForeground(tuxchess_gc,WHITE);
		GrFillPoly(tuxchess_wid,tuxchess_gc,21,rook);
		GrSetGCForeground(tuxchess_gc,BLACK);
		GrPoly(tuxchess_wid,tuxchess_gc,21,rook);
	}
	else
	{
		GrSetGCForeground(tuxchess_gc,BLACK);
		GrFillPoly(tuxchess_wid,tuxchess_gc,21,rook);
	}
}
开发者ID:ProjectZeroSlackr,项目名称:Floydzilla,代码行数:30,代码来源:main.c

示例4: periodic_draw_element

void periodic_draw_element(GR_WINDOW_ID wid, GR_GC_ID gc, int i, int bx, int by, int cellsize)
{
	int ex = (bx+((periodic_elements[i].group-1)*cellsize));
	int ey = (by+((periodic_elements[i].period-1)*cellsize));
	int tx, ty;
	char tt[4];
	if (i == periodic_sel) {
		GrSetGCForeground(gc, GR_RGB(0,0,0));
		GrFillRect(wid, gc, ex, ey, cellsize+1, cellsize+1);
		GrSetGCForeground(gc, GR_RGB(255,255,255));
	} else {
		if (screen_info.bpp < 8) {
			GrSetGCForeground(gc, periodic_color_palette_bw[periodic_elements[i].color]);
		} else {
			GrSetGCForeground(gc, periodic_color_palette[periodic_elements[i].color]);
		}
		GrFillRect(wid, gc, ex, ey, cellsize+1, cellsize+1);
		GrSetGCForeground(gc, GR_RGB(0,0,0));
		GrRect(wid, gc, ex, ey, cellsize+1, cellsize+1);
	}
	if (cellsize >= 8) {
		strcpy(tt, periodic_elements[i].symbol);
		if (strlen(tt) > 2) {
			tt[1] = tt[strlen(tt)-1];
			tt[2] = 0;
			tx = ex + cellsize/2 - 4;
		} else if (tt[1] != 0) {
			tx = ex + cellsize/2 - 4;
		} else {
			tx = ex + cellsize/2 - 2;
		}
		ty = ey + cellsize/2 - 4;
		periodic_tinyfont_draw_string(wid, gc, tx, ty, tt);
	}
}
开发者ID:Keripo,项目名称:ProjectZeroSlackr-SVN,代码行数:35,代码来源:periodic.c

示例5: draw_rook

/* Draw the rook */
void draw_rook(int coord_x, int coord_y, char color)
{
	GR_POINT rook[] = {
		{coord_x+1, coord_y+1}, {coord_x+3, coord_y+1},
		{coord_x+3, coord_y+3}, {coord_x+5, coord_y+3},
		{coord_x+5, coord_y+1}, {coord_x+7, coord_y+1},
		{coord_x+7, coord_y+3}, {coord_x+9, coord_y+3},
		{coord_x+9, coord_y+1}, {coord_x+11, coord_y+1}, 
		{coord_x+11, coord_y+4}, {coord_x+9, coord_y+4},
		{coord_x+9, coord_y+8}, {coord_x+11, coord_y+8},
		{coord_x+11, coord_y+11}, {coord_x+1, coord_y+11}, 
		{coord_x+1, coord_y+8}, {coord_x+3, coord_y+8}, 
		{coord_x+3, coord_y+4}, {coord_x+1, coord_y+4},
		{coord_x+1, coord_y+1}
	};

	if(color == 'w')
	{
		GrSetGCForeground(tuxchess_gc,GR_RGB(255,255,255));
		GrFillPoly(tuxchess_wid,tuxchess_gc,21,rook);
		GrSetGCForeground(tuxchess_gc,GR_RGB(0,0,0));
		GrPoly(tuxchess_wid,tuxchess_gc,21,rook);
	}
	else
	{
		GrSetGCForeground(tuxchess_gc,GR_RGB(0,0,0));
		GrFillPoly(tuxchess_wid,tuxchess_gc,21,rook);
	}
}
开发者ID:iPodLinux-Community,项目名称:ZacZilla,代码行数:30,代码来源:main.c

示例6: create_status

// create the circular status animation
static void create_status() {

	int i;
	int xpie[] = {  0,  3, 6,  3, 0, -3, -6, -3 }; 
	int ypie[] = { -6, -3, 0,  3, 6,  3,  0, -3 }; 

	// we need 16 frames
	GrSetGCForeground (mandel_gc, appearance_get_color( CS_TITLEBG ));

	for (i=0;i<16;i++) {
		status_image[i] = GrNewPixmap(12, 12,  NULL);
		GrFillRect(status_image[i],mandel_gc,0,0,12,12);	
	}
	
	// the background
	for (i=1;i<8;i++) {
		GrSetGCForeground(mandel_gc, appearance_get_color(CS_TITLEFG));
		GrFillEllipse(status_image[i],mandel_gc,6,6,6,6);
		GrSetGCForeground(mandel_gc, appearance_get_color(CS_TITLEBG));
		GrArc(status_image[i],mandel_gc,6,6,6,6,0,-6,xpie[i],ypie[i],MWPIE);
	}
	// the foreground part
	GrSetGCForeground(mandel_gc, appearance_get_color(CS_TITLEFG));
	GrFillEllipse(status_image[8],mandel_gc,6,6,6,6);
	for (i=9;i<16;i++) GrArc(status_image[i],mandel_gc,6,6,6,6,0,-6,xpie[i-8],ypie[i-8],MWPIE);
}
开发者ID:Keripo,项目名称:ProjectZeroSlackr-SVN,代码行数:27,代码来源:mandelpod.c

示例7: saver4_animate

void saver4_animate(nstate *state)
{
	int i, tail, newtip;
	s4state *s = state->priv;

	if(s->length == SAVER4_WORMLENGTH) tail = s->tip + 1;
	else tail = 0;
	if(tail == SAVER4_WORMLENGTH) tail = 0;
	newtip = s->tip + 1;
	if(newtip == SAVER4_WORMLENGTH) newtip = 0;
	
	for(i = 0; i < SAVER4_NUMWORMS; i++) {
		GrSetGCForeground(state->main_gc, GR_COLOR_BLACK);
		GrFillRect(state->main_window, state->main_gc,
					s->worms[i].points[tail].x,
					s->worms[i].points[tail].y,
					SAVER4_WORMTHICKNESS,
					SAVER4_WORMTHICKNESS);
		saver4_get_new_worm_position(state, i, newtip);
		GrSetGCForeground(state->main_gc, s->worms[i].colour);
		GrFillRect(state->main_window, state->main_gc,
					s->worms[i].points[newtip].x,
					s->worms[i].points[newtip].y,
					SAVER4_WORMTHICKNESS,
					SAVER4_WORMTHICKNESS);
	}

	s->tip = newtip;
	if(s->length < SAVER4_WORMLENGTH) s->length++;
}
开发者ID:ghaerr,项目名称:microwindows,代码行数:30,代码来源:nsaver.c

示例8: draw_set

void
draw_set(char *name, int mode)
{
	int x;
	int tw, th, tb;
	GR_POINT points[4];
	GR_GC_ID gc = GrNewGC();

	GrSetGCForeground(gc, WHITE);
	GrSetGCBackground(gc, GRAY);

	GrGetGCTextSize(gc, name, -1, GR_TFTOP, &tw, &th, &tb);

	x = g_x + (tw - 50) / 2;

	GrText(g_main, gc, g_x, 5, name, -1, GR_TFTOP);

	g_x += (tw + 10);

	GrSetGCFillMode(gc, mode);

	if (mode == GR_FILL_STIPPLE)
		GrSetGCForeground(gc, YELLOW);
	else {
		GrSetGCForeground(gc, WHITE);
		GrSetGCBackground(gc, BLUE);
	}

	if (mode == GR_FILL_TILE) {
		GrSetGCTile(gc, g_pixmap, 16, 16);
	}

	if (mode == GR_FILL_STIPPLE || mode == GR_FILL_OPAQUE_STIPPLE)
		GrSetGCStipple(gc, g_stipple2, 2, 2);

	GrFillRect(g_main, gc, x, 25, 50, 50);

	if (mode == GR_FILL_STIPPLE || mode == GR_FILL_OPAQUE_STIPPLE)
		GrSetGCStipple(gc, g_stipple1, 7, 7);

	GrFillEllipse(g_main, gc, x + 25, 105, 25, 25);

	if (mode == GR_FILL_STIPPLE || mode == GR_FILL_OPAQUE_STIPPLE)
		GrSetGCStipple(gc, g_stipple3, 3, 2);

	points[0].x = points[3].x = x;
	points[0].y = points[3].y = 165;

	points[1].x = x + 50;
	points[1].y = 165;

	points[2].x = x + 25;
	points[2].y = 215;

	GrFillPoly(g_main, gc, 4, points);

	GrDestroyGC(gc);
}
开发者ID:BadrElh,项目名称:microwindows,代码行数:58,代码来源:tsdemo.c

示例9: draw_bar

static void draw_bar(int bar_length)
{
	if (!(bar_length < 0 || bar_length > rect_x2-rect_x1-4) ) {
		GrFillRect (mp3_wid, mp3_gc, rect_x1 + 2, rect_y1+2, bar_length, rect_y2-rect_y1-4);
		GrSetGCForeground(mp3_gc, GR_RGB(255,255,255));
		GrFillRect(mp3_wid, mp3_gc, rect_x1 + 2 + bar_length, rect_y1+2, rect_x2-rect_x1-4 - bar_length, rect_y2-rect_y1-4);
		GrSetGCForeground(mp3_gc, GR_RGB(0,0,0));
	}
}
开发者ID:Keripo,项目名称:ProjectZeroSlackr-SVN,代码行数:9,代码来源:mp3.c

示例10: video_draw_pause

static void video_draw_pause()
{
	GrSetGCForeground(video_gc, GR_RGB(255,255,255));
	GrFillRect(video_wid, video_gc, 8, 8, 16, 32);
	GrFillRect(video_wid, video_gc, 32, 8, 16, 32);
	GrSetGCForeground(video_gc, GR_RGB(0,0,0));
	GrRect(video_wid, video_gc, 8, 8, 16, 32);
	GrRect(video_wid, video_gc, 32, 8, 16, 32);
}
开发者ID:Keripo,项目名称:ProjectZeroSlackr-SVN,代码行数:9,代码来源:video.c

示例11: idw_draw_sheet

static void idw_draw_sheet(TSheet *sheet) {
  GR_SIZE width, height, base;
  char str[50], *ap;
  int i;
	
	if (sheet == NULL) {
    sheet = game.screen->menuitems[game.select].sheet;
  }
	
	// draw the title
  pz_draw_header (sheet->title);

  GrGetGCTextSize(idw_gc, sheet->button, -1, GR_TFASCII, &width, &height, &base);
  height+=4;  
  
  // (left, top, right, bottom)
  GrSetGCForeground(idw_gc, BLACK);
  GrLine(idw_wid, idw_gc, 20, 0, 20, screen_info.rows-44);
  GrLine(idw_wid, idw_gc, 20, screen_info.rows-44, screen_info.cols-20, screen_info.rows-44);
  GrLine(idw_wid, idw_gc, screen_info.cols-20, 0, screen_info.cols-20, screen_info.rows-44);
  
	GrSetGCForeground(idw_gc, WHITE);
  GrFillRect(idw_wid, idw_gc, 21, 0, screen_info.cols-41, screen_info.rows-44);
	GrSetGCForeground(idw_gc, BLACK);
  GrSetGCUseBackground(idw_gc, GR_FALSE);
  GrSetGCMode(idw_gc, GR_MODE_SET);
  
  ap = strtok(sheet->text, "\n");
  for (i=0; ap != NULL; i++) {
    GrText(idw_wid, idw_gc, 30, 1 + ((i + 1) * height - 4), ap, -1, GR_TFASCII);
    ap = strtok(NULL, "\n");
  }
  
	if (sheet->ammount != -1)
	{
    // print ammount
    sprintf(str, "Ammount: %d", game.ammount);
    GrText(idw_wid, idw_gc, 30, 50, str, -1, GR_TFASCII);
  } else {
    // the next time the user presses the middle button the sheet will disappear
    game.dismiss_sheet = 1;
  }

  // print the single menu option
  GrSetGCForeground(idw_gc, BLACK);
  GrFillRect(idw_wid, idw_gc, 21, 1 + 4 * height-4, screen_info.cols-41, height-1);
  GrSetGCForeground(idw_gc, WHITE);
  GrSetGCUseBackground(idw_gc, GR_TRUE);

  GrText(idw_wid, idw_gc, (screen_info.cols/2)-width+4, (5 * height - 8), sheet->button, -1, GR_TFASCII);

  // we're in a transaction
  game.in_transaction = 1;  
}
开发者ID:ProjectZeroSlackr,项目名称:Floydzilla,代码行数:54,代码来源:dopewars.c

示例12: menu_clear_pixmap

/* clears specified pixmap, (GrClearWindow doesnt work properly for a pixmap) */
void menu_clear_pixmap(menu_st *menulist, int pos)
{
	if(pos < 0 || pos > menulist->screen_items - 1) {
		Dprintf("menu_clear_pixmap::No Such Pixmap\n");
		return;
	}
	GrSetGCForeground(menulist->menu_gc, appearance_get_color( CS_BG ));
	GrFillRect(menulist->pixmaps[menulist->pixmap_pos[pos]],
			menulist->menu_gc, 0, 0, 440, menulist->height);
	GrSetGCForeground(menulist->menu_gc, appearance_get_color( CS_FG ));
}
开发者ID:ProjectZeroSlackr,项目名称:Floydzilla,代码行数:12,代码来源:mlist.c

示例13: draw_ball

static void draw_ball(int col,int row,int ibmp,int icolor)
{
    if(ipodc == 0 ){
	GrBitmap(ipobble_wid, ipobble_gc, col, row, BALL_WIDTH - 1,
		 BALL_WIDTH - 1, balls_bmp[ibmp]);
    } else {
        if (icolor!=-1)GrSetGCForeground(ipobble_gc, BallColors[icolor]);
	GrBitmap(ipobble_wid, ipobble_gc, col, row, BALL_WIDTH - 1,
		 BALL_WIDTH - 1, balls_bmp[ibmp]);
    }
    if(icolor!=-1)GrSetGCForeground(ipobble_gc, BLACK);
}
开发者ID:iPodLinux-Community,项目名称:podzillaz,代码行数:12,代码来源:ipobble.c

示例14: draw_king

/* Draw the king */
void draw_king(int coord_x, int coord_y, char color)
{
	GrSetGCForeground(tuxchess_gc,GR_RGB(0,0,0));
	GrLine(tuxchess_wid,tuxchess_gc,coord_x+6,coord_y+1,coord_x+6,coord_y+4);
	GrLine(tuxchess_wid,tuxchess_gc,coord_x+4,coord_y+2,coord_x+8,coord_y+2);
	if(color == 'w')
		GrSetGCForeground(tuxchess_gc,GR_RGB(255,255,255));

	GrFillEllipse(tuxchess_wid,tuxchess_gc,coord_x+6,coord_y+8,4,4);
	GrSetGCForeground(tuxchess_gc,GR_RGB(0,0,0));
	GrEllipse(tuxchess_wid,tuxchess_gc,coord_x+6,coord_y+8,4,4);
}
开发者ID:iPodLinux-Community,项目名称:ZacZilla,代码行数:13,代码来源:main.c

示例15: menu_draw

/* does the drawing, safe(and recommended) to use {in, as} an exposure event */
void menu_draw(menu_st *menulist)
{
	int i;

	/* appearance changed, force a redraw */
	if(menulist->scheme_no != appearance_get_color_scheme() ||
			get_current_font() != menulist->font) {
		menu_update_menu(menulist);
	}

	/* first draw; init onscreen text items */
	if(menulist->init == 0) {
		for(i = (menulist->num_items > menulist->screen_items) ?
				menulist->screen_items : menulist->num_items;
				i; i--)
			menu_retext_pixmap(menulist, i - 1,
				&menulist->items[menulist->top_item + (i - 1)]);
		menulist->init = 1;
	}
#if 0
	else if(menulist->lastsel == menulist->sel) {
		Dprintf("Aborted draw because %d == %d\n", menulist->sel,
				menulist->lastsel);
		return;
	}
	Dprintf("Continuing, %d != %d\n", menulist->sel, menulist->lastsel);
#endif
	/* draw each pixmap */
	for(i = 0; i < menulist->screen_items; i++)
		menu_draw_item(menulist, i);

	/* erase the bottom unused part of the allocated screen */
	GrSetGCForeground(menulist->menu_gc, appearance_get_color( CS_BG ));
	GrFillRect(menulist->menu_wid, menulist->menu_gc, menulist->x,
			menulist->height * menulist->screen_items, menulist->w,
			menulist->h - (menulist->height *
			menulist->screen_items));

	GrSetGCForeground(menulist->menu_gc, BLACK);

	/* draw scrollbar if needed */
	if(menulist->num_items > menulist->screen_items) {
		menulist->scrollbar = 1;
		menu_draw_scrollbar(menulist);
	}
	else
		menulist->scrollbar = 0;

	/* deal with the timer */
	menu_handle_timer(menulist, 0);

	menulist->lastsel = menulist->sel;
}
开发者ID:ProjectZeroSlackr,项目名称:Floydzilla,代码行数:54,代码来源:mlist.c


注:本文中的GrSetGCForeground函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。