Exemplo n.º 1
0
 std::string operator () (dash_array const& dash) const
 {
     std::ostringstream ss;
     for (std::size_t i = 0; i < dash.size(); ++i)
     {
         ss << dash[i].first << ", " << dash[i].second;
         if ( i + 1 < dash.size() ) ss << ',';
     }
     return ss.str();
 }
Exemplo n.º 2
0
void cairo_context::set_dash(dash_array const &dashes, double scale_factor)
{
    std::valarray<double> d(dashes.size() * 2);
    dash_array::const_iterator itr = dashes.begin();
    dash_array::const_iterator end = dashes.end();
    int index = 0;

    for (; itr != end; ++itr)
    {
        d[index++] = itr->first * scale_factor;
        d[index++] = itr->second * scale_factor;
    }

    cairo_set_dash(cairo_.get() , &d[0], dashes.size(), 0/*offset*/);
    check_object_status_and_throw_exception(*this);
}
Exemplo n.º 3
0
void cairo_context::set_dash(dash_array const& dashes, double scale_factor)
{
    std::vector<double> d;
    d.reserve(dashes.size() * 2);
    for (auto const& dash : dashes)
    {
        d.emplace_back(dash.first * scale_factor);
        d.emplace_back(dash.second * scale_factor);
    }
    cairo_set_dash(cairo_.get() , &d[0], static_cast<int>(d.size()), 0/*offset*/);
    check_object_status_and_throw_exception(*this);
}