当前位置: 首页>>代码示例>>C++>>正文


C++ RefPtr::set_matrix方法代码示例

本文整理汇总了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;
}
开发者ID:bgK,项目名称:vba-ttb,代码行数:27,代码来源:ScreenAreaCairo.cpp

示例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
}
开发者ID:timn,项目名称:ros-skillgui,代码行数:39,代码来源:gvplugin_skillgui_cairo.cpp

示例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
}
开发者ID:timn,项目名称:ros-skillgui,代码行数:90,代码来源:gvplugin_skillgui_cairo.cpp


注:本文中的cairo::RefPtr::set_matrix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。