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

C++ rsvg_handle_render_cairo函数代码示例

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

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



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

示例1: paint_background

static void paint_background (CairoDockModuleInstance *myApplet, cairo_t* pDrawingContext)
{
    if (myData.pSvgHandles[CLOCK_DROP_SHADOW] != NULL)
        rsvg_handle_render_cairo (myData.pSvgHandles[CLOCK_DROP_SHADOW], pDrawingContext);
    if (myData.pSvgHandles[CLOCK_FACE] != NULL)
        rsvg_handle_render_cairo (myData.pSvgHandles[CLOCK_FACE], pDrawingContext);
    if (myData.pSvgHandles[CLOCK_MARKS] != NULL)
        rsvg_handle_render_cairo (myData.pSvgHandles[CLOCK_MARKS], pDrawingContext);
}
开发者ID:BackupTheBerlios,项目名称:cairo-dock-svn,代码行数:9,代码来源:applet-theme.c


示例2: paint_foreground

static void paint_foreground (CairoDockModuleInstance *myApplet, cairo_t* pDrawingContext)
{
    if (myData.pSvgHandles[CLOCK_FACE_SHADOW] != NULL)
        rsvg_handle_render_cairo (myData.pSvgHandles[CLOCK_FACE_SHADOW], pDrawingContext);
    if (myData.pSvgHandles[CLOCK_GLASS] != NULL)
        rsvg_handle_render_cairo (myData.pSvgHandles[CLOCK_GLASS], pDrawingContext);
    if (myData.pSvgHandles[CLOCK_FRAME] != NULL)
        rsvg_handle_render_cairo (myData.pSvgHandles[CLOCK_FRAME], pDrawingContext);
}
开发者ID:BackupTheBerlios,项目名称:cairo-dock-svn,代码行数:9,代码来源:applet-theme.c


示例3: paint_second

static void paint_second (CairoDockModuleInstance *myApplet, cairo_t* pDrawingContext)
{
    double fShadowOffsetX = -0.75f;
    double fShadowOffsetY = 0.75f;
    cairo_save (pDrawingContext);
    cairo_translate(pDrawingContext, fShadowOffsetX, fShadowOffsetY);
    if (myData.pSvgHandles[CLOCK_SECOND_HAND_SHADOW] != NULL)
        rsvg_handle_render_cairo (myData.pSvgHandles[CLOCK_SECOND_HAND_SHADOW], pDrawingContext);
    cairo_restore (pDrawingContext);
    if (myData.pSvgHandles[CLOCK_SECOND_HAND] != NULL)
        rsvg_handle_render_cairo (myData.pSvgHandles[CLOCK_SECOND_HAND], pDrawingContext);
}
开发者ID:BackupTheBerlios,项目名称:cairo-dock-svn,代码行数:12,代码来源:applet-theme.c


示例4: draw_map_svg

static void draw_map_svg(cairo_t * cr, guint width, guint height, guint i, guint j) {
  
  cairo_save (cr);
  cairo_translate (cr, j*70, i*70);
  rsvg_handle_render_cairo(tiles[map[i][j]], cr);
  if (map[i][j] == GREY_FLOOR) {
    cairo_translate (cr, 35/2, 35/2);
    cairo_set_source_rgba(cr, 0.7, 0.7, 0.7, 0.7);
    cairo_arc(cr, 35/2, 5+35/2, 18, 0, 2*M_PI);
    cairo_fill(cr);
    rsvg_handle_render_cairo(coin, cr);
  }
  cairo_restore (cr);
}
开发者ID:evfool,项目名称:eternal,代码行数:14,代码来源:eternal.c


示例5: graphic_render

/**
 * Renders the SVG, performing any necessary transformations.
 */
void graphic_render (Graphic* self, cairo_t* context) {
	cairo_matrix_t oldMatrix = {0};
	cairo_t* _tmp0_ = NULL;
	cairo_matrix_t _tmp1_ = {0};
	cairo_t* _tmp2_ = NULL;
	gint _tmp3_ = 0;
	gint _tmp4_ = 0;
	RsvgHandle* _tmp5_ = NULL;
	cairo_t* _tmp6_ = NULL;
	cairo_t* _tmp7_ = NULL;
	cairo_matrix_t _tmp8_ = {0};
	g_return_if_fail (self != NULL);
	g_return_if_fail (context != NULL);
	_tmp0_ = context;
	cairo_get_matrix (_tmp0_, &_tmp1_);
	oldMatrix = _tmp1_;
	_tmp2_ = context;
	_tmp3_ = self->priv->xCentre;
	_tmp4_ = self->priv->yCentre;
	cairo_translate (_tmp2_, (gdouble) (-_tmp3_), (gdouble) (-_tmp4_));
	_tmp5_ = self->priv->svgHandle;
	_tmp6_ = context;
	rsvg_handle_render_cairo (_tmp5_, _tmp6_);
	_tmp7_ = context;
	_tmp8_ = oldMatrix;
	cairo_set_matrix (_tmp7_, &_tmp8_);
}
开发者ID:MerelyAPseudonym,项目名称:SmartSim,代码行数:30,代码来源:graphic.c


示例6: draw

static void draw(GtkWidget *widget, cairo_t *cr) {
  if (rsvg == NULL) return;

  double window_width, window_height;
  window_width = widget->allocation.width;
  window_height = widget->allocation.height;

  RsvgDimensionData dimensions;
  rsvg_handle_get_dimensions(rsvg, &dimensions);
  unsigned int w, h;
  w = dimensions.width;
  h = dimensions.height;
  double aspect_ratio;
  aspect_ratio = 1.0 * w / h;

  double page_width, page_height;
  page_height = window_height - 8;
  page_width = page_height * aspect_ratio;
  if (page_width > window_width - 8) {
    page_width = window_width - 8;
    page_height = page_width / aspect_ratio;
  }
  double x = (window_width - page_width + 4.) / 2.;
  double y = (window_height - page_height + 4.) / 2.;

  cairo_rectangle(cr, x, y, page_width, page_height);
  cairo_set_source_rgb(cr, 1, 1, 1);
  cairo_fill(cr);

  cairo_translate(cr, x, y);
  cairo_scale(cr, page_width/w, page_height/h);
  rsvg_handle_render_cairo(rsvg, cr);
}
开发者ID:chinnurtb,项目名称:cassius,代码行数:33,代码来源:_svgview.c


示例7: test_render_crash

static void
test_render_crash (gconstpointer data)
{
    GFile *file = G_FILE (data);
    RsvgHandle *handle;
    GError *error = NULL;
    RsvgDimensionData dimensions;
    cairo_surface_t *surface;
    cairo_t *cr;

    handle = rsvg_handle_new_from_gfile_sync (file, RSVG_HANDLE_FLAGS_NONE, NULL, &error);
    g_assert_no_error (error);
    g_assert (handle != NULL);

    rsvg_handle_get_dimensions (handle, &dimensions);
    g_assert (dimensions.width > 0);
    g_assert (dimensions.height > 0);
    surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
					  dimensions.width, dimensions.height);
    cr = cairo_create (surface);
    g_assert (rsvg_handle_render_cairo (handle, cr));

    cairo_surface_destroy (surface);
    cairo_destroy (cr);

    g_object_unref (handle);
}
开发者ID:ImageMagick,项目名称:librsvg,代码行数:27,代码来源:render-crash.c


示例8: fill_image_buffer_from_file

static cairo_surface_t *
fill_image_buffer_from_file (cairo_t *cr, const char *filePath)
{
  GError *error = NULL;
  RsvgHandle *handle;
  cairo_surface_t *tmp_surface;
  cairo_t *tmp_cr;

  handle = rsvg_handle_new_from_file (filePath, &error);

  if (handle == NULL) {
    g_warning("rsvg_handle_new_from_file(\"%s\") failed: %s",
	      filePath, (error ? error->message : "unknown error"));
    if (error)
      g_error_free(error);
    return NULL;
  }

  tmp_surface = cairo_surface_create_similar (cairo_get_target (cr),
					      CAIRO_CONTENT_COLOR_ALPHA,
					      32, 32);
  tmp_cr = cairo_create (tmp_surface);
  rsvg_handle_render_cairo (handle, tmp_cr);
  cairo_destroy (tmp_cr);
  rsvg_handle_free (handle);
  return tmp_surface;
}
开发者ID:brion,项目名称:gnome-system-monitor,代码行数:27,代码来源:gsm_color_button.c


示例9: renderSvg

static void
renderSvg(CompScreen *s,
          SvgSource *source,
          SvgTexture *texture,
          float x1,
          float y1,
          float x2,
          float y2,
          int width,
          int height)
{
    float w = x2 - x1;
    float h = y2 - y1;

    cairo_save(texture->cr);

    cairo_set_operator(texture->cr, CAIRO_OPERATOR_SOURCE);
    cairo_set_source_rgba(texture->cr, 1.0, 1.0, 1.0, 0.0);
    cairo_paint(texture->cr);
    cairo_set_operator(texture->cr, CAIRO_OPERATOR_OVER);

    cairo_scale(texture->cr, 1.0 / w, 1.0 / h);

    cairo_scale(texture->cr,
                (double)width / source->dimension.width,
                (double)height / source->dimension.height);

    cairo_translate(texture->cr,
                    -x1 * source->dimension.width,
                    -y1 * source->dimension.height);

    rsvg_handle_render_cairo(source->svg, texture->cr);

    cairo_restore(texture->cr);
}
开发者ID:zmike,项目名称:compiz,代码行数:35,代码来源:svg.c


示例10: _rsvg_render_page

static const char *
_rsvg_render_page (const char *filename,
		   cairo_surface_t **surface_out)
{
    RsvgHandle *handle;
    RsvgDimensionData dimensions;
    GError *error = NULL;
    cairo_surface_t *surface;
    cairo_t *cr;
    cairo_status_t status;

    handle = rsvg_handle_new_from_file (filename, &error);
    if (handle == NULL)
	return error->message; /* XXX g_error_free */

    rsvg_handle_get_dimensions (handle, &dimensions);
    surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
					  dimensions.width,
					  dimensions.height);
    cr = cairo_create (surface);

    rsvg_handle_render_cairo (handle, cr);
    g_object_unref (handle);

    status = cairo_status (cr);
    cairo_destroy (cr);

    if (status) {
	cairo_surface_destroy (surface);
	return  cairo_status_to_string (status);
    }

    *surface_out = surface;
    return NULL;
}
开发者ID:Ashod,项目名称:WinCairoRequirements,代码行数:35,代码来源:any2ppm.c


示例11: gvloadimage_rsvg_cairo

static void gvloadimage_rsvg_cairo(GVJ_t * job, usershape_t *us, boxf b, boolean filled)
{
    RsvgHandle* rsvgh = gvloadimage_rsvg_load(job, us);

    cairo_t *cr = (cairo_t *) job->context; /* target context */
    cairo_surface_t *surface;	 /* source surface */

    if (rsvgh) {
        cairo_save(cr);

       	surface = cairo_svg_surface_create(NUL_FILE, us->w, us->h); 

	cairo_surface_reference(surface);

        cairo_set_source_surface(cr, surface, 0, 0);

        cairo_translate(cr, ROUND(b.LL.x), ROUND(-b.UR.y));
        cairo_scale(cr, (b.UR.x - b.LL.x) / us->w,
                       (b.UR.y - b.LL.y) / us->h);

	rsvg_handle_render_cairo(rsvgh, cr);

        cairo_paint (cr);
        cairo_restore(cr);
    }
}
开发者ID:ekoontz,项目名称:graphviz,代码行数:26,代码来源:gvloadimage_rsvg.c


示例12: QSizeF

QImage SVGCairoRSVGBackend::renderToImage(const QSize& imageSize,
                                          const QRectF& region) const
{
    const auto svgSize = QSizeF(getSize());

    const auto zoomX = 1.0 / region.width();
    const auto zoomY = 1.0 / region.height();

    const auto resX = imageSize.width() / svgSize.width();
    const auto resY = imageSize.height() / svgSize.height();

    const auto topLeft =
        QPointF{region.x() * svgSize.width(), region.y() * svgSize.height()};

    auto image = QImage{imageSize, QImage::Format_ARGB32_Premultiplied};
    image.fill(Qt::transparent);
    auto surface = CairoSurfacePtr{
        cairo_image_surface_create_for_data(image.bits(), CAIRO_FORMAT_ARGB32,
                                            image.width(), image.height(),
                                            4 * image.width())};
    auto context = CairoPtr{cairo_create(surface.get())};

    cairo_scale(context.get(), zoomX * resX, zoomY * resY);
    cairo_translate(context.get(), -topLeft.x(), -topLeft.y());

    const std::lock_guard<std::mutex> lock(_impl->renderMutex);
    rsvg_handle_render_cairo(_impl->svg.get(), context.get());

    return image;
}
开发者ID:BlueBrain,项目名称:Tide,代码行数:30,代码来源:SVGCairoRSVGBackend.cpp


示例13: svgSize

QImage SVGCairoRSVGBackend::renderToImage(const QSize& imageSize,
                                          const QRectF& region) const
{
    const QSizeF svgSize(getSize());

    const qreal zoomX = 1.0 / region.width();
    const qreal zoomY = 1.0 / region.height();

    const qreal resX = imageSize.width() / svgSize.width();
    const qreal resY = imageSize.height() / svgSize.height();

    const QPointF topLeft(region.x() * svgSize.width(),
                          region.y() * svgSize.height());

    QImage image(imageSize, QImage::Format_ARGB32);
    image.fill(Qt::white);
    CairoSurfacePtr surface(
        cairo_image_surface_create_for_data(image.bits(), CAIRO_FORMAT_ARGB32,
                                            image.width(), image.height(),
                                            4 * image.width()));
    CairoPtr context(cairo_create(surface.get()));

    cairo_scale(context.get(), zoomX * resX, zoomY * resY);
    cairo_translate(context.get(), -topLeft.x(), -topLeft.y());

    const std::lock_guard<std::mutex> lock(_impl->renderMutex);
    rsvg_handle_render_cairo(_impl->svg.get(), context.get());

    return image;
}
开发者ID:ppodhajski,项目名称:Tide,代码行数:30,代码来源:SVGCairoRSVGBackend.cpp


示例14: svg2pdf

int svg2pdf(const char *svg_filename, const char *pdf_filename) {
	RsvgHandle *svg_handle;
	RsvgDimensionData dimension_data;
	cairo_surface_t *surface;
	cairo_t *cr;
	
	rsvg_set_default_dpi(72.0);
	svg_handle = rsvg_handle_new_from_file(svg_filename, NULL);
	if(svg_handle == NULL) {
		return 0;
	}
	rsvg_handle_set_dpi(svg_handle, 72.0);
	rsvg_handle_get_dimensions(svg_handle, &dimension_data);
	surface = cairo_pdf_surface_create(pdf_filename, dimension_data.width, dimension_data.height);
	if(cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) {
		return 0;
	}
	cr = cairo_create(surface);
	if(cairo_status(cr) != CAIRO_STATUS_SUCCESS) {
		return 0;
	}
	if(!rsvg_handle_render_cairo(svg_handle, cr)) {
		return 0;
	}
	
	cairo_show_page(cr);
	
	cairo_surface_destroy(surface);
	cairo_destroy(cr);
	g_object_unref(svg_handle);
	
	return 1;
}
开发者ID:IngoHeimbach,项目名称:CalPage,代码行数:33,代码来源:svg2pdf.c


示例15: cairo_save

void
SvgWindow::renderSvg (SvgSource  *source,
		      SvgTexture &texture,
		      CompSize   size,
		      float      x1,
		      float      y1,
		      float      x2,
		      float      y2)
{
    float w = x2 - x1;
    float h = y2 - y1;

    cairo_save (texture.cr);

    cairo_set_operator (texture.cr, CAIRO_OPERATOR_SOURCE);
    cairo_set_source_rgba (texture.cr, 1.0, 1.0, 1.0, 0.0);
    cairo_paint (texture.cr);
    cairo_set_operator (texture.cr, CAIRO_OPERATOR_OVER);

    cairo_scale (texture.cr, 1.0 / w, 1.0 / h);

    cairo_scale (texture.cr,
		 (double) size.width () / source->dimension.width,
		 (double) size.height () / source->dimension.height);

    cairo_translate (texture.cr,
		     -x1 * source->dimension.width,
		     -y1 * source->dimension.height);

    rsvg_handle_render_cairo (source->svg, texture.cr);

    cairo_restore (texture.cr);
}
开发者ID:CannedFish,项目名称:deepin-compiz,代码行数:33,代码来源:imgsvg.cpp


示例16: readSvgFileToImage

static Bool
readSvgFileToImage(char *file,
                   int *width,
                   int *height,
                   void **data)
{
    cairo_surface_t *surface;
    FILE *fp;
    GError *error = NULL;
    RsvgHandle *svgHandle;
    RsvgDimensionData svgDimension;

    fp = fopen(file, "r");
    if (!fp)
        return FALSE;

    fclose(fp);

    svgHandle = rsvg_handle_new_from_file(file, &error);
    if (!svgHandle)
        return FALSE;

    rsvg_handle_get_dimensions(svgHandle, &svgDimension);

    *width = svgDimension.width;
    *height = svgDimension.height;

    *data = malloc(svgDimension.width * svgDimension.height * 4);
    if (!*data)
    {
        rsvg_handle_free(svgHandle);
        return FALSE;
    }

    surface = cairo_image_surface_create_for_data(*data,
              CAIRO_FORMAT_ARGB32,
              svgDimension.width,
              svgDimension.height,
              svgDimension.width * 4);
    if (surface)
    {
        cairo_t *cr;

        cr = cairo_create(surface);

        cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
        cairo_paint(cr);
        cairo_set_operator(cr, CAIRO_OPERATOR_OVER);

        rsvg_handle_render_cairo(svgHandle, cr);

        cairo_destroy(cr);
        cairo_surface_destroy(surface);
    }

    rsvg_handle_free(svgHandle);

    return TRUE;
}
开发者ID:zmike,项目名称:compiz,代码行数:59,代码来源:svg.c


示例17: size_allocate_callback

static void size_allocate_callback(GtkWidget *widget, GtkAllocation *allocation, gpointer user_data)
{
  dt_iop_module_t *self = (dt_iop_module_t *)user_data;
  dt_iop_zonesystem_gui_data_t *g = (dt_iop_zonesystem_gui_data_t *)self->gui_data;

  if(g->image) cairo_surface_destroy(g->image);
  free(g->image_buffer);

  /* load the dt logo as a brackground */
  char filename[PATH_MAX] = { 0 };
  char datadir[PATH_MAX] = { 0 };
  char *logo;
  dt_logo_season_t season = get_logo_season();
  if(season != DT_LOGO_SEASON_NONE)
    logo = g_strdup_printf("%%s/pixmaps/idbutton-%d.svg", (int)season);
  else
    logo = g_strdup("%s/pixmaps/idbutton.svg");

  dt_loc_get_datadir(datadir, sizeof(datadir));
  snprintf(filename, sizeof(filename), logo, datadir);
  g_free(logo);
  RsvgHandle *svg = rsvg_handle_new_from_file(filename, NULL);
  if(svg)
  {
    cairo_surface_t *surface;
    cairo_t *cr;

    RsvgDimensionData dimension;
    rsvg_handle_get_dimensions(svg, &dimension);

    float svg_size = MAX(dimension.width, dimension.height);
    float final_size = MIN(allocation->width, allocation->height) * 0.75;
    float factor = final_size / svg_size;
    float final_width = dimension.width * factor * darktable.gui->ppd,
          final_height = dimension.height * factor * darktable.gui->ppd;
    int stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, final_width);

    g->image_buffer = (guint8 *)calloc(stride * final_height, sizeof(guint8));
    surface = dt_cairo_image_surface_create_for_data(g->image_buffer, CAIRO_FORMAT_ARGB32, final_width,
                                                     final_height, stride);
    if(cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS)
    {
      free(g->image_buffer);
      g->image_buffer = NULL;
    }
    else
    {
      cr = cairo_create(surface);
      cairo_scale(cr, factor, factor);
      rsvg_handle_render_cairo(svg, cr);
      cairo_destroy(cr);
      cairo_surface_flush(surface);
      g->image = surface;
      g->image_width = final_width / darktable.gui->ppd;
      g->image_height = final_height / darktable.gui->ppd;
    }
    g_object_unref(svg);
  }
}
开发者ID:AdamMajer,项目名称:darktable,代码行数:59,代码来源:zonesystem.c


示例18: rsvg_handle_new_from_file

bool
SvgScreen::readSvgToImage (const char *file,
			   CompSize   &size,
			   void       *&data)
{
    cairo_surface_t   *surface;
    std::ifstream     svgFile;
    GError	      *error = NULL;
    RsvgHandle	      *svgHandle;
    RsvgDimensionData svgDimension;

    svgFile.open (file);
    if (!svgFile.is_open ())
	return false;

    svgFile.close ();
    svgHandle = rsvg_handle_new_from_file (file, &error);
    if (!svgHandle)
	return false;

    rsvg_handle_get_dimensions (svgHandle, &svgDimension);

    size.setWidth (svgDimension.width);
    size.setHeight (svgDimension.height);

    data = malloc (svgDimension.width * svgDimension.height * 4);
    if (!data)
    {
	rsvg_handle_free (svgHandle);
	return false;
    }

    surface = cairo_image_surface_create_for_data ((unsigned char *) data,
						   CAIRO_FORMAT_ARGB32,
						   svgDimension.width,
						   svgDimension.height,
						   svgDimension.width * 4);
    if (surface)
    {
	cairo_t *cr;

	cr = cairo_create (surface);

	cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
	cairo_paint (cr);
	cairo_set_operator (cr, CAIRO_OPERATOR_OVER);

	rsvg_handle_render_cairo (svgHandle, cr);

	cairo_destroy (cr);
	cairo_surface_destroy (surface);
    }

    rsvg_handle_free (svgHandle);

    return true;
}
开发者ID:CannedFish,项目名称:deepin-compiz,代码行数:57,代码来源:imgsvg.cpp


示例19: ui_insert_svg

/*
 * ui_insert_svg() is not currently used as it's quite slow
 * I've kept the code here am I might use it later
 */
void ui_insert_svg(RsvgHandle *svg, double x, double y, double size)
{
	RsvgDimensionData dimensions;

	rsvg_handle_get_dimensions(svg, &dimensions);
	cairo_save(ui->w[ui->cur].c);
	cairo_translate(ui->w[ui->cur].c, x, y);
	cairo_scale(ui->w[ui->cur].c, size / dimensions.width, size / dimensions.width);
	rsvg_handle_render_cairo(svg, ui->w[ui->cur].c);
	cairo_restore(ui->w[ui->cur].c);
}
开发者ID:johanmalm,项目名称:jgmenu,代码行数:15,代码来源:x11-ui.c


示例20: draw_page

static void
draw_page (GtkPrintOperation *operation,
		   GtkPrintContext   *context,
		   gint               page_nr,
		   gpointer           user_data)
{
    ViewerCbInfo *info = (ViewerCbInfo *) user_data;

	cairo_t *cr;
	gdouble page_width, page_height;
  
	cr = gtk_print_context_get_cairo_context (context);
	page_width = gtk_print_context_get_width (context);
	page_height = gtk_print_context_get_height (context);

	{
		RsvgHandle *handle;
		RsvgDimensionData svg_dimensions;
		struct RsvgSizeCallbackData size_data;

		/* should not fail */
		handle = rsvg_handle_new_from_data(info->svg_bytes->data, info->svg_bytes->len, NULL);
		rsvg_handle_set_base_uri (handle, info->base_uri);
		rsvg_handle_set_dpi_x_y (handle, gtk_print_context_get_dpi_x(context), 
								 gtk_print_context_get_dpi_y(context));
		rsvg_handle_get_dimensions(handle, &svg_dimensions);

        if (svg_dimensions.width > page_width || svg_dimensions.height > page_height) {
            /* scale down the image to the page's size, while preserving the aspect ratio */

            if ((double) svg_dimensions.height * (double) page_width > (double) svg_dimensions.width * (double) page_height) {
                svg_dimensions.width = 0.5 + (double) svg_dimensions.width *(double) page_height / (double) svg_dimensions.height;
                svg_dimensions.height = page_height;
            } else {
                svg_dimensions.height = 0.5 + (double) svg_dimensions.height *(double) page_width / (double) svg_dimensions.width;
                svg_dimensions.width = page_width;
            }
        }

		size_data.type = RSVG_SIZE_WH;
		size_data.width = svg_dimensions.width;
		size_data.height = svg_dimensions.height;
		size_data.keep_aspect_ratio = FALSE;
		rsvg_handle_set_size_callback (handle, _rsvg_size_callback, &size_data, NULL);

		rsvg_handle_render_cairo(handle, cr);

		g_object_unref (handle);
	}
}
开发者ID:kinglulu,项目名称:librsvg,代码行数:50,代码来源:test-display.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ rt函数代码示例发布时间:2022-05-30
下一篇:
C++ rstrip函数代码示例发布时间: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