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

C++ colors函数代码示例

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

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



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

示例1: colors

void ExtractEdges::calculate_colors( const kvs::VolumeObjectBase* volume )
{
    const T* value = reinterpret_cast<const T*>( volume->values().data() );
    const T* const end = value + volume->values().size();

    kvs::ValueArray<kvs::UInt8> colors( 3 * volume->numberOfNodes() );
    kvs::UInt8* color = colors.data();

    kvs::ColorMap cmap( BaseClass::colorMap() );

    if ( !volume->hasMinMaxValues() ) { volume->updateMinMaxValues(); }
    const kvs::Real64 min_value = volume->minValue();
    const kvs::Real64 max_value = volume->maxValue();

    const kvs::Real64 normalize_factor =
        static_cast<kvs::Real64>( cmap.resolution() - 1 ) / ( max_value - min_value );

    const size_t veclen = BaseClass::volume()->veclen();
    if ( veclen == 1 )
    {
        while ( value < end )
        {
            const kvs::UInt32 color_level =
                static_cast<kvs::UInt32>( normalize_factor * ( static_cast<kvs::Real64>( *( value++ ) ) - min_value ) );

            *( color++ ) = cmap[ color_level ].red();
            *( color++ ) = cmap[ color_level ].green();
            *( color++ ) = cmap[ color_level ].blue();
        }
    }
    else
    {
        while( value < end )
        {
            kvs::Real64 magnitude = 0.0;
            for ( size_t i = 0; i < veclen; ++i )
            {
                magnitude += kvs::Math::Square( static_cast<kvs::Real64>( *value ) );
                ++value;
            }
            magnitude = std::sqrt( magnitude );

            const kvs::UInt32 color_level =
                static_cast<kvs::UInt32>( normalize_factor * ( magnitude - min_value ) );

            *( color++ ) = cmap[ color_level ].red();
            *( color++ ) = cmap[ color_level ].green();
            *( color++ ) = cmap[ color_level ].blue();
        }
    }

    SuperClass::setColors( colors );
}
开发者ID:hofsta,项目名称:KVS,代码行数:53,代码来源:ExtractEdges.cpp


示例2: PlotClusters

void PlotClusters(cv::Mat &dataset, const int *const medoids, const int *const assignment, int nData, int nMedoids)
{
    float minx = std::numeric_limits<float>::max();
    float miny = std::numeric_limits<float>::max();
    float maxx = 0;
    float maxy = 0;

    for(int i=0; i < dataset.rows; i++)
    {
        cv::Mat tmp = dataset.row(i);
        if(tmp.at<float>(0,0) < minx)
            minx = tmp.at<float>(0,0);
        if(tmp.at<float>(0,0) > maxx)
            maxx = tmp.at<float>(0,0);
        if(tmp.at<float>(0,1) < miny)
            miny = tmp.at<float>(0,1);
        if(tmp.at<float>(0,1) > maxy)
            maxy = tmp.at<float>(0,1);
    }
    float xdim = maxx - minx;
    float ydim = maxy - miny;

    Eigen::MatrixXd colors(nMedoids,3);

    ColorPicker picker(nMedoids);

    cv::Mat img = cv::Mat::ones(1024,1024,CV_8UC3);
    
    for(int i=0; i < dataset.rows-1; i++)
    {
        cv::Mat tmp = dataset.row(i);
        float x = ((tmp.at<float>(0,0) - minx)/xdim)*1024;
        float y = ((tmp.at<float>(0,1) - miny)/ydim)*1024;
        cv::Point2f a(x,y);
        Color c = picker.getColor(assignment[i]);
        cv::circle(img, a, 2, cv::Scalar(c.r_,c.g_,c.b_), -1 );
    }
    for(int i=0; i < nMedoids; i++)
    {
        int center_ind = medoids[i];
        cv::Mat tmp = dataset.row(medoids[i]);
        float x = ((tmp.at<float>(0,0) - minx)/xdim)*1024;
        float y = ((tmp.at<float>(0,1) - miny)/ydim)*1024;
        cv::Point2f a(x,y);
        Color c = picker.getColor(assignment[medoids[i]]);
        cv::circle(img, a, 10, cv::Scalar(c.r_,c.g_,c.b_), -1 );
    }

    cv::imwrite("Clusters.jpg", img);
//    cv::imshow("Clusters",img);
 //   cv::waitKey(0);

}
开发者ID:caomw,项目名称:parallel-clustering,代码行数:53,代码来源:main.cpp


示例3: topologicalSort

bool topologicalSort(const AdjacentGraph& adjG, 
		veci &sortingVertice) {
	std::vector<int> colors(adjG.getSize(), White);
	std::vector<int> d(adjG.getSize(), NotAcess);
	std::vector<int> pai(adjG.getSize(), nil);
	std::vector<int> finish(adjG.getSize(), NotAcess);

	bool haveCircle = false;
	int time = 1;

	for( int i = 0; i < adjG.getSize(); i++ ) {
		if(colors[i] == White) {
			colors[i] = Gray;
			d[i] = time;
			time += 1;
			pai[i] = nil;
			std::cout << "visit " << i << std::endl;
			DFSAuxliary(adjG, colors, d, pai, finish, 
					i, time, haveCircle);
			if(haveCircle)
				return false;
		}
	}

	
	std::cout << "start " << d << std::endl;
	std::cout << "finish " << finish << std::endl;


	typedef std::pair<int, int> finishIndex;
	std::vector<finishIndex> tmp;

	for( int i = 0 ; static_cast<unsigned>(i) < finish.size() ; i++ )
	{
		tmp.push_back(std::make_pair(finish[i], i));
	}

	std::sort(tmp.begin(), tmp.end());

	for( int i = 0 ; static_cast<unsigned>(i) < tmp.size() ; i++ )
	{
		sortingVertice.push_back(tmp[i].second);
	}

	for( int i = 0, j = tmp.size() - 1 ;
		   	i < j ; i++, j-- )
	{
		std::swap(sortingVertice[i], sortingVertice[j]);
	}
	return true;

}
开发者ID:yuandaxing,项目名称:utils,代码行数:52,代码来源:Topological-sort.cpp


示例4: gridImage

QVector<triC> mutableSquareImageContainer::checkColorList() {

  if (colorListCheckNeeded_) {
    const grid gridImage(image_);
    const QVector<triC> colorsToRemove = ::findColors(gridImage, colors());
    removeColors(colorsToRemove);
    colorListCheckNeeded_ = false;
    return colorsToRemove;
  }
  else {
    return QVector<triC>();
  }
}
开发者ID:craftoid,项目名称:Cstitch,代码行数:13,代码来源:squareImageContainer.cpp


示例5: TopologicalSort

bool TopologicalSort(const Graph& g,vi& order)
{
	int size=g.size();
	order.clear();
	vi colors(size);
	rep(i,size){
		if(!Visit(g,i,colors,order)){
			order.clear();
			return false;
		}
	}
	reverse(all(order));
	return true;
}
开发者ID:lyoz,项目名称:library,代码行数:14,代码来源:topologicalsort.cpp


示例6: sizes

/*===========================================================================*/
void SphereGlyph::attach_point( const kvs::PointObject* point )
{
    m_point = point;

    const size_t nvertices = point->numberOfVertices();

    BaseClass::setCoords( point->coords() );

    if ( BaseClass::directionMode() == BaseClass::DirectionByNormal )
    {
        if ( point->numberOfNormals() != 0 )
        {
            BaseClass::setDirections( point->normals() );
        }
    }

    if ( point->numberOfSizes() == 1 )
    {
        const kvs::Real32 size = point->size();
        kvs::ValueArray<kvs::Real32> sizes( nvertices );
        for ( size_t i = 0; i < nvertices; i++ ) sizes[i] = size;
        BaseClass::setSizes( sizes );
    }
    else
    {
        BaseClass::setSizes( point->sizes() );
    }

    if ( point->numberOfColors() == 1 )
    {
        const kvs::RGBColor color = point->color();
        kvs::ValueArray<kvs::UInt8> colors( nvertices * 3 );
        for ( size_t i = 0, j = 0; i < nvertices; i++, j += 3 )
        {
            colors[j]   = color.r();
            colors[j+1] = color.g();
            colors[j+2] = color.b();
        }
        BaseClass::setColors( colors );
    }
    else
    {
        BaseClass::setColors( point->colors() );
    }

    const kvs::UInt8 opacity = static_cast<kvs::UInt8>( 255 );
    kvs::ValueArray<kvs::UInt8> opacities( nvertices );
    for ( size_t i = 0; i < nvertices; i++ ) opacities[i] = opacity;
    BaseClass::setOpacities( opacities );
}
开发者ID:fudy1129,项目名称:kvs,代码行数:51,代码来源:SphereGlyph.cpp


示例7: erodeMask

void HumanBodyLaser::compute3DPoints()
{
	cout << "\nCompute 3D points from the disparity result." << endl;

	Mat mask = erodeMask(mskL, (stereoPyr[0]->GetWsize())*2);
	Mat disp = stereoPyr[0]->GetDisp();	

	vector<Point3f> points(0);
	vector<Vec3b> colors(0);
	vector<Vec3f> normals(0);

	float offsetD = stPointL.x - stPointR.x;
	int height = imSize.height;
	int width  = imSize.width;
	int validnum = 0;

	for(int y = 0; y < height; ++y)
	{
		float * pdsp = (float *)disp.ptr<float>(y);
		uchar * pmsk = (uchar *)mask.ptr<uchar>(y);

		for(int x = 0; x < width; ++x)
		{
			if (pmsk[x] == 0)
			{
				pdsp[x] = 0;
				continue;
			}

			if (pdsp[x] != 0)
			{
				pdsp[x] += offsetD;
				validnum ++;
			}
		}
	}

	Mat colorImL;
	imL.convertTo(colorImL, CV_8U, 255);   //RGB

	Disp2Point(disp, stPointL, colorImL, mask, QMatrix, points, colors, normals);

	//refine3DPoints(points, colors, validnum);

	//string savefn = outdir + "/pointcloud_" + camL + camR + "_" + frame + ".ply";
	string savefn = "d_pointcloud_" + camL + camR + "_" + frame + ".ply";
	writePLY(savefn, width, height, validnum, PT_HAS_COLOR|PT_HAS_NORMAL, points, colors, normals);
	cout << "\nsave " << savefn << " done. " << validnum << " Points." << endl;
}
开发者ID:Ranqing,项目名称:HumanBodyLaser,代码行数:49,代码来源:laser.cpp


示例8: CECE_ASSERT

void Texture::resize(Size size, const Color& color)
{
    CECE_ASSERT(isInitialized());

    m_size = std::move(size);

    const auto width = m_size.getWidth();
    const auto height = m_size.getHeight();

    // Create initial buffer
    DynamicArray<Color> colors(width * height, color);

    gl(glBindTexture(GL_TEXTURE_2D, m_id));
    gl(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, ColorComponentType<Color::ComponentType>::value, colors.data()));
}
开发者ID:GeorgievLab,项目名称:CeCe-core,代码行数:15,代码来源:Texture.cpp


示例9: assert

void Texture::resize(Size size, const Color& color)
{
    assert(isInitialized());

    m_size = std::move(size);

    const auto width = m_size.getWidth();
    const auto height = m_size.getHeight();

    // Create initial buffer
    DynamicArray<Color> colors(width * height, color);

    gl(glBindTexture(GL_TEXTURE_2D, m_id));
    gl(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_FLOAT, colors.data()));
}
开发者ID:GustavoPB,项目名称:CeCe,代码行数:15,代码来源:Texture.cpp


示例10: positions

void Renderer::DrawLights(const std::vector<Avpl>& avpls, CRenderTarget* target)
{	
	if(!m_confManager->GetConfVars()->DrawLights || avpls.size() == 0)
		return;

	std::vector<glm::vec3> positions(avpls.size());
	std::vector<glm::vec3> colors(avpls.size());
	for (int i = 0; i < avpls.size(); ++i) {
		positions[i] = avpls[i].getPosition();
		colors[i] = glm::vec3(1.f, 0.f, 1.f);
	}
	std::shared_ptr<PointCloud> pointCloud = std::make_shared<PointCloud>(positions, colors, m_ubTransform.get(), m_scene->getSceneExtent() / 100.f);

	CRenderTargetLock lock(target);
	pointCloud->Draw();
}
开发者ID:flosmn,项目名称:AntiradianceCuts,代码行数:16,代码来源:Render.cpp


示例11: QDialog

PlotViewer::PlotViewer(QWidget *parent, const arma::vec &x, const arma::vec &y, arma::vec z, QString x_label, QString y_label) :
    QDialog(parent),
    ui(new Ui::PlotViewer),
    context_menu_("Plot Options", this),
    directory_(QDir::homePath())
{
    ui->setupUi(this);
    plot_ = findChild<QCustomPlot *>("plot");
    plot_->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(plot_, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(ShowContextMenu(QPoint)));
    AddContextMenuItems();
    typedef std::vector<double> stdvec;
    arma::field<arma::vec> x_parts;
    arma::field<arma::vec> y_parts;
    arma::vec unique_z = arma::unique(z);
    x_parts.set_size(unique_z.n_rows);
    y_parts.set_size(unique_z.n_rows);
    QVector<QColor> colors(unique_z.n_rows);
    colors.append(QColor(228,26,28));
    colors.append(QColor(55,126,184));
    colors.append(QColor(77,175,74));
    colors.append(QColor(152,78,163));
    colors.append(QColor(255,127,0));
    colors.append(QColor(255,255,51));
    colors.append(QColor(166,86,40));
    colors.append(QColor(247,129,191));
    colors.append(QColor(153,153,153));

    plot_->xAxis->setLabel(x_label);
    plot_->yAxis->setLabel(y_label);
    plot_->xAxis->setRange(x.min(), x.max());
    plot_->yAxis->setRange(y.min(), y.max());
    for (arma::uword i = 0; i < unique_z.n_rows; ++i){
        QPen pen(colors[i]);
        arma::uvec ind = arma::find(z == unique_z(i));
        QVector<double> x_qvec = QVector<double>::fromStdVector(arma::conv_to<stdvec>::from(x(ind)));
        QVector<double> y_qvec = QVector<double>::fromStdVector(arma::conv_to<stdvec>::from(y(ind)));
        plot_->addGraph();
        plot_->graph(i)->setName(QString::number(i));
        plot_->graph(i)->setData(x_qvec, y_qvec);
        plot_->graph(i)->setPen(pen);
        plot_->graph(i)->setScatterStyle(QCPScatterStyle::ssDisc);
        plot_->legend->setVisible(true);
        plot_->graph(i)->addToLegend();
    }
    plot_->replot();
}
开发者ID:gtrosen,项目名称:Vespucci,代码行数:47,代码来源:plotviewer.cpp


示例12: myQuad

osg::ref_ptr<osg::Drawable> myQuad ()
{
   osg::ref_ptr<osg::Geode> geode (new osg::Geode());
   osg::ref_ptr<osg::Geometry> geometry (new osg::Geometry());

   osg::ref_ptr<osg::Vec3Array> vertices (new osg::Vec3Array());

   vertices->push_back (osg::Vec3 ( 1.0, 0.0, 0.0));
   vertices->push_back (osg::Vec3 ( 1.0, 0.0, 1.0));
   vertices->push_back (osg::Vec3 ( 0.0, 0.0, 1.0));
   vertices->push_back (osg::Vec3 (0.0, 0.0, 0.0));

   geometry->setVertexArray (vertices.get());

   // All vertices are white this time (it's hard to see that we have two
   // textures with all the colors...)
   osg::ref_ptr<osg::Vec4Array> colors (new osg::Vec4Array());
   colors->push_back (osg::Vec4 (1.0f, 1.0f, 1.0f, 1.0f));
   geometry->setColorArray (colors.get());
   geometry->setColorBinding (osg::Geometry::BIND_OVERALL);

   osg::ref_ptr<osg::Vec3Array> normals (new osg::Vec3Array());
   normals->push_back (osg::Vec3 (0.0f, -1.0f, 0.0f));
   geometry->setNormalArray (normals.get());
   geometry->setNormalBinding (osg::Geometry::BIND_OVERALL);


   osg::ref_ptr<osg::Vec2Array> texCoords (new osg::Vec2Array());

   texCoords->push_back (osg::Vec2 (0.0, 0.0));
   texCoords->push_back (osg::Vec2 (0.0, 1.0));
   texCoords->push_back (osg::Vec2 (1.0, 1.0));
   texCoords->push_back (osg::Vec2 (1.0, 0.0));

   // Here, the two texture units (0 and 1) share the same texture coordinates.
   geometry->setTexCoordArray (0, texCoords.get());
   geometry->setTexCoordArray (1, texCoords.get());

   // Back to the usual: setup a primitive set and add the geometry to the geode.
   geometry->addPrimitiveSet(
      new osg::DrawArrays (osg::PrimitiveSet::QUADS, // how to render?
                           0,                            // index of first vertex
                           vertices->size()));           // how many vertices?
  // geode->addDrawable (geometry.get());

   return geometry.get();
}
开发者ID:fkanehiro,项目名称:etc,代码行数:47,代码来源:Tuto11.cpp


示例13: colors

void ViewWidget::initGrids()
{
   const int numVertices = 2 * 2 * GRID_LINE_COUNT;
   osg::Vec3 vertices[numVertices];
   float length = (GRID_LINE_COUNT - 1) * GRID_LINE_SPACING;
   int ptr = 0;

   for(int i = 0; i < GRID_LINE_COUNT; ++i)
   {
      vertices[ptr++].set(-length / 2 + i * GRID_LINE_SPACING, length / 2, 0.0f);
      vertices[ptr++].set(-length / 2 + i * GRID_LINE_SPACING, -length / 2, 0.0f);
   }

   for (int i = 0; i < GRID_LINE_COUNT; ++i)
   {
      vertices[ptr++].set(length / 2, -length / 2 + i * GRID_LINE_SPACING, 0.0f);
      vertices[ptr++].set(-length / 2, -length / 2 + i * GRID_LINE_SPACING, 0.0f);
   }

   osg::ref_ptr<osg::Vec4Array> colors (new osg::Vec4Array());
   colors->push_back (osg::Vec4 (0.3, 0.3, 0.3, 1.0));

   osg::Geometry* geometry = new osg::Geometry;
   geometry->setVertexArray(new osg::Vec3Array(numVertices, vertices));
   geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 0, numVertices));
   geometry->setColorArray (colors.get());
   geometry->setColorBinding (osg::Geometry::BIND_PER_PRIMITIVE_SET);

   osg::Geode* geode = new osg::Geode;
   geode->addDrawable(geometry);
   geode->getOrCreateStateSet()->setMode(GL_LIGHTING, 0);

   mpXYGridTransform = new osg::MatrixTransform;
   mpXYGridTransform->addChild(geode);

   mpXZGridTransform = new osg::MatrixTransform;
   mpXZGridTransform->setMatrix(osg::Matrix::rotate(osg::PI_2, 1, 0, 0));

   mpXZGridTransform->addChild(geode);
   mpXZGridTransform->setNodeMask(0x0);

   mpYZGridTransform = new osg::MatrixTransform;
   mpYZGridTransform->setMatrix(osg::Matrix::rotate(osg::PI_2, 0, 1, 0));

   mpYZGridTransform->addChild(geode);
   mpYZGridTransform->setNodeMask(0x0);
}
开发者ID:banduladh,项目名称:levelfour,代码行数:47,代码来源:QViewWidget.cpp


示例14: table_link_name

Peg_world_wrapper::Peg_world_wrapper(ros::NodeHandle &nh,
                                     const std::string& node_name,
                                     const std::string& path_sensor_model,
                                     const std::string& fixed_frame,
                                     const std::string table_link_name,
                                     const std::string socket_link_name,
                                     const std::string socket_link_box_name)
    :fixed_frame(fixed_frame),
     table_link_name(table_link_name),
     socket_link_name(socket_link_name),
     socket_link_box_name(socket_link_box_name)
{


    // Initialise the table wall
    initialise_table_wall(table_link_name);
    initialise_socket(socket_link_name,socket_link_box_name);


    world_publisher = std::shared_ptr<ww::Publisher>(new ww::Publisher( node_name + "/visualization_marker",&nh,&world_wrapper));
    world_publisher->init(fixed_frame);
    world_publisher->update_position();

   /// Visualise socket

    vis_socket = std::shared_ptr<obj::Vis_socket>(new  obj::Vis_socket(nh,world_wrapper.wrapped_objects.wsocket));
    vis_socket->initialise(25,0.01);


    /// Peg model (Cartesian points);

     peg_sensor_model = std::shared_ptr<Peg_sensor_model>(new Peg_sensor_model(path_sensor_model,fixed_frame,world_wrapper.wrapped_objects));


    vis_points = std::shared_ptr<opti_rviz::Vis_points>( new  opti_rviz::Vis_points(nh,"peg_model"));
    vis_points->scale = 0.005;
    vis_points->initialise(fixed_frame,peg_sensor_model->get_model());

    vis_vectors = std::shared_ptr<opti_rviz::Vis_vectors>(new opti_rviz::Vis_vectors(nh,"closest_features") );
    vis_vectors->scale = 0.005;
    std::vector<tf::Vector3> colors(2);
    colors[0] = tf::Vector3(1,0,0);
    colors[1] = tf::Vector3(0,0,1);
    vis_vectors->set_color(colors);
    vis_vectors->initialise(fixed_frame,peg_sensor_model->get_arrows());

}
开发者ID:gpldecha,项目名称:plug_sensor_models,代码行数:47,代码来源:peg_world_wrapper.cpp


示例15: nstd_ausgabe

void nstd_ausgabe(sudoku* s,int color) {
    int i,j;
    for(i=0; i<9; i++) {
        if(i%3==0 && !color) printf("+-------+-------+-------+\n");
        for(j=0; j<9; j++) {
            if(j%3==0 && !color) printf("| ");
            if(color) {
                printf("%s%d \033[0m",colors(s->belegung[i][j]),s->feld[i][j]);
            } else
                printf("%d ",s->feld[i][j]);

        }
        if(!color) printf("|");
        printf("\n");
    }
    if(!color) printf("+-------+-------+-------+\n");
}
开发者ID:thomasba,项目名称:sudokuloeser,代码行数:17,代码来源:output_nstd.c


示例16: ui_gfx_count_devices

static void ui_gfx_count_devices(running_machine &machine, ui_gfx_state &state)
{
	// count the palette devices
	state.palette.devcount = palette_interface_iterator(machine.root_device()).count();

	// set the pointer to the first palette
	if (state.palette.devcount > 0)
		palette_set_device(machine, state);

	// count the gfx devices
	state.gfxset.devcount = 0;
	for (device_gfx_interface &interface : gfx_interface_iterator(machine.root_device()))
	{
		// count the gfx sets in each device, skipping devices with none
		uint8_t count = 0;
		while (count < MAX_GFX_ELEMENTS && interface.gfx(count) != nullptr)
			count++;

		// count = index of first nullptr
		if (count > 0)
		{
			state.gfxdev[state.gfxset.devcount].interface = &interface;
			state.gfxdev[state.gfxset.devcount].setcount = count;
			for (uint8_t slot = 0; slot != count; slot++) {
				auto gfx = interface.gfx(slot);
				if (gfx->has_palette())
				{
					state.gfxdev[state.gfxset.devcount].palette[slot] = &gfx->palette();
					state.gfxdev[state.gfxset.devcount].color_count[slot] = gfx->colors();
				}
				else
				{
					state.gfxdev[state.gfxset.devcount].palette[slot] = state.palette.interface;
					state.gfxdev[state.gfxset.devcount].color_count[slot] = state.palette.interface->entries() / gfx->granularity();
					if (!state.gfxdev[state.gfxset.devcount].color_count[slot])
						state.gfxdev[state.gfxset.devcount].color_count[slot] = 1;
				}
			}
			if (++state.gfxset.devcount == MAX_GFX_DECODERS)
				break;
		}
	}

	state.started = true;
}
开发者ID:qwijibo,项目名称:mame,代码行数:45,代码来源:viewgfx.cpp


示例17: draw_text

	int draw_text(int corner_x, int corner_y, int size, string text, int color){
	
		if((size > 4 || size < 1) && size < 10 ){
			cerr << "FutureGL Error: FutureGL only supports 4 core font sizes\nPlease adapt your code. Sorry.\n";
			return -1;
		}
	
		colors(1, color);
		glTranslated(corner_x, corner_y, 0);
	
		// Create a texture font from a TrueType file.

		FTFont *font;
		bool font_loaded = false;

		for(int i = 0; i < num_fonts; i++){
			font = new FTTextureFont(fonts[i].c_str());
			if(!(font->Error())){
				font_loaded = true;
				break;
			}
		}

		
		if(!font_loaded){
			cerr << "FutureGL Error: Font not found\nTried:\n";
			for(int i = 0; i < num_fonts; i++) cerr << "\t" << fonts[i] << "\n";
			return -1;
		}
	
		// Set the font size and render a small text.
		
		if(size == 1) font->FaceSize(60);
		else if(size == 2) font->FaceSize(29);
		else if(size == 3) font->FaceSize(10);
		else if(size == 4) font->FaceSize(10);
		else font->FaceSize(size);
		font->Render(text.c_str());

		delete(font);

		glTranslated(-corner_x, -corner_y, 0);
	
		return 0;
	}
开发者ID:tercatech,项目名称:futuregl,代码行数:45,代码来源:lgl_utils.cpp


示例18: colors

const QString GraphEdge::color(uint i) 
{
  if (i >= (uint)m_colors.count() && m_attributes.find(KEY_COLOR) != m_attributes.end())
  {
    colors(m_attributes[KEY_COLOR]);
  }
  if (i < (uint)m_colors.count())
  {
//     std::cerr << "edge color " << i << " is " << m_colors[i] << std::endl;
//     kDebug() << fromNode()->id() << " -> " << toNode()->id() << "color" << i << "is" << m_colors[i];
    return m_colors[i];
  }
  else
  {
//     kDebug() << fromNode()->id() << " -> " << toNode()->id() << "no edge color " << i << ". returning " << DOT_DEFAULT_EDGE_COLOR;
    return DOT_DEFAULT_EDGE_COLOR;
  }
}
开发者ID:KDE,项目名称:kgraphviewer,代码行数:18,代码来源:graphedge.cpp


示例19: colors

BOOL CExtendedCPU5EAXAMD::OnInitDialog()
   {
    CExtendedCPU5AMD::OnInitDialog();

    c_Caption.SetWindowText(_T(""));

    ColorSet colors(TRUE);

    POSITION p;
    p = colors.GetFirstColorPosition();
    SETCOLOR(7_0);
    SETCOLOR(15_8);
    SETCOLOR(23_16);
    SETCOLOR(31_24);

    return TRUE;  // return TRUE unless you set the focus to a control
                  // EXCEPTION: OCX Property Pages should return FALSE
   }
开发者ID:allen7575,项目名称:The-CPUID-Explorer,代码行数:18,代码来源:ExtendedCPU5EAXAMD.cpp


示例20: solve

    // nothing to inherit from GC really
    ColoredGraph solve(const Graph& gr) override {

        CoinModel coinModel;
        for (auto i = 0; i < gr.nodeCount(); ++i) {
            coinModel.addCol(0, nullptr, nullptr, 0, gr.nodeCount()-1, 1, nullptr, true);
        }
        OsiClpSolverInterface solver;
        solver.loadFromCoinModel(coinModel);

        CbcModel model(solver);
        model.setLogLevel(0);
        model.passInEventHandler(make_unique<GC_LP_EventHandler>(recoveryPath).get());

        if (use_heuristic) {
            GC_LP_Heuristic heuristic;
            model.addHeuristic(&heuristic);
        }

        AddRules(model, gr);

        if (use_parallel) {
            model.setNumberThreads(std::thread::hardware_concurrency());
        }

        if (max_seconds != 0) model.setMaximumSeconds(max_seconds);

        model.initialSolve();
        model.branchAndBound();

        if (model.maximumSecondsReached()) Println(cout, "max seconds reached");
        if (model.isSecondsLimitReached()) Println(cout, "seconds limit reached");

        seconds_passed_ = model.getCurrentSeconds();
        iterations_passed_ = model.getIterationCount();

        const double *solution = model.bestSolution();

        if (solution == nullptr) {
            vector<Color> colors(gr.nodeCount());
            iota(colors.begin(), colors.end(), 0);
            return {gr, colors};
        }
        return ColoredGraph(gr, {solution, solution+gr.nodeCount()});
    }
开发者ID:antoshkaplus,项目名称:Opt_GraphColoring,代码行数:45,代码来源:GC_LP.hpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ cols函数代码示例发布时间:2022-05-30
下一篇:
C++ colorname函数代码示例发布时间: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