用gdi +和点向量绘制多边形

时间:2018-11-14 07:52:58

标签: c++ gdi+

我有一个PointF's的向量,我试图用GDI +绘制一个多边形:

void Polygons::create_polygons(CDC& dc, std::array<Gdiplus::Color, 6>& cols)
{
    Gdiplus::Graphics gr{ dc };
    find_poly_vertices();
    Gdiplus::Pen pen{ Gdiplus::Color(255,0,0,0) };
    auto old_brush = dc.GetCurrentBrush();
    for (int i = 0; i != points.size(); ++i)
    {

        Gdiplus::SolidBrush br{ cols[i] };
        gr.DrawPolygon(&pen, points[i], points[i].size());
        gr.FillPolygon(&br, points[i], points[i].size());
    }
    dc.SelectObject(old_brush);
}

find_poly_vertices()将多边形的点保存在Polygons中的向量数组中。

在Visual Studio中编译时,出现错误C2664:

cannot convert argument 2 from"std::vector<Gdiplus::PointF,std::allocator<_Ty>>" to "const Gdiplus::PointF *"

0 个答案:

没有答案