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


C++ ImageLoader::getImage方法代码示例

本文整理汇总了C++中ImageLoader::getImage方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageLoader::getImage方法的具体用法?C++ ImageLoader::getImage怎么用?C++ ImageLoader::getImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ImageLoader的用法示例。


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

示例1:

Background::Background(ImageLoader& loader, Matrix2D<TileAndOverlay_s>* matrixPointer) :
    m_matrixPointer(matrixPointer),
    m_tileMap(),
    m_offsetx(0),
    m_offsety(0),
    m_h(0),
    m_w(0)
{
    m_tileMap[TileEnum_FOREST] = &loader.getImage(FOREST_TILE_PATH);
    m_tileMap[TileEnum_GRASS]  = &loader.getImage(GRASS_TILE_PATH);
    m_tileMap[TileEnum_WATER]  = &loader.getImage(WATER_TILE_PATH);

    /* Pick the width and height of the first tile, assume they are all equally sized */
    m_h = m_tileMap.begin()->second->getHeight();
    m_w = m_tileMap.begin()->second->getWidth();

    std::cout << "Loaded images" << std::endl;
}
开发者ID:krumberg,项目名称:astar,代码行数:18,代码来源:Background.cpp

示例2: main


//.........这里部分代码省略.........
			CS_courses[j]->teach();
		}
		if (MALAG){
			for (int j = 0 ; j < (int)PG_courses.size() ; j++){
				PG_courses[j]->teach();
			}
		}
		for (int j = 0 ; j < (int)EL_courses.size() ; j++){
			EL_courses[j]->teach();
		}
	}

	///// GRADUATION /////

	// make a list of all the students who started their studies
	vector<Student*> newList;
	newList = CS_students;
	if (MALAG){
		for (int i = 0 ; i < (int)PG_students.size() ; i++){
			newList.push_back(PG_students[i]);
		}
		func.quicksort(newList, 0, newList.size()-1);
	}

	ImageOperations opr;
	int CS_size = CS_students.size();
	int PG_size = PG_students.size();
	ImageLoader CS_picture = ImageLoader(100, 100*CS_size);
	ImageLoader PG_picture = ImageLoader(100, 100*PG_size);
	int CS_counter = 0;
	int PG_counter = 0;

	for (int i = 0 ; i < (int)newList.size() ; i++){
		// resize image
		ImageLoader srcPic(newList[i]->getImage());
		ImageLoader newPic = ImageLoader(100, 100);
		opr.resize(srcPic.getImage(),newPic.getImage());
		srcPic.getImage().release();

		// graduation for CS students
		if (newList[i]->type() == 'C'){
			string line = func.toString(newList[i]->getID()) + " has ";
			if((newList[i])->isGraduated((int)CS_courses.size(), CS_elective)){
				line = line + "graduated";
				opr.copy_paste_image(newPic.getImage(), CS_picture.getImage(), CS_counter*100);
				CS_counter++;
			}
			else{
				line = line + "not graduated";
				ImageLoader greyscale(100, 100);
				opr.rgb_to_greyscale(newPic.getImage(), greyscale.getImage());
				opr.copy_paste_image(greyscale.getImage(), CS_picture.getImage(), CS_counter*100);
				CS_counter++;
				greyscale.getImage().release();
			}
			func.print(line);
		}
		// graduation for PG students
		else{
			string line = func.toString(newList[i]->getID()) + " has ";
			if((newList[i])->isGraduated((int)PG_courses.size(), PG_elective)){
				line = line + "graduated";
				opr.copy_paste_image(newPic.getImage(), PG_picture.getImage(), PG_counter*100);
				PG_counter++;
			}
			else{
				line = line + "not graduated";
				ImageLoader greyscale = ImageLoader(100, 100);
				opr.rgb_to_greyscale(newPic.getImage(), greyscale.getImage());
				opr.copy_paste_image(greyscale.getImage(), PG_picture.getImage(), PG_counter*100);
				PG_counter++;
				greyscale.getImage().release();
			}
			func.print(line);
		}
		newPic.getImage().release();
	}

	CS_picture.saveImage("CS.jpg");
	PG_picture.saveImage("PG.jpg");
	CS_picture.displayImage();
	PG_picture.displayImage();

	///// DELETE DATA /////

	// delete courses
	func.deleteVector(CS_courses);
	func.deleteVector(PG_courses);
	func.deleteVector(EL_courses);

	// delete students
	func.deleteVector(CS_students);
	func.deleteVector(PG_students);

	// delete images
	CS_picture.getImage().release();
	PG_picture.getImage().release();

	a.close();
}
开发者ID:efrathaz,项目名称:my-academic-projects,代码行数:101,代码来源:RandomU.cpp


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