• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ read_color函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: stream

void NoteCanvas::read_internal(char *& st)
{
    const char * p = st;
    QTextCodec* codec = QTextCodec::codecForLocale();
    QTextStream stream(p);
    stream.setCodec(codec);
    QByteArray ba;
    stream   >> ba;
    QString temp = QString::fromLocal8Bit(ba);
    char* test = read_string(st);
    Q_UNUSED(test);
    note = temp;


    char * k = read_keyword(st);
    read_color(st, "color", itscolor, k);
    read_font(st, "font", itsfont, k);
    read_color(st, "fg", fg_c, k);

    if (strcmp(k, "xyzwh"))
        wrong_keyword(k, "xyzwh");

    read_xyzwh(st, this);
    width_scale100 = width();
    height_scale100 = height();
    set_center100();
    show();
}
开发者ID:harmegnies,项目名称:douml,代码行数:28,代码来源:NoteCanvas.cpp


示例2: my_parse

int				my_parse(t_fdf *e, int ac, char **av)
{
	int		i;
	int		fd;
	t_list	*list;

	if ((fd = open(av[1], O_RDWR)) < 0 && ft_printf("fdf: %s: ", av[1]))
	{
		perror("");
		return (0);
	}
	if ((i = my_filllist(&list, fd)) == -2)
		return (0);
	if (close(fd) && ft_printf("fdf: %s: ", av[1]))
	{
		perror("");
		return (0);
	}
	if (!check_list(e, &list))
		return (0);
	if (i == -1 || ac < 3)
		return ((i == -1) ? 0 : 1);
	if ((e->mic.col = read_color(av[2])) < 0)
		return ((e->mic.col = FDF_COL_MIN) + 1);
	if ((ac < 4 || (e->mac.col = read_color(av[3])) < 0))
		return ((e->mac.col = e->mic.col) + 1);
	return (1);
}
开发者ID:thomasLeMeur,项目名称:fdf,代码行数:28,代码来源:parse.c


示例3: read_controller

int read_controller(const char *device, struct controller *controller) {
  if (!read_capacity(device, &controller->capacity)) return 0;
  if (!read_color(device, "red",   &controller->r)) return 0;
  if (!read_color(device, "green", &controller->g)) return 0;
  if (!read_color(device, "blue",  &controller->b)) return 0;
  return 1;
}
开发者ID:jb55,项目名称:ds4ctl,代码行数:7,代码来源:battery.c


示例4: load_volume

Volume* load_volume(tinyxml2::XMLElement *elem, VolumeCache &cache, const std::string &scene_file){
	if (!elem->Attribute("name")){
		std::cout << "Scene error: Volumes require a name" << std::endl;
		return nullptr;
	}
	if (!elem->Attribute("type")){
		std::cout << "Scene error: Volumes require a type" << std::endl;
		return nullptr;
	}

	std::string name = elem->Attribute("name");
	std::string type = elem->Attribute("type");

	Volume *vol = cache.get(name);
	if (vol){
		return vol;
	}
	Colorf sig_a, sig_s, emit;
	float phase_asym;
	read_color(elem->FirstChildElement("absorption"), sig_a);
	read_color(elem->FirstChildElement("scattering"), sig_s);
	read_color(elem->FirstChildElement("emission"), emit);
	read_float(elem->FirstChildElement("phase_asymmetry"), phase_asym);

	if (type == "homogeneous"){
		Point min, max;
		read_point(elem->FirstChildElement("min"), min);
		read_point(elem->FirstChildElement("max"), max);
		return cache.add(name, std::make_unique<HomogeneousVolume>(sig_a, sig_s, emit, phase_asym, BBox{min, max}));
	}
	if (type == "exponential"){
		float a = 0, b = 0;
		Vector up;
		Point min, max;
		read_float(elem->FirstChildElement("a"), a);
		read_float(elem->FirstChildElement("b"), b);
		read_vector(elem->FirstChildElement("up"), up);
		read_point(elem->FirstChildElement("min"), min);
		read_point(elem->FirstChildElement("max"), max);
		return cache.add(name, std::make_unique<ExponentialVolume>(sig_a, sig_s, emit, phase_asym, BBox{min, max}, a, b, up));
	}
	if (type == "vol"){
		std::string file = scene_file.substr(0, scene_file.rfind(PATH_SEP) + 1) + elem->Attribute("file");
		float density_scale = 1;
		read_float(elem->FirstChildElement("density_scale"), density_scale);
		return cache.add(name, std::make_unique<GridVolume>(sig_a, sig_s, emit, phase_asym, file, density_scale));
	}
	std::cout << "Scene error: Unrecognized volume type " << type << std::endl;
	return nullptr;
}
开发者ID:Twinklebear,项目名称:tray,代码行数:50,代码来源:load_volume.cpp


示例5: return

PackageCanvas * PackageCanvas::read(char * & st, UmlCanvas * canvas, char * k) {
  if (!strcmp(k, "packagecanvas_ref"))
    return ((PackageCanvas *) dict_get(read_id(st), "packagecanvas", canvas));
  else if (!strcmp(k, "packagecanvas")) {
    int id = read_id(st);
    BrowserNode * br = BrowserPackage::read_ref(st);
    UmlColor color = UmlDefaultColor;
    Uml3States in_tab = UmlDefaultState;
    ShowContextMode context = DefaultShowContextMode;
    Uml3States show_stereotype_properties = UmlDefaultState;;
    
    k = read_keyword(st);
    
    if (!strcmp(k, "name_in_tab")) {
      in_tab = state(read_keyword(st));
      k = read_keyword(st);
    }
    
    if (!strcmp(k, "show_context_mode")) {
      context = context_mode(read_keyword(st));
      k = read_keyword(st);
    }

    if (!strcmp(k, "show_stereotype_properties")) {
      show_stereotype_properties = state(read_keyword(st));
      k = read_keyword(st);
    }

    read_color(st, "color", color, k);
    
    if (strcmp(k, "xyzwh"))
      wrong_keyword(k, "xyzwh");
    
    int x = (int) read_double(st);
    PackageCanvas * result =
      new PackageCanvas(br, canvas, x, (int) read_double(st), id);
    
    read_zwh(st, result);
    
    if (read_file_format() >= 58) {
      k = read_keyword(st);
      result->read_stereotype_property(st, k);	// updates k
      if (strcmp(k, "end"))
	wrong_keyword(k, "end");
    }
    
    result->name_in_tab = in_tab;
    result->show_context_mode = context;
    result->show_stereotype_properties = show_stereotype_properties;
    result->itscolor = color;
    result->check_size();
    result->set_center100();
    result->show();
    result->check_stereotypeproperties();
    
    return result;
  }
  else
    return 0;
}
开发者ID:kralf,项目名称:bouml,代码行数:60,代码来源:PackageCanvas.cpp


示例6: return

SubjectCanvas * SubjectCanvas::read(char * & st, UmlCanvas * canvas, char * k)
{
  if (!strcmp(k, "subject_ref"))
    return (SubjectCanvas *) dict_get(read_id(st), "subject", canvas);
  else if (!strcmp(k, "subject")) {
    int id = read_id(st);
    SubjectCanvas * result = new SubjectCanvas(canvas, 0, 0, id);
    
    result->name = toUnicode(read_string(st));
    
    k = read_keyword(st);
    read_color(st, "color", result->itscolor, k);
    
    if (strcmp(k, "xyzwh"))
      wrong_keyword(k, "xyzwh");
    
    read_xyzwh(st, result);
    result->check_size();
    result->width_scale100 = result->width();
    result->height_scale100 = result->height();
    result->set_center100();
    result->show();
    return result;
  }
  else
    return 0;
}
开发者ID:SciBoy,项目名称:douml,代码行数:27,代码来源:SubjectCanvas.cpp


示例7: f_antialias

int f_antialias(ULONG *arg)
{
	rsiCOLOR color;
	float fnum;
	rsiResult err;

	if (arg[1])
	{
		fnum = (float)atof((char*)arg[1]);
		err = rsiSetAntialias(atoi((char *)arg[0]),rsiTAntiFilter,fnum,rsiTDone);
		if (err)
			return err;
	}

	if (arg[2])
	{
		if (!read_color(&color,(char*)arg[2]))
			return ERROR_COLOREXP;
		err = rsiSetAntialias(atoi((char *)arg[0]),rsiTAntiContrast,&color,rsiTDone);
		if (err)
			return err;
	}

	return rsiSetAntialias(atoi((char *)arg[0]),rsiTDone);
}
开发者ID:Kalamatee,项目名称:RayStorm,代码行数:25,代码来源:parser.cpp


示例8: antialias

ULONG antialias(ULONG *arg)
{
	rsiCOLOR color;
	float fnum;
	rsiResult err;

	err = rsiSetAntialias(CTXT,
		rsiTAntiSamples, *((int*)arg[0]),
		rsiTDone);
	if(err)
		return err;

	if(arg[1])
	{
		fnum = (float)atof((char*)arg[1]);
		err = rsiSetAntialias(CTXT,
			rsiTAntiFilter,fnum,
			rsiTDone);
		if(err)
			return err;
	}

	if(arg[2])
	{
		if(!read_color(&color,(char*)arg[2]))
			return ERROR_COLOR;
		err = rsiSetAntialias(CTXT,
			rsiTAntiContrast,&color,
			rsiTDone);
		if(err)
			return err;
	}

	return rsiERR_NONE;
}
开发者ID:privatosan,项目名称:RayStorm,代码行数:35,代码来源:interface.cpp


示例9: return

DeploymentNodeCanvas * DeploymentNodeCanvas::read(char * & st, UmlCanvas * canvas, char * k) {
  if (!strcmp(k, "deploymentnodecanvas_ref"))
    return ((DeploymentNodeCanvas *) dict_get(read_id(st), "deploymentnodecanvas", canvas));
  else if (!strcmp(k, "deploymentnodecanvas")) {
    int id = read_id(st);
    BrowserNode * br = BrowserDeploymentNode::read_ref(st);
    QString iname;
    Uml3States write_horizontally = UmlDefaultState;
    Uml3States show_stereotype_properties = UmlDefaultState;
    
    k = read_keyword(st);
    
    if (!strcmp(k, "name")) {
      iname = read_string(st);
      k = read_keyword(st);
    }
    if (!strcmp(k, "write_horizontally") ||
	!strcmp(k, "write_horizontaly")) {
      write_horizontally = state(read_keyword(st));
      k = read_keyword(st);
    }
    if (!strcmp(k, "show_stereotype_properties")) {
      show_stereotype_properties = state(read_keyword(st));
      k = read_keyword(st);
    }
    
    UmlColor color = UmlDefaultColor;
    
    read_color(st, "color", color, k);
    
    if (strcmp(k, "xyzwh"))
      wrong_keyword(k, "xyzwh");
    
    int x = (int) read_double(st);
    DeploymentNodeCanvas * result =
      new DeploymentNodeCanvas(br, canvas, x, (int) read_double(st), id);
    
    read_zwh(st, result);
    
    if (read_file_format() >= 58) {
      k = read_keyword(st);
      result->read_stereotype_property(st, k);	// updates k
      if (strcmp(k, "end"))
	wrong_keyword(k, "end");
    }
    
    result->iname = iname;
    result->write_horizontally = write_horizontally;
    result->show_stereotype_properties = show_stereotype_properties;
    result->itscolor = color;
    result->check_size();
    result->set_center100();
    result->show();
    result->check_stereotypeproperties();
    
    return result;
  }
  else
    return 0;
}
开发者ID:SciBoy,项目名称:douml,代码行数:60,代码来源:DeploymentNodeCanvas.cpp


示例10: checkobject

// set_nametag_attributes(self, attributes)
int ObjectRef::l_set_nametag_attributes(lua_State *L)
{
	NO_MAP_LOCK_REQUIRED;
	ObjectRef *ref = checkobject(L, 1);
	ServerActiveObject *co = getobject(ref);

	if (co == NULL)
		return 0;
	ObjectProperties *prop = co->accessObjectProperties();
	if (!prop)
		return 0;

	lua_getfield(L, 2, "color");
	if (!lua_isnil(L, -1)) {
		video::SColor color = prop->nametag_color;
		read_color(L, -1, &color);
		prop->nametag_color = color;
	}
	lua_pop(L, 1);

	std::string nametag = getstringfield_default(L, 2, "text", "");
	prop->nametag = nametag;

	co->notifyObjectPropertiesModified();
	lua_pushboolean(L, true);
	return 1;
}
开发者ID:rubenwardy,项目名称:minetest,代码行数:28,代码来源:l_object.cpp


示例11: checkobject

// set_clouds(self, {density=, color=, ambient=, height=, thickness=, speed=})
int ObjectRef::l_set_clouds(lua_State *L)
{
	NO_MAP_LOCK_REQUIRED;
	ObjectRef *ref = checkobject(L, 1);
	RemotePlayer *player = getplayer(ref);
	if (!player)
		return 0;
	if (!lua_istable(L, 2))
		return 0;

	CloudParams cloud_params = player->getCloudParams();

	cloud_params.density = getfloatfield_default(L, 2, "density", cloud_params.density);

	lua_getfield(L, 2, "color");
	if (!lua_isnil(L, -1))
		read_color(L, -1, &cloud_params.color_bright);
	lua_pop(L, 1);
	lua_getfield(L, 2, "ambient");
	if (!lua_isnil(L, -1))
		read_color(L, -1, &cloud_params.color_ambient);
	lua_pop(L, 1);

	cloud_params.height    = getfloatfield_default(L, 2, "height",    cloud_params.height   );
	cloud_params.thickness = getfloatfield_default(L, 2, "thickness", cloud_params.thickness);

	lua_getfield(L, 2, "speed");
	if (lua_istable(L, -1)) {
		v2f new_speed;
		new_speed.X = getfloatfield_default(L, -1, "x", 0);
		new_speed.Y = getfloatfield_default(L, -1, "y", 0);
		cloud_params.speed = new_speed;
	}
	lua_pop(L, 1);

	if (!getServer(L)->setClouds(player, cloud_params.density,
			cloud_params.color_bright, cloud_params.color_ambient,
			cloud_params.height, cloud_params.thickness,
			cloud_params.speed))
		return 0;

	player->setCloudParams(cloud_params);

	lua_pushboolean(L, true);
	return 1;
}
开发者ID:theDrake,项目名称:minetest,代码行数:47,代码来源:l_object.cpp


示例12: toUnicode

void NoteCanvas::read_internal(char * & st) {
  note = toUnicode(read_string(st));
  
  char * k = read_keyword(st);
  read_color(st, "color", itscolor, k);
  read_font(st, "font", itsfont, k);
  read_color(st, "fg", fg_c, k);
  
  if (strcmp(k, "xyzwh"))
    wrong_keyword(k, "xyzwh");
  
  read_xyzwh(st, this);
  width_scale100 = width();
  height_scale100 = height();
  set_center100();
  show();
}
开发者ID:kralf,项目名称:bouml,代码行数:17,代码来源:NoteCanvas.cpp


示例13: read_tiledef

TileDef read_tiledef(lua_State *L, int index, u8 drawtype)
{
	if(index < 0)
		index = lua_gettop(L) + 1 + index;

	TileDef tiledef;

	bool default_tiling = true;
	bool default_culling = true;
	switch (drawtype) {
		case NDT_PLANTLIKE:
		case NDT_FIRELIKE:
			default_tiling = false;
			// "break" is omitted here intentionaly, as PLANTLIKE
			// FIRELIKE drawtype both should default to having
			// backface_culling to false.
		case NDT_MESH:
		case NDT_LIQUID:
			default_culling = false;
			break;
		default:
			break;
	}

	// key at index -2 and value at index
	if(lua_isstring(L, index)){
		// "default_lava.png"
		tiledef.name = lua_tostring(L, index);
		tiledef.tileable_vertical = default_tiling;
		tiledef.tileable_horizontal = default_tiling;
		tiledef.backface_culling = default_culling;
	}
	else if(lua_istable(L, index))
	{
		// name="default_lava.png"
		tiledef.name = "";
		getstringfield(L, index, "name", tiledef.name);
		getstringfield(L, index, "image", tiledef.name); // MaterialSpec compat.
		tiledef.backface_culling = getboolfield_default(
			L, index, "backface_culling", default_culling);
		tiledef.tileable_horizontal = getboolfield_default(
			L, index, "tileable_horizontal", default_tiling);
		tiledef.tileable_vertical = getboolfield_default(
			L, index, "tileable_vertical", default_tiling);
		// color = ...
		lua_getfield(L, index, "color");
		tiledef.has_color = read_color(L, -1, &tiledef.color);
		lua_pop(L, 1);
		// animation = {}
		lua_getfield(L, index, "animation");
		tiledef.animation = read_animation_definition(L, -1);
		lua_pop(L, 1);
	}

	return tiledef;
}
开发者ID:kaeza,项目名称:minetest,代码行数:56,代码来源:c_content.cpp


示例14: transpar

ULONG transpar(ULONG *arg)
{
	rsiCOLOR color;

	if(!surf)
		return rsiERR_SURFACE;

	if(!read_color(&color,(char*)arg[0]))
		return ERROR_COLOR;

	return rsiSetSurface(CTXT, surf->item,rsiTSurfTranspar,&color,rsiTDone);
}
开发者ID:privatosan,项目名称:RayStorm,代码行数:12,代码来源:interface.cpp


示例15: f_reflect

int f_reflect(ULONG *arg)
{
	rsiCOLOR color;

	if (!surf)
		return rsiERR_SURFACE;

	if (!read_color(&color,(char*)arg[0]))
		return ERROR_COLOREXP;

	return rsiSetSurface(surf->item,rsiTSurfReflect,&color,rsiTDone);
}
开发者ID:Kalamatee,项目名称:RayStorm,代码行数:12,代码来源:parser.cpp


示例16: return

TextCanvas * TextCanvas::read(char *& st, UmlCanvas * canvas, char * k)
{
    if (!strcmp(k, "textcanvas_ref"))
        return ((TextCanvas *) dict_get(read_id(st), "textcanvas", canvas));
    else if (!strcmp(k, "textcanvas")) {
        int id = read_id(st);
        QString text = read_string(st);
        UmlFont font;
        UmlColor fg_c = UmlBlack;
        UmlColor bg_c = UmlTransparent;

        k = read_keyword(st);
        read_font(st, "font", font, k);
        read_color(st, "fg", fg_c, k);
        read_color(st, "bg", bg_c, k);

        if (strcmp(k, "xyzwh"))
            wrong_keyword(k, "xyzwh");

        int x = (int) read_double(st);

        TextCanvas * result =
                new TextCanvas(canvas, x, (int) read_double(st), id);

        read_zwh(st, result);
        result->width_scale100 = result->width();
        result->height_scale100 = result->height();
        result->set_center100();
        result->text = text;
        result->itsfont = font;
        result->fg_c = fg_c;
        result->bg_c = bg_c;
        result->show();

        return result;
    }
    else
        return 0;
}
开发者ID:ErickCastellanos,项目名称:douml,代码行数:39,代码来源:TextCanvas.cpp


示例17: main

int main (int argc, char** argv) {
	if (argc == 3) {
		std::string filename = argv [1];
		std::string output = argv [2];
		
		std::string type = get_type (filename);
		
		if (type == "" || !find_type (type)) {
			type = "original";
		}
		
		read_color (type_location (type));
		
		print_highlight (filename, output);
	}
}
开发者ID:HSEFZ,项目名称:CloudIDE,代码行数:16,代码来源:main.cpp


示例18: read_keyword

SdDurationCanvas * SdDurationCanvas::read_internal(char * & st,
						   UmlCanvas * canvas, int id,
						   SdDurationSupport * sp)
{
  UmlColor color = UmlDefaultColor;
  bool coreg = FALSE;
  char * k = read_keyword(st);
  
  if (!strcmp(k, "coregion")) {
    coreg = TRUE;
    k = read_keyword(st);
  }
  
  read_color(st, "color", color, k);
  
  if (strcmp(k, "xyzwh"))
    wrong_keyword(k, "xyzwh");
  
  int x = (int) read_double(st);
  int y = (int) read_double(st);
  double z = read_double(st);
  (void) read_double(st);	// width not used to bypass old bug
  
  SdDurationCanvas * result =
    new SdDurationCanvas(canvas, sp, x, y, DURATION_WIDTH, 
			 (int) read_double(st), id, coreg);
  
  result->itscolor = color;
  result->setZ(z);
  result->update_hpos();	// in case the current font is not the original one
  result->set_center100();
  result->show();

  if (read_file_format() >= 48) {
    k = read_keyword(st);
    
    while (!strcmp(k, "overlappingdurationcanvas")) {
      (void) read_internal(st, canvas, read_id(st), result);
      k = read_keyword(st);
    }
    
    if (strcmp(k, "end"))
      wrong_keyword(k, "end");
  }
  
  return result;
}
开发者ID:kralf,项目名称:bouml,代码行数:47,代码来源:SdDurationCanvas.cpp


示例19: checkobject

// set_nametag_attributes(self, attributes)
int ObjectRef::l_set_nametag_attributes(lua_State *L)
{
	NO_MAP_LOCK_REQUIRED;
	ObjectRef *ref = checkobject(L, 1);
	PlayerSAO *playersao = getplayersao(ref);
	if (playersao == NULL)
		return 0;

	lua_getfield(L, 2, "color");
	if (!lua_isnil(L, -1)) {
		video::SColor color = playersao->getNametagColor();
		if (!read_color(L, -1, &color))
			return 0;
		playersao->setNametagColor(color);
	}

	lua_pushboolean(L, true);
	return 1;
}
开发者ID:prodigeni,项目名称:freeminer,代码行数:20,代码来源:l_object.cpp


示例20: return

ArtifactCanvas * ArtifactCanvas::read(char * & st, UmlCanvas * canvas,
					char * k)
{
  if (!strcmp(k, "artifactcanvas_ref") || 
      ((read_file_format() < 20) && !strcmp(k, "componentcanvas_ref")))
    return ((ArtifactCanvas *) dict_get(read_id(st), "artifactcanvas", canvas));
  else if (!strcmp(k, "artifactcanvas") || 
	   ((read_file_format() < 20) && !strcmp(k, "componentcanvas"))) {
    int id = read_id(st);
    BrowserArtifact * br = BrowserArtifact::read_ref(st, read_keyword(st));
    ArtifactCanvas * result = new ArtifactCanvas(canvas, id);
    
    result->browser_node = br;
    connect(br->get_data(), SIGNAL(changed()), result, SLOT(modified()));
    connect(br->get_data(), SIGNAL(deleted()), result, SLOT(deleted()));

    k = read_keyword(st);
    
    read_color(st, "color", result->itscolor, k);	// updates k
    
    if (strcmp(k, "xyz"))
      wrong_keyword(k, "xyz");
    read_xyz(st, result);
    
    if (read_file_format() >= 58) {
      k = read_keyword(st);
      result->read_stereotype_property(st, k);	// updates k
      
      if (strcmp(k, "end"))
	wrong_keyword(k, "end");
    }
    
    result->compute_size();
    result->set_center100();
    result->show();
    result->check_stereotypeproperties();
    return result;
  }
  else 
    return 0;
}
开发者ID:kralf,项目名称:bouml,代码行数:41,代码来源:ArtifactCanvas.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ read_command函数代码示例发布时间:2022-05-30
下一篇:
C++ read_chars函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap