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


C++ GImage::blit方法代码示例

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


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

示例1: finder

// static
void GSubImageFinder2::test()
{
	// Make some random image
	GImage foo;
	foo.setSize(256, 256);
	foo.clear(0xff000000);
	foo.boxFill(13, 8, 12, 17, 0xff808030);
	foo.boxFill(8, 13, 10, 9, 0xff407040);
	foo.boxFill(20, 20, 220, 220, 0xffffffee);

	// Make the finder
	GSubImageFinder2 finder(&foo);

	// Make a sub-image
	GRect r2(0, 0, 256, 256);
	GRect r;
	r.x = 13;
	r.y = 17;
	r.w = 32;
	r.h = 32;
	GImage bar;
	bar.setSize(32, 32);
	bar.blit(0, 0, &foo, &r);

	// Find the sub-image
	r.x = 0;
	r.y = 0;
	int x, y;
	finder.findSubImage(&x, &y, &bar, &r);
	if(x != 13 || y != 17)
		throw "wrong answer";
}
开发者ID:har777,项目名称:tapkee_benchmarks,代码行数:33,代码来源:GRegion.cpp

示例2: r

	CarOnHillModel(GRand* prng, GImage* pImage, GWidgetTextLabel* pWins)
	{
		m_pWins = pWins;
		m_wins = 0;
		m_pImage = pImage;
		m_carPos = 0;
		m_velocity = 0;
		m_prng = prng;

		// Load the car image and add some border so we can rotate it
		GImage tmp;
		tmp.loadPng("minicar.png");
		m_pCar = new GImage();
		m_pCar->setSize(70, 60);
		GRect r(0, 0, 60, 36);
		m_pCar->blit(5, 5, &tmp, &r);
		m_pRotatedCar = new GImage();

		// Make the agent
		GMixedRelation* pRelAgent = new GMixedRelation();
		sp_relation relAgent;
		relAgent = pRelAgent;
		pRelAgent->addAttr(0); // position
		pRelAgent->addAttr(0); // velocity
		pRelAgent->addAttr(2); // action {forward, reverse}
		double initialState[2];
		initialState[0] = m_carPos;
		initialState[1] = m_velocity;
		double goalState[2];
		goalState[0] = 2;
		goalState[1] = 0;
		m_pActionIterator = new GDiscreteActionIterator(2);
		m_pAgents[0] = new CarQAgent(relAgent, initialState, m_prng, m_pActionIterator);
		((GQLearner*)m_pAgents[0])->setLearningRate(.9);
		((GQLearner*)m_pAgents[0])->setDiscountFactor(0.999);
	}
开发者ID:litaoshao,项目名称:waffles,代码行数:36,代码来源:CarOnHill.cpp

示例3: labelAxes

GImage* GPlotWindow::labelAxes(int maxHorizAxisLabels, int maxVertAxisLabels, int precision, float size, unsigned int color, double angle)
{
	int spacing = 10;
	int horizMargin = 200;
	int vertMargin = 200;
	GImage* pOutImage = new GImage();
	pOutImage->setSize(m_pImage->width() + horizMargin, m_pImage->height() + vertMargin);
	pOutImage->clear(0xffffffff);
	GRect r(0, 0, m_pImage->width(), m_pImage->height());
	pOutImage->blit(horizMargin, 0, m_pImage, &r);
	if(maxHorizAxisLabels > 0)
	{
		GPlotLabelSpacer spacer(m_window.x, m_window.x + m_window.w, maxHorizAxisLabels);
		for(int i = 0; i < spacer.count(); i++)
		{
			double pos = spacer.label(i);
			int x1, y1;
			windowToView(pos, 0, &x1, &y1);
			numericLabel(pOutImage, pos, horizMargin + x1, m_pImage->height() + spacing, precision, size, color, angle);
		}
	}
	else if(maxHorizAxisLabels == -1)
	{
		GPlotLabelSpacerLogarithmic spacer(m_window.x, m_window.x + m_window.w);
		while(true)
		{
			double pos;
			bool primary;
			if(!spacer.next(&pos, &primary))
				break;
			if(primary)
			{
				double x = log(pos);
				int x1, y1;
				windowToView(x, 0, &x1, &y1);
				numericLabel(pOutImage, pos, horizMargin + x1, m_pImage->height() + spacing, precision, size, color, angle);
			}
		}
	}
	if(maxVertAxisLabels > 0)
	{
		GPlotLabelSpacer spacer(m_window.y, m_window.y + m_window.h, maxVertAxisLabels);
		for(int i = 0; i < spacer.count(); i++)
		{
			double pos = spacer.label(i);
			int x1, y1;
			windowToView(0, pos, &x1, &y1);
			numericLabel(pOutImage, pos, horizMargin - spacing, y1, precision, size, color, 0.0);
		}
	}
	else if(maxVertAxisLabels == -1)
	{
		GPlotLabelSpacerLogarithmic spacer(m_window.y, m_window.y + m_window.h);
		while(true)
		{
			double pos;
			bool primary;
			if(!spacer.next(&pos, &primary))
				break;
			if(primary)
			{
				double y = log(pos);
				int x1, y1;
				windowToView(0, y, &x1, &y1);
				numericLabel(pOutImage, pos, horizMargin - spacing, y1, precision, size, color, 0.0);
			}
		}
	}
	return pOutImage;
}
开发者ID:har777,项目名称:tapkee_benchmarks,代码行数:70,代码来源:GPlot.cpp

示例4: draw

	virtual void draw(SDL_Surface *pScreen)
	{
		GImage* pDialogImage = m_pDialog->image();
		m_pBackgroundImage->blit(m_x, m_y, pDialogImage, m_pDialog->rect());
		blitImage(pScreen, m_nLeft, m_nTop, m_pBackgroundImage);
	}
开发者ID:winghc,项目名称:waffles-code,代码行数:6,代码来源:Gui.cpp


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