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


C++ set_color函数代码示例

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


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

示例1: draw_line

	    // alanwu: Draw functions
	    void draw_line(char * image, int r, int g, int b, int x1, int y1, int x2, int y2)
	    {

	    	// Distance start and end point
				int dx = x2 - x1;
				int dy = y2 - y1;
	    	// Determine sign for direction x
				int incx = 0;
				if (dx < 0)
				{
					dx = -dx;
					incx = -1;
				}
				else if (dx > 0)
				{
					incx = 1;
				}

				// Determine sign for direction y
				int incy = 0;
				if (dy < 0)
				{
					dy = -dy;
					incy = -1;
				}
				else if (dy > 0)
				{
					incy = 1;
				}

			// Which gradient is larger
				int pdx, pdy, odx, ody, es, el;
				if (dx > dy)
				{
					pdx = incx;
					pdy = 0;
					odx = incx;
					ody = incy;
					es = dy;
					el = dx;
				}
				else
				{
					pdx = 0;
					pdy = incy;
					odx = incx;
					ody = incy;
					es = dx;
					el = dy;
				}
			// Init start
				int x = x1;
				int y = y1;
				int error = el >> 1;

				if (x < 0) x = 0;
				if (x >= _width) x = _width - 1;
				if (y < 0) y = 0;
				if (y >= _height) y = _height - 1;

			// Walk the line!
				int i = 0;
				for (i = 0; i < el; i++)
				{
					// Update error term
					error -= es;

					// Decide which coord to use
					if (error < 0)
					{
						error += el;
						x += odx;
						y += ody;
					}
					else
					{
						x += pdx;
						y += pdy;
					}

					// Set pixel
					if (x < 0) x = 0;
					if (x >= _width) x = _width - 1;
					if (y < 0) y = 0;
					if (y >= _height) y = _height - 1;

					set_color(image, x, y, r, g, b);
					//texture.SetPixel(x, y, color);
					//pixel = pixelBuffer + ((y * m_videoWidth + x) * m_videoBPP);
					//*((int*)pixel) = color;
				}

	    }
开发者ID:alan-y-w,项目名称:Capstone2015,代码行数:94,代码来源:main.c

示例2: input_send_message

/* PROTO */
void
input_send_message(char *arg)
{
	char           *msg, *msg_strip, *temp, *sn;
	char           *fullmsg;
	size_t          fullmsg_len;
	int             offset;

	if (conn->conn == NULL)
		return;

	temp = strchr(arg, ' ');

	if (temp == NULL) {
		printf("\n");
		b_echostr_s();
		printf("No message to send.\n");
		return;
	}
	if (strlen(temp + 1) == 0) {
		printf("\nNo message to send.\n");
		return;
	}
	if (conn->netspeak_filter)
		msg = undo_netspeak(temp + 1);
	else
		msg = temp + 1;

	sn = malloc(temp - arg + 1);
	sn[temp - arg] = 0;
	strncpy(sn, arg, temp - arg);
	fullmsg_len =
		strlen(msg) + strlen(SEND_FORMAT_BEGIN) + strlen(SEND_FORMAT_END) +
		1;
	fullmsg = malloc(fullmsg_len + 1);
	snprintf(fullmsg, fullmsg_len, "%s%s%s", SEND_FORMAT_BEGIN, msg,
		 SEND_FORMAT_END);
	imcomm_im_send_message(conn->conn, sn, fullmsg, 0);
	free(fullmsg);
	eraseline();

	if (conn->timestamps) {
		addts();
		putchar(' ');
		offset = 13;
	} else {
		offset = 2;
	}

	offset += strlen(sn) + 2;
	set_color(COLOR_OUTGOING_IM);
	printf("->%s", sn);
	set_color(0);
	printf(": ");
	msg_strip = strip_html(msg);
	wordwrap_print(msg_strip, offset);
	free(msg_strip);

	if (conn->lastsn != NULL)
		free(conn->lastsn);

	conn->lastsn = strdup(sn);
	log_event(EVENT_IMSEND, sn, msg);
	free(sn);

	if (conn->netspeak_filter)
		free(msg);
}
开发者ID:blacRose,项目名称:bsfliterm,代码行数:69,代码来源:input.c

示例3: set_builtin_color

void set_builtin_color(enum builtin_color c)
{
    set_color(builtin_colors[c]);
}
开发者ID:huynhrene,项目名称:dex,代码行数:4,代码来源:screen.c

示例4: parse_it8

int parse_it8(const char *filename, chart_t *chart)
{
  int result = 1;
  cmsHANDLE hIT8 = cmsIT8LoadFromFile(NULL, filename);
  if(!hIT8)
  {
    fprintf(stderr, "error loading IT8 file `%s'\n", filename);
    goto error;
  }

  if(cmsIT8TableCount(hIT8) != 1)
  {
    fprintf(stderr, "error with the IT8 file, we only support files with one table at the moment\n");
    goto error;
  }

  dt_colorspaces_color_profile_type_t color_space = DT_COLORSPACE_NONE;
  int column_SAMPLE_ID = -1, column_X = -1, column_Y = -1, column_Z = -1, column_L = -1, column_a = -1,
      column_b = -1;
  char **sample_names = NULL;
  int n_columns = cmsIT8EnumDataFormat(hIT8, &sample_names);

  if(n_columns == -1)
  {
    fprintf(stderr, "error with the IT8 file, can't get column types\n");
    goto error;
  }

  for(int i = 0; i < n_columns; i++)
  {
    if(!g_strcmp0(sample_names[i], "SAMPLE_ID"))
      column_SAMPLE_ID = i;
    else if(!g_strcmp0(sample_names[i], "XYZ_X"))
      column_X = i;
    else if(!g_strcmp0(sample_names[i], "XYZ_Y"))
      column_Y = i;
    else if(!g_strcmp0(sample_names[i], "XYZ_Z"))
      column_Z = i;
    else if(!g_strcmp0(sample_names[i], "LAB_L"))
      column_L = i;
    else if(!g_strcmp0(sample_names[i], "LAB_A"))
      column_a = i;
    else if(!g_strcmp0(sample_names[i], "LAB_B"))
      column_b = i;
  }

  if(column_SAMPLE_ID == -1)
  {
    fprintf(stderr, "error with the IT8 file, can't find the SAMPLE_ID column\n");
    goto error;
  }

  char *columns[3] = { 0 };
  if(column_X != -1 && column_Y != -1 && column_Z != -1)
  {
    color_space = DT_COLORSPACE_XYZ;
    columns[0] = "XYZ_X";
    columns[1] = "XYZ_Y";
    columns[2] = "XYZ_Z";
  }
  else if(column_L != -1 && column_a != -1 && column_b != -1)
  {
    color_space = DT_COLORSPACE_LAB;
    columns[0] = "LAB_L";
    columns[1] = "LAB_A";
    columns[2] = "LAB_B";
  }
  else
  {
    fprintf(stderr, "error with the IT8 file, can't find XYZ or Lab columns\n");
    goto error;
  }

  GHashTableIter table_iter;
  gpointer key, value;

  g_hash_table_iter_init(&table_iter, chart->box_table);
  while(g_hash_table_iter_next(&table_iter, &key, &value))
  {
    box_t *box = (box_t *)value;

    if(cmsIT8GetData(hIT8, key, "SAMPLE_ID") == NULL)
    {
      fprintf(stderr, "error with the IT8 file, can't find sample `%s'\n", (char *)key);
      goto error;
    }

    set_color(box, color_space, cmsIT8GetDataDbl(hIT8, key, columns[0]), cmsIT8GetDataDbl(hIT8, key, columns[1]),
              cmsIT8GetDataDbl(hIT8, key, columns[2]));
  }

  fprintf(stderr, "it8 `%s' done\n", filename);
  goto end;

error:
  result = 0;
end:
  if(hIT8) cmsIT8Free(hIT8);
  return result;
}
开发者ID:imarsv,项目名称:darktable,代码行数:100,代码来源:colorchart.c

示例5: draw_graphics

void draw_graphics(struct gps_data_t *gpsdata)
{
    int i, x, y;
    char buf[20];

    if (gpsdata->satellites != 0) {
	i = (int)min(width, height);

	set_color("White");
	(void)XFillRectangle(XtDisplay(draww),pixmap,drawGC,0,0,width,height);

	/* draw something in the center */
	set_color("Grey");
	draw_arc(width / 2, height / 2, 6);

	/* draw the 45 degree circle */
#ifdef PCORRECT
#define FF	0.7 /* sin(45) ~ 0.7 */
#else
#define FF	0.5
#endif
	draw_arc(width / 2, height / 2, (unsigned)((i - RM) * FF));
#undef FF

	set_color("Black");
	draw_arc(width / 2, height / 2, (unsigned)(i - RM));

	pol2cart(0, 0, &x, &y);
	set_color("Black");
	(void)XDrawString(XtDisplay(draww),pixmap, drawGC, x, y, "N", 1);
	pol2cart(90, 0, &x, &y);
	set_color("Black");
	(void)XDrawString(XtDisplay(draww),pixmap, drawGC, x+2, y, "E", 1);
	pol2cart(180, 0, &x, &y);
	set_color("Black");
	(void)XDrawString(XtDisplay(draww),pixmap, drawGC, x, y+10, "S", 1);
	pol2cart(270, 0, &x, &y);
	set_color("Black");
	(void)XDrawString(XtDisplay(draww),pixmap, drawGC, x-5,y, "W", 1);

	/* Now draw the satellites... */
	for (i = 0; i < gpsdata->satellites; i++) {
	    pol2cart((double)gpsdata->azimuth[i], 
		     (double)gpsdata->elevation[i], 
		     &x, &y);
	    if (gpsdata->ss[i] < 10) 
		set_color("Black");
	    else if (gpsdata->ss[i] < 30)
		set_color("Red");
	    else if (gpsdata->ss[i] < 35)
		set_color("Yellow");
	    else if (gpsdata->ss[i] < 40)
		set_color("Green3");
	    else
		set_color("Green1");
	    if (gpsdata->PRN[i] > GPS_PRNMAX) {
		/* SBAS satellites */
		XPoint vertices[5];
		/*@ -type @*/
		vertices[0].x = x;
		vertices[0].y = y-IDIAM;
		vertices[1].x = x+IDIAM;
		vertices[1].y = y;
		vertices[2].x = x;
		vertices[2].y = y+IDIAM;
		vertices[3].x = x-IDIAM;
		vertices[3].y = y;
		vertices[4].x = x;
		vertices[4].y = y-IDIAM;
		/*@ +type -compdef @*/
		if (gpsdata->used[i])
		    (void)XFillPolygon(XtDisplay(draww), pixmap, drawGC,
				       vertices, 5, Convex, CoordModeOrigin);
		else
		    (void)XDrawLines(XtDisplay(draww), pixmap, drawGC,
				     vertices, 5, CoordModeOrigin);
	    } else {
		/* ordinary GPS satellites */
		if (gpsdata->used[i])
		    (void)XFillArc(XtDisplay(draww), pixmap, drawGC,
			   x - IDIAM, y - IDIAM,	/* x,y */
			   2*IDIAM+1, 2*IDIAM+1,	/* width, height */
			   0, 360 * 64			/* angle1, angle2 */
			);
		else
		    (void)XDrawArc(XtDisplay(draww), pixmap, drawGC,
			   x - IDIAM, y - IDIAM,	/* x,y */
			   2*IDIAM+1, 2*IDIAM+1,	/* width, height */
			   0, 360 * 64			/* angle1, angle2 */
			);
	    }
	    /*@ +compdef @*/
	    (void)snprintf(buf, sizeof(buf), "%-3d", gpsdata->PRN[i]);
	    set_color("Black");
	    (void)XDrawString(XtDisplay(draww), pixmap, drawGC, x,y+17, buf,3);
		
	}
	(void)XCopyArea(XtDisplay(draww), pixmap, XtWindow(draww), drawGC,
		  0, 0, width, height, 0, 0);
    }
//.........这里部分代码省略.........
开发者ID:rogerhu,项目名称:dd-wrt,代码行数:101,代码来源:display.c

示例6: textbuffer_line2text

void textbuffer_line2text(LINE_REC *line, int coloring, GString *str)
{
        unsigned char cmd, *ptr, *tmp;

	g_return_if_fail(line != NULL);
	g_return_if_fail(str != NULL);

        g_string_truncate(str, 0);

	for (ptr = line->text;;) {
		if (*ptr != 0) {
			g_string_append_c(str, (char) *ptr);
                        ptr++;
			continue;
		}

		ptr++;
                cmd = *ptr;
		ptr++;

		if (cmd == LINE_CMD_EOL) {
                        /* end of line */
			break;
		}

		if (cmd == LINE_CMD_CONTINUE) {
                        /* line continues in another address.. */
			memcpy(&tmp, ptr, sizeof(unsigned char *));
			ptr = tmp;
                        continue;
		}

		if (!coloring) {
			/* no colors, skip coloring commands */
			if (cmd == LINE_COLOR_EXT || cmd == LINE_COLOR_EXT_BG)
				ptr++;
#ifdef TERM_TRUECOLOR
			else if (cmd == LINE_COLOR_24)
				ptr+=4;
#endif

                        continue;
		}

		if ((cmd & LINE_CMD_EOL) == 0) {
			/* set color */
                        set_color(str, cmd);
		} else switch (cmd) {
		case LINE_CMD_UNDERLINE:
			g_string_append_c(str, 31);
			break;
		case LINE_CMD_REVERSE:
			g_string_append_c(str, 22);
			break;
		case LINE_CMD_BLINK:
			g_string_append_printf(str, "\004%c",
					  FORMAT_STYLE_BLINK);
			break;
		case LINE_CMD_BOLD:
			g_string_append_printf(str, "\004%c",
					  FORMAT_STYLE_BOLD);
			break;
		case LINE_CMD_COLOR0:
			g_string_append_printf(str, "\004%c%c",
					  '0', FORMAT_COLOR_NOCHANGE);
			break;
		case LINE_CMD_INDENT:
			g_string_append_printf(str, "\004%c",
					  FORMAT_STYLE_INDENT);
			break;
		case LINE_COLOR_EXT:
			format_ext_color(str, 0, *ptr++);
			break;
		case LINE_COLOR_EXT_BG:
			format_ext_color(str, 1, *ptr++);
			break;
#ifdef TERM_TRUECOLOR
		case LINE_COLOR_24:
			g_string_append_printf(str, "\004%c", FORMAT_COLOR_24);
			break;
#endif
		}
	}
}
开发者ID:falconindy,项目名称:irssi,代码行数:84,代码来源:textbuffer.c

示例7: cairo_save

void cairo_container::draw_borders( litehtml::uint_ptr hdc, const litehtml::borders& borders, const litehtml::position& draw_pos, bool root )
{
	cairo_t* cr = (cairo_t*) hdc;
	cairo_save(cr);
	apply_clip(cr);

	cairo_new_path(cr);

	int bdr_top		= 0;
	int bdr_bottom	= 0;
	int bdr_left	= 0;
	int bdr_right	= 0;

	if(borders.top.width != 0 && borders.top.style > litehtml::border_style_hidden)
	{
		bdr_top = (int) borders.top.width;
	}
	if(borders.bottom.width != 0 && borders.bottom.style > litehtml::border_style_hidden)
	{
		bdr_bottom = (int) borders.bottom.width;
	}
	if(borders.left.width != 0 && borders.left.style > litehtml::border_style_hidden)
	{
		bdr_left = (int) borders.left.width;
	}
	if(borders.right.width != 0 && borders.right.style > litehtml::border_style_hidden)
	{
		bdr_right = (int) borders.right.width;
	}

	// draw right border
	if (bdr_right)
	{
		set_color(cr, borders.right.color);

		double r_top	= (double) borders.radius.top_right_x;
		double r_bottom	= (double) borders.radius.bottom_right_x;

		if(r_top)
		{
			double end_angle	= 2.0 * M_PI;
			double start_angle	= end_angle - M_PI / 2.0  / ((double) bdr_top / (double) bdr_right + 0.5);

			if (!add_path_arc(cr,
					draw_pos.right() - r_top,
					draw_pos.top() + r_top,
					r_top - bdr_right,
					r_top - bdr_right + (bdr_right - bdr_top),
					end_angle,
					start_angle, true))
			{
				cairo_move_to(cr, draw_pos.right() - bdr_right, draw_pos.top() + bdr_top);
			}

			if (!add_path_arc(cr,
					draw_pos.right() - r_top,
					draw_pos.top() + r_top,
					r_top,
					r_top,
					start_angle,
					end_angle, false))
			{
				cairo_line_to(cr, draw_pos.right(), draw_pos.top());
			}
		} else
		{
			cairo_move_to(cr, draw_pos.right() - bdr_right, draw_pos.top() + bdr_top);
			cairo_line_to(cr, draw_pos.right(), draw_pos.top());
		}

		if(r_bottom)
		{
			cairo_line_to(cr, draw_pos.right(),	draw_pos.bottom() - r_bottom);

			double start_angle	= 0;
			double end_angle	= start_angle + M_PI / 2.0  / ((double) bdr_bottom / (double) bdr_right + 0.5);

			if (!add_path_arc(cr,
				draw_pos.right() - r_bottom,
				draw_pos.bottom() - r_bottom,
				r_bottom,
				r_bottom,
				start_angle,
				end_angle, false))
			{
				cairo_line_to(cr, draw_pos.right(), draw_pos.bottom());
			}

			if (!add_path_arc(cr,
				draw_pos.right() - r_bottom,
				draw_pos.bottom() - r_bottom,
				r_bottom - bdr_right,
				r_bottom - bdr_right + (bdr_right - bdr_bottom),
				end_angle,
				start_angle, true))
			{
				cairo_line_to(cr, draw_pos.right() - bdr_right, draw_pos.bottom() - bdr_bottom);
			}
		} else
		{
//.........这里部分代码省略.........
开发者ID:bigfatbrowncat,项目名称:litehtml,代码行数:101,代码来源:cairo_container.cpp

示例8: system

//-------- VOID WYSWIETLAJACY PLANSZE --------
void INTERFACE::wyswietl_drzewo()
{
system("CLS");
set_color_default();
//SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_BLUE | FOREGROUND_INTENSITY ) ;
//wyswietlenie pola gry

gotoxy(10,2); if (pusty[1]==true) cout<<"~"; else if (statek[1]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(15,2); if (pusty[2]==true) cout<<"~"; else if (statek[2]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(20,2); if (pusty[3]==true) cout<<"~"; else if (statek[3]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(25,2); if (pusty[4]==true) cout<<"~"; else if (statek[4]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(30,2); if (pusty[5]==true) cout<<"~"; else if (statek[5]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(10,4); if (pusty[6]==true) cout<<"~"; else if (statek[6]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(15,4); if (pusty[7]==true) cout<<"~"; else if (statek[7]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(20,4); if (pusty[8]==true) cout<<"~"; else if (statek[8]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(25,4); if (pusty[9]==true) cout<<"~"; else if (statek[9]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(30,4); if (pusty[10]==true) cout<<"~"; else if (statek[10]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(10,6); if (pusty[11]==true) cout<<"~"; else if (statek[11]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(15,6); if (pusty[12]==true) cout<<"~"; else if (statek[12]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(20,6); if (pusty[13]==true) cout<<"~"; else if (statek[13]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(25,6); if (pusty[14]==true) cout<<"~"; else if (statek[14]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(30,6); if (pusty[15]==true) cout<<"~"; else if (statek[15]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(10,8); if (pusty[16]==true) cout<<"~"; else if (statek[16]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(15,8); if (pusty[17]==true) cout<<"~"; else if (statek[17]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(20,8); if (pusty[18]==true) cout<<"~"; else if (statek[18]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(25,8); if (pusty[19]==true) cout<<"~"; else if (statek[19]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(30,8); if (pusty[20]==true) cout<<"~"; else if (statek[20]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(10,10); if (pusty[21]==true) cout<<"~"; else if (statek[21]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(15,10); if (pusty[22]==true) cout<<"~"; else if (statek[22]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(20,10); if (pusty[23]==true) cout<<"~"; else if (statek[23]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(25,10); if (pusty[24]==true) cout<<"~"; else if (statek[24]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;
set_color_default();
gotoxy(30,10); if (pusty[25]==true) cout<<"~"; else if (statek[25]==true) set_color_hit(), cout<<"X"; else set_color(),cout<<"P"<<endl;

cout<<endl<<endl<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
}
开发者ID:kmusialski,项目名称:Statki,代码行数:61,代码来源:INTERFACE.cpp

示例9: main

void main(void) {
    
    int xy,i,j,c,x,y,front,back,n,minc,maxc;
    int ix,iy,k,address,jx,jy,kx,ky;
    float dzdx,dzdy,a,b,dot,norm;
    float rx,ry,sx,sy,px,py;
    long p,q;
    RGB rgb;

    for (x=0;x<scrwid;x++) {
    for (y=0;y<scrhei;y++) {
        rx=(float)x/scrwid*2-1;
        ry=(float)y/scrhei*2-1;
        sx=rx*.8;
        sy=ry*.8;
        px=(sx+1)/2*scrwid;
        py=(sy+1)/2*scrhei;
        ix=(int)px;
        iy=(int)py;
        amount[x][y][0][0]=((float)ix+1-(float)px)*((float)(iy+1)-(float)py);
        amount[x][y][1][0]=((float)px-(float)ix)*((float)(iy+1)-(float)py);
        amount[x][y][0][1]=((float)ix+1-(float)px)*((float)py-(float)iy);
        amount[x][y][1][1]=((float)px-(float)ix)*((float)py-(float)iy);
        pix[x][y]=ix;
        piy[x][y]=iy;
//        printf("%f",amount[x][y][0][0]+amount[x][y][1][0]+amount[x][y][0][1]+amount[x][y][1][1]);
        if (mysquare(amount[x][y][0][0]+amount[x][y][1][0]+amount[x][y][0][1]+amount[x][y][1][1]-1)>0.00001) {
            printf("%d %d %f %f ",ix,iy,px,py);
            printf("%f+%f(%f*%f)+%f+%f=%f? \n",amount[x][y][0][0],amount[x][y][1][0],(float)px-(float)ix,(float)(iy+1)-(float)py,amount[x][y][0][1],amount[x][y][1][1],amount[x][y][0][0]+amount[x][y][1][0]+amount[x][y][0][1]+amount[x][y][1][1]);
        }
    }
    }

//    srand(456789);
        srand((int)time(NULL));
        //printf("%d\n",(int)time(NULL));


  allegro_init ();
  install_keyboard ();
  install_timer ();
  set_gfx_mode (GFX_AUTODETECT, scrwid, scrhei, 0, 0);
  set_pallete (desktop_palette);
  buffer = create_bitmap (scrwid, scrhei);
      clear (buffer);

//      textout_centre (buffer, font, "Press SPACE!", 60, 220, 4);


    // Set up grayscale colours
    for (c=0;c<=255;c++) {
        i=0;
        rgb.r=c*63/255;
        rgb.g=0;
        rgb.b=0;
        set_color(c,&rgb);
//        colors[c]=GrAllocColor(c,i,i);
    }
    
        for (x=0; x<scrwid; x++) {
        for (y=0; y<scrhei; y++) {
            putpixel(buffer,x,y,128);
        }
        }

      blit (buffer, screen, 0, 0, 0, 0, scrwid, scrhei);

   _farsetsel(screen->seg);

    while(!key[KEY_ESC]) {
        for (y=0; y<scrhei; y++) {
     movedata(screen->seg, bmp_read_line(screen,y), _my_ds(), tmp[y], scrwid);
     }
        for (x=0; x<scrwid; x++) {
        for (y=0; y<scrhei; y++) {
        c=0;
        kx=x-scrwid/2;
        ky=y-scrhei/2;
        jx=kx*cos(ang)+ky*sin(ang);
        jy=-kx*sin(ang)+ky*cos(ang);
        ix=scrwid/2+0.9*jx;
        iy=scrhei/2+0.9*jy;
        k=0;
        i=0;j=0;
//        for (i=-1;i<=1;i++) {
//        for (j=-1;j<=1;j++) {
//            c=c+getpixel(screen, ix+i, iy+j);
//     address = bmp_read_line(screen, iy)+ix;
            c=c+tmp[iy][ix];
            k++;
//        }
//        }
        c=c/k;
        c--;
//     address = bmp_write_line(buffer, y)+x;
//        _farnspokeb(address, c);
        tmp2[y][x]=c;
//        putpixel(buffer, x, y, c);
        }
        }
//.........这里部分代码省略.........
开发者ID:10crimes,项目名称:code,代码行数:101,代码来源:zoom8.c

示例10: led_uninit

void led_uninit(void)
{
    set_color(screen_light, 0xffffffff);
}
开发者ID:791254467,项目名称:android_device_motorola_omap34com,代码行数:4,代码来源:hardware.c

示例11: get_text_height

int AboutPrefs::create_objects()
{
	int x, y;

	BC_Resources *resources = BC_WindowBase::get_resources();

// 	add_subwindow(new BC_Title(mwindow->theme->preferencestitle_x, 
// 		mwindow->theme->preferencestitle_y, 
// 		_("About"), 
// 		LARGEFONT, 
// 		resources->text_default));
	
	x = mwindow->theme->preferencesoptions_x;
	y = mwindow->theme->preferencesoptions_y +
		get_text_height(LARGEFONT);

	set_font(LARGEFONT);
	set_color(resources->text_default);
	draw_text(x, y, PROGRAM_NAME " " CINELERRA_VERSION);

	y += get_text_height(LARGEFONT);

	set_font(MEDIUMFONT);
	draw_text(x, y, COPYRIGHTTEXT1
#if defined(COPYRIGHTTEXT2)
	"\n" COPYRIGHTTEXT2
#endif
#if defined(REPOMAINTXT)
	"\n" REPOMAINTXT
#endif
	);



	y += get_text_height(MEDIUMFONT) * 4;

	char versions[BCTEXTLEN];
	sprintf(versions, 
_("Quicktime version %d.%d.%d (%s)\n"
"Libmpeg3 version %d.%d.%d\n"),
quicktime_major(),
quicktime_minor(),
quicktime_release(),
FFMPEG_EXTERNALTEXT,
mpeg3_major(),
mpeg3_minor(),
mpeg3_release());
	draw_text(x, y, versions);



	y += get_text_height(MEDIUMFONT) * 3;
	set_font(LARGEFONT);
	draw_text(x, y, "Credits:");
	y += get_text_height(LARGEFONT);
	set_font(MEDIUMFONT);

	char credits[BCTEXTLEN];
	sprintf(credits,

"Jack Crossfire\n"
"Richard Baverstock\n"
"Karl Bielefeldt\n"
"Kevin Brosius\n"
"Jean-Luc Coulon\n"
"Jean-Michel POURE\n"
"Jerome Cornet\n"
"Pierre Marc Dumuid\n"
"Alex Ferrer\n"
"Jan Gerber\n"
"Koen Muylkens\n"
"Stefan de Konink\n"
"Nathan Kurz\n"
"Greg Mekkes\n"
"Eric Seigne\n"
"Joe Stewart\n"
"Dan Streetman\n"
#ifdef X_HAVE_UTF8_STRING
"Gustavo Iñiguez\n"
#else
"Gustavo I\361iguez\n"
#endif
"Johannes Sixt\n"
"Mark Taraba\n"
"Andraz Tori\n"
"Jonas Wulff\n"
"David Arendt\n"

);
	draw_text(x, y, credits);

	int x_indented;
	x_indented = x + get_text_width(MEDIUMFONT, "Pierre Marc Dumuid") + 20;

	char credits_cont1[BCTEXTLEN];
	sprintf(credits_cont1,

#ifdef X_HAVE_UTF8_STRING
"Einar Rünkaru\n"
#else
//.........这里部分代码省略.........
开发者ID:petterreinholdtsen,项目名称:cinelerra-cv,代码行数:101,代码来源:aboutprefs.C

示例12: Rect

void HealthWindow::init() {
	mesh_.reset(new Rect());
	set_color(Vector3f(1.0f, 1.0f, 1.0f));
}
开发者ID:NineDayGame,项目名称:NineDayGame,代码行数:4,代码来源:healthwindow.cpp

示例13: statusbar_channel

/* redraw channel */
static void statusbar_channel(SBAR_ITEM_REC *item, int ypos)
{
    WINDOW_REC *window;
    WI_ITEM_REC *witem;
    CHANNEL_REC *channel;
    SERVER_REC *server;
    gchar channame[21], winnum[MAX_INT_STRLEN], *tmpname;
    int size_needed;
    int mode_size;

    window = item->bar->pos != STATUSBAR_POS_MIDDLE ? active_win :
            mainwindow_find_sbar(item);
    server = window == NULL ? NULL : window->active_server;

    ltoa(winnum, window == NULL ? 0 : window->refnum);

    witem = window != NULL && (IS_CHANNEL(window->active) || IS_QUERY(window->active)) ?
	    window->active : NULL;
    if (witem == NULL)
    {
	/* display server tag */
        channame[0] = '\0';
	mode_size = 0;
	channel = NULL;

	size_needed = 3 + strlen(winnum) + (server == NULL ? 0 : (17+strlen(server->tag)));
    }
    else
    {
	/* display channel + mode */
        tmpname = show_lowascii(witem->name);
        strncpy(channame, tmpname, 20); channame[20] = '\0';
        g_free(tmpname);

	channel = CHANNEL(witem);
	if (channel == NULL) {
                mode_size = 0;
	} else {
		mode_size = strlen(channel->mode);
		if (mode_size > 0) mode_size += 3; /* (+) */
	}

	size_needed = 3 + strlen(winnum) + strlen(channame) + mode_size;
    }

    if (item->size != size_needed)
    {
        /* we need more (or less..) space! */
        statusbar_item_resize(item, size_needed);
        return;
    }

    move(ypos, item->xpos);
    set_color(stdscr, sbar_color_dim); addch('[');

    /* window number */
    set_color(stdscr, sbar_color_normal); addstr(winnum);
    set_color(stdscr, sbar_color_dim); addch(':');

    if (channame[0] == '\0' && server != NULL)
    {
	/* server tag */
	set_color(stdscr, sbar_color_normal); addstr(server->tag);
        addstr(" (change with ^X)");
    }
    else if (channame[0] != '\0')
    {
	/* channel + mode */
	set_color(stdscr, sbar_color_normal); addstr(channame);
	if (mode_size)
	{
	    set_color(stdscr, sbar_color_bold); addch('(');
	    set_color(stdscr, sbar_color_dim); addch('+');
	    set_color(stdscr, sbar_color_normal); addstr(channel->mode);
	    set_color(stdscr, sbar_color_bold); addch(')');
	}
    }
    set_color(stdscr, sbar_color_dim); addch(']');
    screen_refresh(NULL);
}
开发者ID:svn2github,项目名称:irssi,代码行数:81,代码来源:statusbar-items.c

示例14: SDL_GL_SetAttribute

  void Video_GL::init() {
    std::cout << "Initializing OpenGL" << std::endl;

    //double buffer, no stencil, no accumulation buffer
    SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
    SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 0);
    SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE, 0);
    SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE, 0);
    SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE, 0);
    SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE, 0);

    if(get_multisampling() > 1) {
      SDL_GL_SetAttribute (SDL_GL_MULTISAMPLESAMPLES, get_multisampling());
      SDL_GL_SetAttribute (SDL_GL_MULTISAMPLEBUFFERS, 1);
    }

    set_opengl_flag(true);
    Video::init();

#if SDL_VERSION_ATLEAST(1,3,0)
    m_context = SDL_GL_CreateContext(get_window());
#endif

    {
      const GLenum err = glewInit();
      if(GLEW_OK != err) {
        std::cerr << "GLEW Error: " << glewGetErrorString(err) << std::endl;
        throw Video_Init_Failure();
      }
    }

    // Set Fill/Shade Mode
    glShadeModel(GL_SMOOTH);
    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
    glEnable(GL_NORMALIZE); //GL_RESCALE_NORMALIZE);

    // Enable Alpha Blitting
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    //glBlendEquation(GL_FUNC_ADD); // default // would require ARB ext

    // Set lighting variables
    glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
    glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
    if(glGetError() == GL_INVALID_ENUM)
      std::cerr << "Quality Warning:  Your graphics card does not support separate specular lighting in OpenGL.\n";

    // Initialize Assorted Variables
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    //glPointSize(static_cast<GLfloat>(sqrt(pow(double(get_screen_width()), 2.) * pow(double(get_screen_height()), 2.)) / 1000000));
    //glLineWidth(static_cast<GLfloat>(sqrt(pow(double(get_screen_width()), 2.) * pow(double(get_screen_height()), 2.)) / 1000000));

    // Finish with a few function calls
    set_2d();
    set_color(get_color());
    set_clear_color(get_clear_color());
    set_backface_culling(get_backface_culling());
    set_lighting(get_lighting());
    set_ambient_lighting(get_ambient_lighting());
    set_alpha_test(is_alpha_test_enabled(), get_alpha_test_function(), get_alpha_test_value());
    set_zwrite(is_zwrite_enabled());
    set_ztest(is_ztest_enabled());

    union {
      void * v;
#ifdef _LINUX
      PFNGLXSWAPINTERVALEXTPROC pglSwapIntervalEXT;
      PFNGLXSWAPINTERVALSGIPROC pglSwapIntervalSGI;
#endif
      PFNGLBINDBUFFERARBPROC pglBindBufferARB;
      PFNGLDELETEBUFFERSARBPROC pglDeleteBuffersARB;
      PFNGLGENBUFFERSARBPROC pglGenBuffersARB;
      PFNGLBUFFERDATAARBPROC pglBufferDataARB;
    } ptr;

#ifdef _LINUX
    ptr.v = SDL_GL_GetProcAddress("glXSwapIntervalEXT");
    if(!ptr.v)
      ptr.v = SDL_GL_GetProcAddress("wglSwapIntervalEXT");
    m_pglSwapIntervalEXT = ptr.pglSwapIntervalEXT;

    ptr.v = SDL_GL_GetProcAddress("glXSwapIntervalSGI");
    if(!ptr.v)
      ptr.v = SDL_GL_GetProcAddress("wglSwapIntervalSGI");
    m_pglSwapIntervalSGI = ptr.pglSwapIntervalSGI;
#endif

    // Has to be done after finding the function pointer
    set_vertical_sync(get_vertical_sync());

    m_vertex_buffers = strstr(reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS)), "ARB_vertex_buffer_object") != 0;
    if(m_vertex_buffers) {
      ptr.v = SDL_GL_GetProcAddress("glBindBufferARB");
      m_pglBindBufferARB = ptr.pglBindBufferARB;

//.........这里部分代码省略.........
开发者ID:Zl0bin,项目名称:493final,代码行数:101,代码来源:Video_GL.cpp

示例15: print_to_widget

static void
print_to_widget (WEdit *edit, long row, int start_col, int start_col_real,
		 long end_col, unsigned int line[])
{
    unsigned int *p;

    int x = start_col_real + EDIT_TEXT_HORIZONTAL_OFFSET;
    int x1 = start_col + EDIT_TEXT_HORIZONTAL_OFFSET;
    int y = row + EDIT_TEXT_VERTICAL_OFFSET;
    int cols_to_skip = abs (x);

    set_color (EDITOR_NORMAL_COLOR);
    edit_move (x1, y);
    hline (' ', end_col + 1 - EDIT_TEXT_HORIZONTAL_OFFSET - x1);

    edit_move (x1 + FONT_OFFSET_X, y + FONT_OFFSET_Y);
    p = line;

    while (*p) {
	int style;
	int textchar;
	int color;

	if (cols_to_skip) {
	    p++;
	    cols_to_skip--;
	    continue;
	}

	style = *p & 0xFF00;
	textchar = *p & 0xFF;
	color = *p >> 16;

	if (style & MOD_ABNORMAL) {
	    /* Non-printable - use black background */
	    color = 0;
	}

	if (style & MOD_WHITESPACE) {
	    if (style & MOD_MARKED) {
		textchar = ' ';
		set_color (EDITOR_MARKED_COLOR);
	    } else {
#if 0
		if (color != EDITOR_NORMAL_COLOR) {
		    textchar = ' ';
		    lowlevel_set_color (color);
		} else
#endif
		    set_color (EDITOR_WHITESPACE_COLOR);
	    }
	} else {
	    if (style & MOD_BOLD) {
		set_color (EDITOR_BOLD_COLOR);
	    } else if (style & MOD_MARKED) {
		set_color (EDITOR_MARKED_COLOR);
	    } else {
		lowlevel_set_color (color);
	    }
	}

	addch (textchar);
	p++;
    }
}
开发者ID:ebichu,项目名称:dd-wrt,代码行数:65,代码来源:editdraw.c


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