本文整理汇总了C++中cairo::RefPtr::set_matrix方法的典型用法代码示例。如果您正苦于以下问题:C++ RefPtr::set_matrix方法的具体用法?C++ RefPtr::set_matrix怎么用?C++ RefPtr::set_matrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cairo::RefPtr
的用法示例。
在下文中一共展示了RefPtr::set_matrix方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_draw
bool ScreenAreaCairo::on_draw(const Cairo::RefPtr<Cairo::Context> &poContext)
{
DrawingArea::on_draw(poContext);
Cairo::RefPtr< Cairo::ImageSurface > poImage;
Cairo::RefPtr< Cairo::SurfacePattern > poPattern;
Cairo::Matrix oMatrix;
const int iScaledPitch = m_iWidth * sizeof(u32);
poContext->set_identity_matrix();
poContext->scale(m_dScaleFactor, m_dScaleFactor);
poImage = Cairo::ImageSurface::create((u8 *)m_puiPixels, Cairo::FORMAT_RGB24,
m_iWidth, m_iHeight, iScaledPitch);
cairo_matrix_init_translate(&oMatrix, -m_iAreaLeft, -m_iAreaTop);
poPattern = Cairo::SurfacePattern::create(poImage);
poPattern->set_filter(Cairo::FILTER_NEAREST);
poPattern->set_matrix (oMatrix);
poContext->set_source_rgb(0.0, 0.0, 0.0);
poContext->paint();
poContext->set_source(poPattern);
poContext->paint();
return true;
}
示例2:
static void
skillgui_cairo_render_ellipse(GVJ_t *job, pointf *A, int filled)
{
#ifdef USE_GVPLUGIN_TIMETRACKER
__tt.ping_start(__ttc_ellipse);
++__num_ellipse;
#endif
//printf("Render ellipse\n");
SkillGuiCairoRenderInstructor *cri = (SkillGuiCairoRenderInstructor *)job->context;
Cairo::RefPtr<Cairo::Context> cairo = cri->get_cairo();
obj_state_t *obj = job->obj;
Cairo::Matrix old_matrix;
cairo->get_matrix(old_matrix);
skillgui_cairo_set_penstyle(cairo, job);
cairo->translate(A[0].x, -A[0].y);
double rx = A[1].x - A[0].x;
double ry = A[1].y - A[0].y;
cairo->scale(1, ry / rx);
cairo->move_to(rx, 0);
cairo->arc(0, 0, rx, 0, 2 * M_PI);
cairo->close_path();
cairo->set_matrix(old_matrix);
if (filled) {
skillgui_cairo_set_color(cairo, &(obj->fillcolor));
cairo->fill_preserve();
}
skillgui_cairo_set_color(cairo, &(obj->pencolor));
cairo->stroke();
#ifdef USE_GVPLUGIN_TIMETRACKER
__tt.ping_end(__ttc_ellipse);
#endif
}
示例3: agget
static void
skillgui_cairo_render_textpara(GVJ_t *job, pointf p, textpara_t *para)
{
#ifdef USE_GVPLUGIN_TIMETRACKER
__tt.ping_start(__ttc_text);
++__num_text;
#endif
SkillGuiCairoRenderInstructor *cri = (SkillGuiCairoRenderInstructor *)job->context;
Cairo::RefPtr<Cairo::Context> cairo = cri->get_cairo();
obj_state_t *obj = job->obj;
Cairo::FontWeight weight = Cairo::FONT_WEIGHT_NORMAL;
Cairo::FontSlant slant = Cairo::FONT_SLANT_NORMAL;
char *fontweight = NULL;
char *fontslant = NULL;
if (obj->type == CLUSTER_OBJTYPE) {
fontweight = agget(obj->u.sg, (char *)"fontweight");
fontslant = agget(obj->u.sg, (char *)"fontslant");
} else if (obj->type == ROOTGRAPH_OBJTYPE) {
fontweight = agget(obj->u.g, (char *)"fontweight");
fontslant = agget(obj->u.g, (char *)"fontslant");
} else if (obj->type == NODE_OBJTYPE) {
fontweight = agget(obj->u.n, (char *)"fontweight");
fontslant = agget(obj->u.n, (char *)"fontslant");
} else if (obj->type == EDGE_OBJTYPE) {
fontweight = agget(obj->u.e, (char *)"fontweight");
fontslant = agget(obj->u.e, (char *)"fontslant");
}
if (fontweight && (strcmp(fontweight, "bold") == 0)) {
weight = Cairo::FONT_WEIGHT_BOLD;
p.x -= 8;
}
if (fontslant && (strcmp(fontslant, "italic") == 0)) {
slant = Cairo::FONT_SLANT_ITALIC;
}
double offsetx = 0.0;
double offsety = 0.0;
double rotate = 0.0;
if ( (obj->type == EDGE_OBJTYPE) && (strcmp(para->str, obj->headlabel) == 0) ) {
char *labelrotate = agget(obj->u.e, (char *)"labelrotate");
if (labelrotate && (strlen(labelrotate) > 0)) {
rotate = fawkes::deg2rad(atof(labelrotate));
}
char *labeloffsetx = agget(obj->u.e, (char *)"labeloffsetx");
if (labeloffsetx && (strlen(labeloffsetx) > 0)) {
offsetx = atof(labeloffsetx);
}
char *labeloffsety = agget(obj->u.e, (char *)"labeloffsety");
if (labeloffsety && (strlen(labeloffsety) > 0)) {
offsety = atof(labeloffsety);
}
}
//__tt.ping_start(__ttc_text_1);
Cairo::Matrix old_matrix;
cairo->get_matrix(old_matrix);
if (__fontname) {
cairo->select_font_face(__fontname, slant, weight);
} else {
cairo->select_font_face(para->fontname, slant, weight);
}
cairo->set_font_size(para->fontsize);
//cairo->set_font_options ( Cairo::FontOptions() );
//cairo->set_line_width(1.0);
Cairo::TextExtents extents;
cairo->get_text_extents(para->str, extents);
if (para->just == 'r') {
p.x -= extents.width;
} else if (para->just != 'l') {
p.x -= extents.width / 2.0;
}
cairo->move_to(p.x + offsetx, -p.y + offsety);
cairo->rotate(rotate);
skillgui_cairo_set_color(cairo, &(obj->pencolor));
cairo->text_path( para->str );
cairo->fill();
cairo->set_matrix(old_matrix);
//__tt.ping_end(__ttc_text_5);
#ifdef USE_GVPLUGIN_TIMETRACKER
__tt.ping_end(__ttc_text);
#endif
}