本文整理汇总了C++中cairo::RefPtr::get_line_width方法的典型用法代码示例。如果您正苦于以下问题:C++ RefPtr::get_line_width方法的具体用法?C++ RefPtr::get_line_width怎么用?C++ RefPtr::get_line_width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cairo::RefPtr
的用法示例。
在下文中一共展示了RefPtr::get_line_width方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawLine
void ICLayerLineString::drawLine(Cairo::RefPtr<Cairo::Context> cr,
OGRGeometry* ObjectGeo, double scale, bool select)
{
OGRLineString* Line = static_cast<OGRLineString*> (ObjectGeo);
cr->move_to(Line->getX(0), Line->getY(0));
double lw = cr->get_line_width();
for (int i = 1; i < Line->getNumPoints(); i++)
{
cr->line_to(Line->getX(i), Line->getY(i));
}
cr->save();
if (select)
{
cr->set_line_width(lw + (4 / scale));
}
cr->stroke();
cr->restore();
}
示例2: draw_window
void cairo::draw_window( const Cairo::RefPtr<Cairo::Context>& cr, const Window& window, const rgba_color_ref_t& color )
{
const ps_t ps = window.pseudosource();
cairo_coord_t B0( window.bound<LEFT>(), 0 );
cairo_coord_t B1( window.bound<RIGHT>(), 0 );
cairo_coord_t PS( ps[0], ps[1] );
cr->save();
cr->set_source_rgba( color[0], color[1], color[2], color[3] );
cr->move_to( B0[0], B0[1] + cr->get_line_width() );
cr->line_to( B1[0], B1[1] + cr->get_line_width() );
cr->stroke();
std::vector<double> dashes(2);
dashes[0] = 2. * user_unit_distance( cr ).length();
dashes[1] = 10. * user_unit_distance( cr ).length();
cr->set_dash( dashes, 0. );
cr->set_source_rgba( color[0], color[1], color[2], color[3]*.5 );
cr->move_to( B1[0], B1[1] );
cr->line_to( PS[0], PS[1] );
cr->line_to( B0[0], B0[1] );
cr->stroke();
cr->restore();
cr->save();
cr->set_font_size( 8. * user_unit_distance( cr ).length() );
cr->set_source_rgba( color[0], color[1], color[2], 1. );
std::ostringstream nrss;
nrss << window.id;
cairo_coord_t pos = (B0+B1)*.5;
pos[1] += 5.*user_unit_distance( cr ).length();
cr->translate( pos[0], pos[1] );
cr->scale( 1., -1. );
draw_centered_text( cr, nrss.str() );
cr->restore();
#if defined DBG_FLAT_MMP_VISUALIZER_DRAW_WINDOW
std::clog << "mmp::visualizer::draw_window\t|"
<< window
<< std::endl
<< "\t\t\t\t\t|"
<< " color " << color
<< " bounds " << bb
<< std::endl;
#endif
}