本文整理汇总了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);
}
示例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);
}
示例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;
//.........这里部分代码省略.........