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


C++ Graphics::FillEllipse方法代码示例

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


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

示例1: DrawGame

void DrawGame(Gdiplus::Graphics &graphics, Game &currentGame)
{
	// Draw background.
	graphics.FillRectangle(MY_WHITE_BRUSH, 0, 0, MAIN_WINDOW_WIDTH, MAIN_WINDOW_HEIGHT);
	
	// Draw end.
	const MazeState &currentMazeState = currentGame.CurrentState();
	
	graphics.FillRectangle(
		WEAK_BLACK_BRUSH,
		static_cast<INT>(currentMazeState.end[0] * MAZE_GRID_CELL_SIZE + 2),
		static_cast<INT>(currentMazeState.end[1] * MAZE_GRID_CELL_SIZE + 2),
		static_cast<INT>(MAZE_GRID_CELL_SIZE - 5),
		static_cast<INT>(MAZE_GRID_CELL_SIZE - 5));
	
	// Draw player.
	graphics.FillEllipse(
		MY_RED_BRUSH,
		static_cast<INT>(currentMazeState.currentPosition[0] * MAZE_GRID_CELL_SIZE + 2),
		static_cast<INT>(currentMazeState.currentPosition[1] * MAZE_GRID_CELL_SIZE + 2),
		static_cast<INT>(MAZE_GRID_CELL_SIZE - 4),
		static_cast<INT>(MAZE_GRID_CELL_SIZE - 4));
	
	// Draw maze jumps.
	int numJumps = currentMazeState.jumps.size();
	for (int i = 0; i < numJumps; ++i) {
		graphics.FillEllipse(
			MY_BLUE_BRUSH,
			static_cast<INT>(currentMazeState.jumps[i].array[0] * MAZE_GRID_CELL_SIZE + 3),
			static_cast<INT>(currentMazeState.jumps[i].array[1] * MAZE_GRID_CELL_SIZE + 3),
			static_cast<INT>(MAZE_GRID_CELL_SIZE - 5),
			static_cast<INT>(MAZE_GRID_CELL_SIZE - 5));
	}
	
	// Draw maze.
	graphics.DrawRectangle(
		MY_BLACK_PEN,
		0, 0,
		MAZE_GRID_CELL_SIZE * MAZE_GRID_WIDTH, MAZE_GRID_CELL_SIZE * MAZE_GRID_HEIGHT);
	
	for (int j = 0; j < MAZE_GRID_HEIGHT; ++j) {
		for (int i = 0; i < MAZE_GRID_WIDTH; ++i) {
			if (currentMazeState.cellFlags[j][i] & CELL_WALL_UP) {
				graphics.DrawLine(
					MY_BLACK_PEN,
					static_cast<INT>(MAZE_GRID_CELL_SIZE * i), static_cast<INT>(MAZE_GRID_CELL_SIZE * j),
					static_cast<INT>(MAZE_GRID_CELL_SIZE * (i+1)), static_cast<INT>(MAZE_GRID_CELL_SIZE * j));
			}
			if (currentMazeState.cellFlags[j][i] & CELL_WALL_LEFT) {
				graphics.DrawLine(
					MY_BLACK_PEN,
					static_cast<INT>(MAZE_GRID_CELL_SIZE * i), static_cast<INT>(MAZE_GRID_CELL_SIZE * j),
					static_cast<INT>(MAZE_GRID_CELL_SIZE * i), static_cast<INT>(MAZE_GRID_CELL_SIZE * (j+1)));
			}
		}
	}
}
开发者ID:Veltas,项目名称:recursive-maze-game,代码行数:57,代码来源:draw_game.cpp

示例2: fill_ellipse

		void fill_ellipse(ft x, ft y, ft w, ft h)
		{
			Gdiplus::SolidBrush* brush = new Gdiplus::SolidBrush(*color);
			graphics->FillEllipse(brush, Gdiplus::Rect((st)x, (st)y, (st)w, (st)h));
			delete brush;
		}
开发者ID:ChinaCCF,项目名称:Fortunes,代码行数:6,代码来源:Render.cpp

示例3: PluginUpdateOverlay

//
//	Draw overlay 
//
PLUGIN_EXPORT void PluginUpdateOverlay()
{
	if (!pRenderHelper)
		return;

	//SAFE_DELETE(pFPSNormalBrush);
	//pFPSNormalBrush = new Gdiplus::SolidBrush(Gdiplus::Color(255, 255, 255, 255));
	if (bFirstAttach) {
		bFirstAttach = false;
		PC_StartRecording();
		PC_DebugPrint(L"Triggered");
	}
	else {
		PC_DebugPrint(L"Not Triggered");
	}
	// lock overlay image
	auto pLock = pRenderHelper->BeginFrame();
	if (!pLock)
		return;

	int w = pLock->dwWidth;
	int h = pLock->dwHeight;

	Gdiplus::Graphics *pGraphics = pRenderHelper->GetGraphics();

	//-----------------------------------------
	// draw FPS counter

	// set options
	//pGraphics->SetTextRenderingHint(Gdiplus::TextRenderingHintAntiAlias);

	// clear back
	pGraphics->Clear(Gdiplus::Color(0, 0, 0, 0));




	// draw fps
	{
		Gdiplus::RectF bound;
		//bound.
		int circleSize = 0;
		if (w < h) {
			circleSize = w;
		}
		else {
			circleSize = h;
		}
		if (PC_IsRecording()) {
			pGraphics->FillEllipse(pFPSRecordBrush, 0, 0, circleSize, circleSize);
		}
		else if (bShowWhenNotRecording) {
			pGraphics->FillEllipse(pFPSNormalBrush, 0, 0, circleSize, circleSize);
		}
	}


	//	graphics.Flush(FlushIntentionSync);

	// fill overlay image
	pRenderHelper->EndFrame();
}
开发者ID:regener,项目名称:Recording-Indicator,代码行数:65,代码来源:overlayRecordingIndicator.cpp

示例4: FillEllipse

void Graphics::FillEllipse(Brush* brush, const Rect& rc) {
    Gdiplus::Graphics* g = reinterpret_cast<Gdiplus::Graphics*>(_private);
    Gdiplus::Brush* gdiBrush = reinterpret_cast<Gdiplus::Brush*>(brush->_private);
    g->FillEllipse(gdiBrush, ToGDIRect<Rect, Gdiplus::Rect>(rc));
}
开发者ID:pixelspark,项目名称:corespark,代码行数:5,代码来源:tjgraphics-gdiplus.cpp


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