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


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

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


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

示例1: DrawCar

	void DrawCar()
	{
		double angle = atan(3 * (2 * m_carPos - 3 * m_carPos * m_carPos));
		m_pRotatedCar->rotate(m_pCar, 35, 41, angle);
		double y = m_carPos * m_carPos - m_carPos * m_carPos * m_carPos;
		int i = (int)((m_carPos + 0.4) * m_pImage->width() / 1.4);
		int j = (int)(m_pImage->height() - y * 3 * m_pImage->height() - 50);
		GRect r(0, 0, 70, 60);
		m_pImage->blitAlpha(i - 35, j - 40, m_pRotatedCar, &r);
	}
开发者ID:litaoshao,项目名称:waffles,代码行数:10,代码来源:CarOnHill.cpp

示例2: switch

void Image4uint8::copyGImage(const GImage& im) {
    switch (im.channels()) {
    case 1:
        copyArray(im.pixel1(), im.width(), im.height());
        break;

    case 3:
        copyArray(im.pixel3(), im.width(), im.height());
        break;

    case 4:
        copyArray(im.pixel4(), im.width(), im.height());
        break;
    } 
}
开发者ID:Sandshroud,项目名称:Sandshroud-Prodigy,代码行数:15,代码来源:Image4uint8.cpp

示例3: fromArray

Image4uint8::Ref Image4uint8::fromGImage(const GImage& im, WrapMode wrap) {
    switch (im.channels()) {
    case 1:
        return fromArray(im.pixel1(), im.width(), im.height(), wrap);

    case 3:
        return fromArray(im.pixel3(), im.width(), im.height(), wrap);

    case 4:
        return fromArray(im.pixel4(), im.width(), im.height(), wrap);

    default:
        debugAssertM(false, "Input GImage must have 1, 3, or 4 channels.");
        return NULL;
    }
}
开发者ID:Sandshroud,项目名称:Sandshroud-Prodigy,代码行数:16,代码来源:Image4uint8.cpp

示例4: GWidgetDialog

	HelloDialog(HelloController* pController, int w, int h)
	: GWidgetDialog(w, h, 0xff90d0f0) // a=ff, r=90, g=d0, b=f0
	{
		m_pController = pController;
		m_pImage = new GImage();
		m_pImage->setSize(800, 600);
		m_pCanvas = new GWidgetCanvas(this, 10, 30, m_pImage->width(), m_pImage->height(), m_pImage);
		m_pQuitButton = new GWidgetTextButton(this, 850, 300, 80, 24, "Quit");
	}
开发者ID:darthsuogles,项目名称:GestureUI,代码行数:9,代码来源:main.cpp

示例5: ViewBase

	PopupView(GWidgetDialog* pDialog)
	: ViewBase()
	{
		m_nLeft = 0;
		m_nTop = 0;
		m_pBackgroundImage = new GImage();
		captureScreen(m_pBackgroundImage);
		m_pBackgroundImage->contrastAndBrightness(.5, -64);
		m_pDialog = pDialog;
		m_x = (m_pBackgroundImage->width() - m_pDialog->rect()->w) / 2;
		m_y = (m_pBackgroundImage->height() - m_pDialog->rect()->h) / 2;
	}
开发者ID:winghc,项目名称:waffles-code,代码行数:12,代码来源:Gui.cpp

示例6: Redraw

	void Redraw(bool forw)
	{
		m_pImage->clear(0xff80c0e0);

		// Draw the hill
		{
			int i, j;
			double x, y;
			for(i = 0; i < (int)m_pImage->width(); i++)
			{
				x = (double)i * 1.4 / m_pImage->width() - 0.4;
				y = x * x - x * x * x;
				j = (int)(m_pImage->height() - y * 3 * m_pImage->height() - 50);
				m_pImage->lineNoChecks(i, j, i, m_pImage->height() - 1, 0xff40a060);
			}
		}

		// Draw the car
		DrawCar();

		// Draw the acceleration arrow
		m_pImage->arrow(240, 20, 240 + (forw ? 15 : -15), 20, 0xff000000, 10);
	}
开发者ID:litaoshao,项目名称:waffles,代码行数:23,代码来源:CarOnHill.cpp

示例7: GWidgetTextLabel

	CarOnHillDialog(CarOnHillController* pController, int w, int h)
	: GWidgetDialog(w, h, 0xff90d0f0)
	{
		m_pController = pController;

		m_pBullets = new GWidgetBulletGroup(this, 820, 102, 14, 14, 2, 30, true);
		new GWidgetTextLabel(this, 840, 100, 100, 24, "Mouse", 0xff306000);
		new GWidgetTextLabel(this, 840, 130, 100, 24, "Q-Learner", 0xff306000);
		m_pBullets->setSelection(1);

		m_pWins = new GWidgetTextLabel(this, 820, 300, 100, 24, "Wins: 0", 0xff306000, 0xff90d0f0);

		m_pUpdateDisplay = new GWidgetCheckBox(this, 820, 402, 18, 18);
		m_pUpdateDisplay->setChecked(true);
		new GWidgetTextLabel(this, 840, 400, 100, 24, "Slow", 0xff306000);

		m_pImage = new GImage();
		m_pImage->setSize(800, 600);

		m_pCanvas = new GWidgetCanvas(this, 10, 30, m_pImage->width(), m_pImage->height(), m_pImage);
		m_prng = new GRand(0);
		m_pModel = new CarOnHillModel(m_prng, m_pImage, m_pWins);
		m_bPrevUpdate = true;
	}
开发者ID:litaoshao,项目名称:waffles,代码行数:24,代码来源:CarOnHill.cpp

示例8: regionMask

void G2DRegionGraph::makeCoarserRegions(G2DRegionGraph* pFineRegions)
{
	// Find every region's closest neighbor
	GImage* pFineRegionMask = pFineRegions->regionMask();
	GImage* pCoarseRegionMask = regionMask();
	GAssert(pCoarseRegionMask->width() == pFineRegionMask->width() && pCoarseRegionMask->height() == pFineRegionMask->height()); // size mismatch
	int* pBestNeighborMap = new int[pFineRegions->regionCount()];
	ArrayHolder<int> hBestNeighborMap(pBestNeighborMap);
	for(size_t i = 0; i < pFineRegions->regionCount(); i++)
	{
		struct GRegion* pRegion = pFineRegions->m_regions[i];
		struct GRegionEdge* pEdge;
		double d;
		double dBestDiff = 1e200;
		int nBestNeighbor = -1;
		for(pEdge = pRegion->m_pNeighbors; pEdge; pEdge = pEdge->GetNext(i))
		{
			size_t j = pEdge->GetOther(i);
			struct GRegion* pOtherRegion = pFineRegions->m_regions[j];
			d = MeasureRegionDifference(pRegion, pOtherRegion);
			if(d < dBestDiff)
			{
				dBestDiff = d;
				nBestNeighbor = (int)j;
			}
		}
		GAssert(nBestNeighbor != -1 || pFineRegions->regionCount() == 1); // failed to find a neighbor
		pBestNeighborMap[i] = nBestNeighbor;
	}

	// Create a mapping to new regions numbers
	int* pNewRegionMap = new int[pFineRegions->regionCount()];
	ArrayHolder<int> hNewRegionMap(pNewRegionMap);
	memset(pNewRegionMap, 0xff, sizeof(int) * pFineRegions->regionCount());
	int nNewRegionCount = 0;
	for(size_t i = 0; i < pFineRegions->regionCount(); i++)
	{
		size_t nNewRegion = -1;
		size_t j = i;
		while(pNewRegionMap[j] == -1)
		{
			pNewRegionMap[j] = -2;
			j = pBestNeighborMap[j];
		}
		if(pNewRegionMap[j] == -2)
			nNewRegion = nNewRegionCount++;
		else
			nNewRegion = pNewRegionMap[j];
		j = i;
		while(pNewRegionMap[j] == -2)
		{
			pNewRegionMap[j] = (int)nNewRegion;
			j = pBestNeighborMap[j];
		}
	}

	// Make the new regions
	for(size_t i = 0; i < pFineRegions->regionCount(); i++)
	{
		struct GRegion* pRegion = pFineRegions->m_regions[i];
		size_t j = pNewRegionMap[i];
		if(regionCount() <= j)
		{
			GAssert(regionCount() == j); // how'd it get two behind?
			addRegion();
		}
		struct GRegion* pCoarseRegion = m_regions[j];
		pCoarseRegion->m_nSumRed += pRegion->m_nSumRed;
		pCoarseRegion->m_nSumGreen += pRegion->m_nSumGreen;
		pCoarseRegion->m_nSumBlue += pRegion->m_nSumBlue;
		pCoarseRegion->m_nPixels += pRegion->m_nPixels;
	}
	for(size_t i = 0; i < pFineRegions->regionCount(); i++)
	{
		struct GRegion* pRegion = pFineRegions->m_regions[i];
		size_t j = pNewRegionMap[i];
		struct GRegionEdge* pEdge;
		for(pEdge = pRegion->m_pNeighbors; pEdge; pEdge = pEdge->GetNext(i))
		{
			size_t k = pNewRegionMap[pEdge->GetOther(i)];
			if(j != k)
				makeNeighbors(j, k);
		}
	}

	// Make the fine region mask
	unsigned int nOldRegion;
	int x, y;
	for(y = 0; y < (int)pFineRegionMask->height(); y++)
	{
		for(x = 0; x < (int)pFineRegionMask->width(); x++)
		{
			nOldRegion = pFineRegionMask->pixel(x, y);
			pCoarseRegionMask->setPixel(x, y, pNewRegionMap[nOldRegion]);
		}
	}
}
开发者ID:har777,项目名称:tapkee_benchmarks,代码行数:97,代码来源:GRegion.cpp


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