• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ cairo_identity_matrix函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cairo_identity_matrix函数的典型用法代码示例。如果您正苦于以下问题:C++ cairo_identity_matrix函数的具体用法?C++ cairo_identity_matrix怎么用?C++ cairo_identity_matrix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了cairo_identity_matrix函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: cairo_create

void BenchCairo::runFillRectRotate(BenchOutput& output, const BenchParams& params)
{
  cairo_t* cr = cairo_create(screenCairo);
  configureContext(cr, params);

  BenchRandom rRect(app);
  BenchRandom rArgb(app);

  float cx = (float)params.screenSize.w * 0.5f;
  float cy = (float)params.screenSize.h * 0.5f;
  float angle = 0.0f;

  if (params.source == BENCH_SOURCE_SOLID)
  {
    uint32_t i, quantity = params.quantity;
    for (i = 0; i < quantity; i++, angle += 0.01f)
    {
      Fog::RectF r(rRect.getRectF(params.screenSize, params.shapeSize, params.shapeSize));
      Fog::Argb32 c0(rArgb.getArgb32());

      cairo_translate(cr, cx, cy);
      cairo_rotate(cr, angle);
      cairo_translate(cr, -cx, -cy);

      cairo_set_source_rgba(cr, double(c0.r) * sc, double(c0.g) * sc, double(c0.b) * sc, double(c0.a) * sc);
      cairo_rectangle(cr, r.x, r.y, r.w, r.h);
      cairo_fill(cr);

      cairo_identity_matrix(cr);
    }
  }
  else
  {
    uint32_t i, quantity = params.quantity;
    for (i = 0; i < quantity; i++, angle += 0.01f)
    {
      Fog::RectF r(rRect.getRectF(params.screenSize, params.shapeSize, params.shapeSize));
      Fog::Argb32 c0(rArgb.getArgb32());
      Fog::Argb32 c1(rArgb.getArgb32());
      Fog::Argb32 c2(rArgb.getArgb32());

      cairo_translate(cr, cx, cy);
      cairo_rotate(cr, angle);
      cairo_translate(cr, -cx, -cy);

      cairo_pattern_t* pattern = createLinearGradient(r.x, r.y, r.x + r.w, r.y + r.h, c0, c1, c2);
      cairo_set_source(cr, pattern);

      cairo_rectangle(cr, r.x, r.y, r.w, r.h);
      cairo_fill(cr);

      cairo_identity_matrix(cr);
      cairo_pattern_destroy(pattern);
    }
  }

  cairo_destroy(cr);
}
开发者ID:Lewerow,项目名称:DetailIdentifier,代码行数:58,代码来源:BenchCairo.cpp


示例2: dtgtk_cairo_paint_triangle

void dtgtk_cairo_paint_triangle(cairo_t *cr, gint x,int y,gint w,gint h, gint flags)
{
  /* initialize rotation and flip matrices */
  cairo_matrix_t hflip_matrix;
  cairo_matrix_init(&hflip_matrix,-1,0,0,1,1,0);

  double C=cos(-(M_PI/2.0)),S=sin(-(M_PI/2.0));  // -90 degrees
  C=flags&CPF_DIRECTION_DOWN?cos(-(M_PI*1.5)):C;
  S=flags&CPF_DIRECTION_DOWN?sin(-(M_PI*1.5)):S;
  cairo_matrix_t rotation_matrix;
  cairo_matrix_init(&rotation_matrix,C,S,-S,C,0.5-C*0.5+S*0.5,0.5-S*0.5-C*0.5);

  /* scale and transform*/
  gint s=w<h?w:h;
  cairo_translate(cr, x+(w/2.0)-(s/2.0), y+(h/2.0)-(s/2.0));
  cairo_scale(cr,s,s);
  cairo_set_line_width(cr,0.1);
  cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND);

  if( flags&CPF_DIRECTION_UP || flags &CPF_DIRECTION_DOWN)
    cairo_transform(cr,&rotation_matrix);
  else if(flags&CPF_DIRECTION_LEFT)	// Flip x transformation
    cairo_transform(cr,&hflip_matrix);


  cairo_move_to(cr, 0.2, 0.2);
  cairo_line_to(cr, 0.7, 0.5);
  cairo_line_to(cr, 0.2, 0.8);
  cairo_line_to(cr, 0.2, 0.2);
  cairo_stroke(cr);
  cairo_identity_matrix(cr);
}
开发者ID:ksyz,项目名称:darktable,代码行数:32,代码来源:paint.c


示例3: dtgtk_cairo_paint_empty

void dtgtk_cairo_paint_empty(cairo_t *cr, gint x, gint y, gint w, gint h, gint flags)
{
  cairo_translate(cr, x, y);
  cairo_scale(cr, w, h);
  cairo_stroke(cr);
  cairo_identity_matrix(cr);
}
开发者ID:andyTsing,项目名称:darktable,代码行数:7,代码来源:paint.c


示例4: dtgtk_cairo_paint_masks_eye

void dtgtk_cairo_paint_masks_eye(cairo_t *cr, gint x, gint y, gint w, gint h, gint flags)
{
  gint s = w < h ? w : h;
  cairo_translate(cr, x + (w / 2.0) - (s / 2.0), y + (h / 2.0) - (s / 2.0));
  cairo_scale(cr, s, s);
  cairo_set_line_width(cr, 0.15);
  cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);

  if((flags & CPF_ACTIVE))
    cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 1.0);
  else
    cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 0.5);

  double dashed[] = { 0.2, 0.2 };
  int len = sizeof(dashed) / sizeof(dashed[0]);
  cairo_set_dash(cr, dashed, len, 0);

  cairo_arc(cr, 0.75, 0.75, 0.75, 2.8, 4.7124);
  cairo_set_line_width(cr, 0.1);
  cairo_stroke(cr);

  cairo_move_to(cr, 0.4, 0.1);
  cairo_line_to(cr, 0.3, 0.8);
  cairo_line_to(cr, 0.55, 0.716667);
  cairo_line_to(cr, 0.65, 1.016667);
  cairo_line_to(cr, 0.75, 0.983333);
  cairo_line_to(cr, 0.65, 0.683333);
  cairo_line_to(cr, 0.9, 0.6);
  cairo_line_to(cr, 0.4, 0.1);
  cairo_fill(cr);

  cairo_identity_matrix(cr);
}
开发者ID:andyTsing,项目名称:darktable,代码行数:33,代码来源:paint.c


示例5: dtgtk_cairo_paint_store

void dtgtk_cairo_paint_store(cairo_t *cr,gint x,gint y,gint w,gint h,gint flags)
{
  gint s=w<h?w:h;
  cairo_translate(cr, x+(w/2.0)-(s/2.0), y+(h/2.0)-(s/2.0));
  cairo_scale(cr,s,s);
  cairo_set_line_width(cr,0.15);
  cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND);
  cairo_move_to(cr,0.275,0.1);
  cairo_line_to(cr,0.1,0.1);
  cairo_line_to(cr,0.1,0.9);
  cairo_line_to(cr,0.9,0.9);
  cairo_line_to(cr,0.9,0.175);
  cairo_line_to(cr,0.825,0.1);
  cairo_line_to(cr,0.825,0.5);
  cairo_line_to(cr,0.275,0.5);
  cairo_line_to(cr,0.275,0.1);

  cairo_stroke(cr);
  cairo_set_line_width(cr,0);
  cairo_rectangle(cr,0.5,0.025,0.17,0.275);
  cairo_fill(cr);

  cairo_stroke(cr);
  cairo_identity_matrix(cr);
}
开发者ID:ksyz,项目名称:darktable,代码行数:25,代码来源:paint.c


示例6: dtgtk_cairo_paint_flip

void dtgtk_cairo_paint_flip(cairo_t *cr,gint x,gint y,gint w,gint h,gint flags)
{
  double C=cos(-1.570796327),S=sin(-1.570796327);
  cairo_matrix_t rotation_matrix;
  cairo_matrix_init(&rotation_matrix,C,S,-S,C,0.5-C*0.5+S*0.5,0.5-S*0.5-C*0.5);
  gint s=w<h?w:h;
  cairo_translate(cr, x+(w/2.0)-(s/2.0), y+(h/2.0)-(s/2.0));
  cairo_scale(cr,s,s);

  cairo_set_line_width(cr,0.15);
  cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND);
  if( (flags&CPF_DIRECTION_UP) ) // Rotate -90 degrees
    cairo_transform(cr,&rotation_matrix);

  cairo_move_to(cr,0.05,0.50);
  cairo_line_to(cr,0.05,0);
  cairo_line_to(cr,0.95,0.50);
  cairo_line_to(cr,0.2,0.50);
  cairo_stroke(cr);
  cairo_set_line_width(cr,0.04);
  cairo_move_to(cr,0.05,0.62);
  cairo_line_to(cr,0.05,1.0);
  cairo_line_to(cr,0.95,0.62);
  cairo_stroke(cr);
  cairo_identity_matrix(cr);
}
开发者ID:ksyz,项目名称:darktable,代码行数:26,代码来源:paint.c


示例7: dtgtk_cairo_paint_switch

void dtgtk_cairo_paint_switch(cairo_t *cr,gint x,gint y,gint w,gint h,gint flags)
{
  gint s=w<h?w:h;
  cairo_translate(cr, x+(w/2.0)-(s/2.0), y+(h/2.0)-(s/2.0));
  cairo_scale(cr,s,s);

  if( !(flags&CPF_ACTIVE) )
    cairo_set_source_rgba(cr, 1,1,1,0.2);

  cairo_set_line_width(cr,0.125);
  cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND);
  cairo_arc (cr, 0.5, 0.5, 0.45, (-50*3.145/180),(230*3.145/180));
  cairo_move_to(cr,0.5,0.05);
  cairo_line_to(cr,0.5,0.45);
  cairo_stroke(cr);

  if( (flags&CPF_ACTIVE) ) // If active add some green diffuse light
  {
    cairo_set_source_rgba(cr, 1,1,1,0.2);
    cairo_set_line_width(cr,0.25);
    cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND);
    cairo_arc (cr, 0.5, 0.5, 0.45, (-50*3.145/180),(230*3.145/180));
    cairo_move_to(cr,0.5,0.1);
    cairo_line_to(cr,0.5,0.5);
    cairo_stroke(cr);
  }

  cairo_identity_matrix(cr);
}
开发者ID:ksyz,项目名称:darktable,代码行数:29,代码来源:paint.c


示例8: dtgtk_cairo_paint_plusminus

void dtgtk_cairo_paint_plusminus(cairo_t *cr,gint x,gint y,gint w,gint h,gint flags)
{
  gint s=w<h?w:h;
  cairo_translate(cr, x+(w/2.0)-(s/2.0), y+(h/2.0)-(s/2.0));
  cairo_scale(cr,s,s);

  cairo_set_source_rgba(cr, 0.6,0.6,0.6,1.0);

  cairo_set_line_width(cr,0.125);
  cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND);
  cairo_arc (cr, 0.5, 0.5, 0.45, 0, 2*M_PI);
  cairo_stroke(cr);

  if( (flags&CPF_ACTIVE) )
  {
    cairo_move_to(cr,0.5,0.2);
    cairo_line_to(cr,0.5,0.8);
    cairo_move_to(cr,0.2,0.5);
    cairo_line_to(cr,0.8,0.5);
    cairo_stroke(cr);
  }
  else
  {
    cairo_arc (cr, 0.5, 0.5, 0.45, 0, 2*M_PI);
    cairo_fill(cr);
    cairo_set_source_rgba(cr, 0.1,0.1,0.1,1.0);
    cairo_move_to(cr,0.2,0.5);
    cairo_line_to(cr,0.8,0.5);
    cairo_stroke(cr);
  }

  cairo_identity_matrix(cr);
}
开发者ID:ksyz,项目名称:darktable,代码行数:33,代码来源:paint.c


示例9: cr_identity_matrix

static VALUE
cr_identity_matrix (VALUE self)
{
  cairo_identity_matrix (_SELF);
  cr_check_status (_SELF);
  return self;
}
开发者ID:exvayn,项目名称:cairo-1.8.1-i386,代码行数:7,代码来源:rb_cairo_context.c


示例10: dtgtk_cairo_paint_eye_toggle

void dtgtk_cairo_paint_eye_toggle(cairo_t *cr, gint x, gint y, gint w, gint h, gint flags)
{
  gint s = w < h ? w : h;
  cairo_translate(cr, x + (w / 2.0) - (s / 2.0), y + (h / 2.0) - (s / 2.0));
  cairo_scale(cr, s, s);
  cairo_set_line_width(cr, 0.15);
  cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);

  cairo_arc(cr, 0.5, 0.5, 0.1, 0, 6.2832);
  cairo_stroke(cr);

  cairo_translate(cr, 0, 0.20);
  cairo_save(cr);
  cairo_scale(cr, 1.0, 0.60);
  cairo_arc(cr, 0.5, 0.5, 0.45, 0, 6.2832);
  cairo_restore(cr);
  cairo_stroke(cr);

  cairo_translate(cr, 0, -0.20);
  if((flags & CPF_ACTIVE))
  {
    cairo_set_source_rgba(cr, 0.6, 0.1, 0.1, 1.0);
    cairo_move_to(cr, 0.1, 0.9);
    cairo_line_to(cr, 0.9, 0.1);
    cairo_stroke(cr);
  }

  cairo_identity_matrix(cr);
}
开发者ID:andyTsing,项目名称:darktable,代码行数:29,代码来源:paint.c


示例11: cairo_image_surface_create

cairo_surface_t* TheStage::Render()
{
  this->currentFrame++;

  cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, this->width, this->height);
  cairo_t* cairo = cairo_create(surface);

  // Clear the surface
  // cairo_set_source_rgb(cairo, 1.0, 1.0, 1.0);
  //  cairo_paint(cairo);

  for(std::list<ISymbol*>::iterator it = this->symbols.begin(); it != this->symbols.end(); ++it) {
    ISymbol* symbol = *it;
    Camera* primaryCamera = this->GetPrimaryCamera();
    double rx;
    double ry;
    double rscale = primaryCamera->GetZoom();
    symbol->Sync(this->currentFrame);
    primaryCamera->Translate(symbol->x, symbol->y, rx, ry);
    cairo_surface_t* subsurface = symbol->Render(rscale);
    cairo_translate(cairo, rx, ry);
    cairo_rotate(cairo, symbol->angle);
    cairo_translate(cairo, -symbol->centerX * rscale, -symbol->centerY * rscale);
    cairo_set_source_surface(cairo, subsurface, 0, 0);
    cairo_paint(cairo);
    cairo_surface_destroy(subsurface);
    cairo_identity_matrix(cairo);
  }

  cairo_destroy(cairo);
  return surface;
}
开发者ID:tnzk,项目名称:onstage,代码行数:32,代码来源:thestage.cpp


示例12: do_composite_checker

static cairo_perf_ticks_t
do_composite_checker (cairo_t *cr,
                      int      width,
                      int      height)
{
    /* Compute zoom so that the src_pattern covers the whole output image. */
    double xscale = width / (double) SRC_SIZE;
    double yscale = height / (double) SRC_SIZE;

    cairo_perf_timer_start ();

    cairo_identity_matrix (cr);

    /* Fill the surface with our background. */
    cairo_set_source (cr, checkerboard);
    cairo_paint (cr);

    /* Draw the scaled image on top. */
    cairo_scale (cr, xscale, yscale);
    cairo_set_source (cr, src_pattern);
    cairo_paint (cr);

    cairo_perf_timer_stop ();
    return cairo_perf_timer_elapsed ();
}
开发者ID:AliYousuf,项目名称:cairo,代码行数:25,代码来源:composite-checker.c


示例13: cairo_identity_matrix

void VectorGraphics::pop_matrix() {
    if(matrix_stack_.empty()) {
        cairo_identity_matrix(cr());
    } else {
        cairo_set_matrix(cr(), &matrix_stack_.front());
        matrix_stack_.pop_front();
    }
}
开发者ID:gmaslov,项目名称:ga-nn-followers,代码行数:8,代码来源:VectorGraphics.cpp


示例14: pycairo_identity_matrix

static PyObject *
pycairo_identity_matrix (PycairoContext *o)
{
    cairo_identity_matrix (o->ctx);
    if (Pycairo_Check_Status (cairo_status (o->ctx)))
	return NULL;
    Py_RETURN_NONE;
}
开发者ID:anarcher,项目名称:enso-launcher-continued,代码行数:8,代码来源:pycairo-context.c


示例15: cairo_identity_matrix_l

static int cairo_identity_matrix_l( lua_State* L )
{
  lua_cairo_t* lc = lua_cairo_check( L, 1 );

  cairo_identity_matrix( lc->cairo );

  return( 0 );
}
开发者ID:matthewburk,项目名称:cel-reactor,代码行数:8,代码来源:cairo_L.c


示例16: match

void match(unsigned int position)
{
//     cairo_set_line_cap(cairoOut, CAIRO_LINE_CAP_ROUND);
    
    m_sensorReference.seek(position);
    cairo_matrix_t m1;
    cairo_get_matrix(cairoOut, &m1);
    cairo_identity_matrix(cairoOut);
    cairo_set_source_surface(cairoOut, cairo_get_target(cairoMap), 0., 0.);
    cairo_paint(cairoOut);
    cairo_set_matrix(cairoOut, &m1);
//     cairo_set_line_width(cairoOut, 1./(2.*scaleFactor));
    
    std::vector<InterestPoint *> pointsLocal(m_pointsReference[position].size());
    const LaserReading* lreadReference = dynamic_cast<const LaserReading*>(m_sensorReference.current());
    for(unsigned int j = 0; j < m_pointsReference[position].size(); j++){
	InterestPoint * point = new InterestPoint(*m_pointsReference[position][j]);
	point->setPosition(lreadReference->getLaserPose().ominus(point->getPosition()));
	pointsLocal[j] = point;
    }
    
    
    for(unsigned int i = 0; i < m_pointsReference.size(); i++){
	if(i == position) {
	    continue;
	}
	OrientedPoint2D transform;
	std::vector< std::pair<InterestPoint*, InterestPoint* > > correspondences;
	double result = m_ransac->matchSets(m_pointsReference[i], pointsLocal, transform, correspondences);
	if(correspondences.size() >= corresp) {
	    cairo_matrix_t m;
	    cairo_get_matrix(cairoOut, &m);
	    cairo_translate(cairoOut, transform.x, transform.y);
	    cairo_rotate(cairoOut, transform.theta);
	    
	    cairo_set_source_rgba(cairoOut, 1., 0., 0., 1. - result/(acceptanceSigma * acceptanceSigma * 5.99 * double(pointsLocal.size())));
	    cairo_move_to(cairoOut, 0., -0.3);
	    cairo_line_to(cairoOut, 0.6, 0.);
	    cairo_line_to(cairoOut, 0., 0.3);
	    cairo_close_path(cairoOut);
	    cairo_fill(cairoOut);
	    cairo_set_matrix(cairoOut, &m);
	}
    }
    
    cairo_matrix_t m;
    cairo_get_matrix(cairoOut, &m);
    cairo_translate(cairoOut, lreadReference->getLaserPose().x, lreadReference->getLaserPose().y);
    cairo_rotate(cairoOut, lreadReference->getLaserPose().theta);
    cairo_set_source_rgba(cairoOut, 0., 0., 1., 1.);
    cairo_move_to(cairoOut, 0., -0.3);
    cairo_line_to(cairoOut, 0.6, 0.);
    cairo_line_to(cairoOut, 0., 0.3);
    cairo_close_path(cairoOut);
    cairo_stroke(cairoOut);
    cairo_set_matrix(cairoOut, &m);
//     cairo_show_page(cairoOut);
}
开发者ID:artivis,项目名称:flirtlib,代码行数:58,代码来源:RansacLoopClosureDrawMovie.cpp


示例17: goo_canvas_polyline_compute_bounds

static void
goo_canvas_polyline_compute_bounds (GooCanvasPolyline     *polyline,
				    cairo_t               *cr,
				    GooCanvasBounds       *bounds)
{
  GooCanvasItemSimple *simple = (GooCanvasItemSimple*) polyline;
  GooCanvasItemSimpleData *simple_data = simple->simple_data;
  GooCanvasPolylineData *polyline_data = polyline->polyline_data;
  GooCanvasBounds tmp_bounds;
  cairo_matrix_t transform;

  if (polyline_data->num_points == 0)
    {
      bounds->x1 = bounds->x2 = bounds->y1 = bounds->y2 = 0.0;
      return;
    }

  /* Use the identity matrix to get the bounds completely in user space. */
  cairo_get_matrix (cr, &transform);
  cairo_identity_matrix (cr);

  goo_canvas_polyline_create_path (polyline, cr);
  goo_canvas_item_simple_get_path_bounds (simple, cr, bounds);

  /* Add on the arrows, if required. */
  if ((polyline_data->start_arrow || polyline_data->end_arrow)
      && polyline_data->num_points >= 2)
    {
      /* We use the stroke pattern to match the style of the line. */
      goo_canvas_style_set_stroke_options (simple_data->style, cr);

      if (polyline_data->start_arrow)
	{
	  goo_canvas_polyline_create_start_arrow_path (polyline, cr);
	  cairo_fill_extents (cr, &tmp_bounds.x1, &tmp_bounds.y1,
			      &tmp_bounds.x2, &tmp_bounds.y2);
	  bounds->x1 = MIN (bounds->x1, tmp_bounds.x1);
	  bounds->y1 = MIN (bounds->y1, tmp_bounds.y1);
	  bounds->x2 = MAX (bounds->x2, tmp_bounds.x2);
	  bounds->y2 = MAX (bounds->y2, tmp_bounds.y2);
	}

      if (polyline_data->end_arrow)
	{
	  goo_canvas_polyline_create_end_arrow_path (polyline, cr);
	  cairo_fill_extents (cr, &tmp_bounds.x1, &tmp_bounds.y1,
			      &tmp_bounds.x2, &tmp_bounds.y2);
	  bounds->x1 = MIN (bounds->x1, tmp_bounds.x1);
	  bounds->y1 = MIN (bounds->y1, tmp_bounds.y1);
	  bounds->x2 = MAX (bounds->x2, tmp_bounds.x2);
	  bounds->y2 = MAX (bounds->y2, tmp_bounds.y2);
	}
    }

  cairo_set_matrix (cr, &transform);
}
开发者ID:AbuMussabRaja,项目名称:yarp,代码行数:56,代码来源:goocanvaspolyline.c


示例18: cairo_image_surface_create

  void CairoPainter::NewCanvas(double width, double height)
  {
    double titleheight = m_title.empty() ? 0.0 : 16.0;
    if (m_index == 1) {
      // create new surface to paint on
      if(m_cropping) {
        double ratio = width / height;
        if(ratio > 1.0)
          m_height = m_height / ratio;
        else
          m_width = m_width * ratio;
      }
      m_surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, static_cast<int> (m_width), static_cast<int> (m_height));
      m_cairo = cairo_create(m_surface);
      if(m_transparent)
        cairo_set_source_rgba (m_cairo, 0.0, 0.0, 0.0, 0.0);
      else {
        OBColor bg = OBColor(m_fillcolor);
        cairo_set_source_rgb (m_cairo, bg.red, bg.green, bg.blue);
      }
      
      cairo_paint (m_cairo);
      cairo_set_line_width(m_cairo, m_pen_width);
    }
    else {
      // reset transformation matrix
      cairo_identity_matrix(m_cairo);
    }

    // Work out some things!
    double cellwidth = m_width/m_ncols;
    double cellheight = m_height/m_nrows;
    int row = (m_index - 1)/m_ncols + 1;
    int col = m_index - ((row-1)*m_ncols);

    // Work out the scaling factor
    double scale_x = cellwidth / (double) width;
    double scale_y = (cellheight-titleheight) / (double) height; // Leave some extra space for the title if present
    double scale = std::min(scale_x, scale_y);

    // Add the title
    if (!m_title.empty()) {
      this->SetPenColor(OBColor(m_bondcolor));
      this->SetFontSize(static_cast<int>(16.0));
      OBFontMetrics fm = this->GetFontMetrics(m_title);
      this->DrawText(cellwidth/2.0 - fm.width/2.0 + cellwidth*(col-1),
                     cellheight - fm.height * 0.25 + cellheight*(row-1), m_title);
    }

    // Translate the over-scaled dimension into the centre
    if (scale < scale_y)
      cairo_translate(m_cairo, 0 + cellwidth*(col-1), cellheight/2.0 - scale*height/2.0 + cellheight*(row-1));
    else
      cairo_translate(m_cairo, cellwidth/2.0 - scale*width/2.0 + cellwidth*(col-1), 0 + cellheight*(row-1));
    cairo_scale(m_cairo, scale, scale); // Set a scaling transformation
  }
开发者ID:ghutchis,项目名称:openbabel,代码行数:56,代码来源:cairopainter.cpp


示例19: document_render

static void
document_render(document_data_t *d)
{
    GtkWidget *w = d->widget;

    /* render recorded data directly to widget */
    cairo_t *c = gdk_cairo_create(gtk_widget_get_window(w));
    cairo_set_source_rgb(c, 1.0/256*220, 1.0/256*218, 1.0/256*213);
    cairo_paint(c);

    /* render pages with scroll and zoom */
    for (guint i = 0; i < d->pages->len; ++i) {
        page_info_t *p = g_ptr_array_index(d->pages, i);
        if (document_page_is_visible(d, p)) {
            /* render page */
            cairo_scale(c, d->zoom, d->zoom);
            cairo_translate(c, p->rectangle->x - d->hadjust->value, p->rectangle->y - d->vadjust->value);
            page_render(c, p);
            cairo_identity_matrix(c);

            /* render search matches */
            GList *m = p->search_matches;
            while (m) {
                PopplerRectangle *pr = (PopplerRectangle*) m->data;
                cairo_rectangle_t *pc = page_coordinates_from_pdf_coordinates(pr, p);
                cairo_rectangle_t *dc = document_coordinates_from_page_coordinates(pc, p);
                cairo_scale(c, d->zoom, d->zoom);
                cairo_translate(c, dc->x - d->hadjust->value, dc->y - d->vadjust->value);
                cairo_rectangle(c, 0, 0, dc->width, dc->height);
                if (d->current_match == m)
                    cairo_set_source_rgba(c, 0.5, 1, 0, 0.5);
                else
                    cairo_set_source_rgba(c, 1, 1, 0, 0.5);
                cairo_fill(c);
                cairo_identity_matrix(c);
                g_free(dc);
                g_free(pc);
                m = g_list_next(m);
            }
        }
    }
    cairo_destroy(c);
}
开发者ID:karottenreibe,项目名称:luapdf,代码行数:43,代码来源:render.c


示例20: dtgtk_cairo_paint_color

void dtgtk_cairo_paint_color(cairo_t *cr,gint x,gint y,gint w,gint h,gint flags)
{
  cairo_translate(cr, x, y);
  cairo_scale(cr,w,h);
  cairo_set_line_width(cr,0.1);
  cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND);
  cairo_rectangle(cr,0.1,0.1,0.8,0.8);
  cairo_fill(cr);
  cairo_set_source_rgba(cr,0,0,0,0.6);
  cairo_stroke(cr);
  cairo_identity_matrix(cr);
}
开发者ID:ksyz,项目名称:darktable,代码行数:12,代码来源:paint.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cairo_image_surface_create函数代码示例发布时间:2022-05-30
下一篇:
C++ cairo_get_source函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap