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


C++ wxGraphicsContext::CreatePath方法代码示例

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


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

示例1: Draw

void wxChartArc::Draw(wxGraphicsContext &gc)
{
	wxGraphicsPath path = gc.CreatePath();

	if (m_innerRadius > 0)
	{
		path.AddArc(m_x, m_y, m_innerRadius, m_startAngle, m_endAngle, true);
		path.AddArc(m_x, m_y, m_outerRadius, m_endAngle, m_startAngle, false);
	}
	else
	{
		path.AddArc(m_x, m_y, m_outerRadius, m_endAngle, m_startAngle, false);
		path.AddLineToPoint(m_x, m_y);
	}

	path.CloseSubpath();

	wxBrush brush(m_options.GetFillColor());
	gc.SetBrush(brush);
	gc.FillPath(path);

	wxPen pen(*wxWHITE, m_options.GetOutlineWidth());
	gc.SetPen(pen);
	gc.StrokePath(path);
}
开发者ID:yecaokinux,项目名称:wxCharts,代码行数:25,代码来源:wxchartarc.cpp

示例2: Draw

void wxChartBackground::Draw(wxDouble x, 
                             wxDouble y, 
                             wxDouble width, 
                             wxDouble height,
                             wxGraphicsContext &gc)
{
    wxGraphicsPath path = gc.CreatePath();

    path.AddRoundedRectangle(x, y, width, height, m_options.GetCornerRadius());

    wxBrush brush(m_options.GetColor());
    gc.SetBrush(brush);
    gc.FillPath(path);
}
开发者ID:yecaokinux,项目名称:wxCharts,代码行数:14,代码来源:wxchartbackground.cpp

示例3: DrawGraph

void GCDCGraphs::DrawGraph(wxGraphicsContext &dc, Draw* d) {
	static const int ellipse_size = 5;

	if (d->GetEnable() == false)
		return;

	DrawInfo *di = d->GetDrawInfo();

	bool double_cursor = d->GetSelected() && d->GetDoubleCursor();

	wxGraphicsPath path1 = dc.CreatePath();
	wxGraphicsPath path2 = dc.CreatePath();

	wxGraphicsPath *path = &path1;

	const wxColour &wc = di->GetDrawColor();
	dc.SetPen(wxPen(wc, double_cursor ? 4 : 2, wxSOLID));

	int pc = d->GetValuesTable().size();

	bool prev_data = false;
	bool switched_to_alternate = false;
	bool switched_back = false;

	int dcs = -1, dce = -1;
	if (double_cursor) {
		dcs = d->GetValuesTable().m_stats.Start() - d->GetValuesTable().m_view.Start();
		dce = d->GetValuesTable().m_stats.End() - d->GetValuesTable().m_view.Start();
	}

	std::vector<std::pair<double,double> > p1circles;
	std::vector<std::pair<double,double> > p2circles;
	std::vector<std::pair<double,double> >* pcircles = &p1circles;

	bool draw_circle =
		d->GetPeriod() != PERIOD_T_DAY
		&& d->GetPeriod() != PERIOD_T_30MINUTE
		&& d->GetPeriod() != PERIOD_T_5MINUTE
		&& d->GetPeriod() != PERIOD_T_MINUTE
		&& d->GetPeriod() != PERIOD_T_30SEC;

	for (int i = 0; i < pc; i++) {
		if (!d->GetValuesTable().at(i).IsData()) {
			prev_data = false;
			continue;
		}

		double x = GetX(i);
		double y = GetY(d->GetValuesTable().at(i).val, di);

		bool drawn = false;

		if (i >= dcs && i <= dce && !switched_to_alternate) {
			if (prev_data)
				path->AddLineToPoint(x, y);

			path = &path2;
			pcircles = &p2circles;

			if (draw_circle || (!prev_data && ((i + 1) < pc) && !d->GetValuesTable().at(i + 1).IsData())) 
				pcircles->push_back(std::make_pair(x, y));

			path->MoveToPoint(x, y);
			switched_to_alternate = true;
			drawn = true;
		}

		if (i >= dce && switched_to_alternate && !switched_back) {
			if (prev_data)
				path->AddLineToPoint(x, y);

			std::vector<std::pair<double, double> > *p;
			if (i == dce)
				p = &p2circles;
			else
				p = &p1circles;

			if (draw_circle || (!prev_data && ((i + 1) < pc) && !d->GetValuesTable().at(i + 1).IsData())) 
				p->push_back(std::make_pair(x, y));

			path = &path1;
			pcircles = &p1circles;
			path->MoveToPoint(x, y);

			switched_back = true;

			drawn = true;
		}

		if (!drawn) {
			if (prev_data)
				path->AddLineToPoint(x, y);
			else
				path->MoveToPoint(x, y);

			if (draw_circle || (!prev_data && ((i + 1) < pc) && !d->GetValuesTable().at(i + 1).IsData())) 
				pcircles->push_back(std::make_pair(x, y));
		}
		
		prev_data = true;
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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