Beispiel #1
0
cairo_surface_t *
_cairo_boilerplate_svg_get_image_surface (cairo_surface_t *surface,
					  int width,
					  int height)
{
    cairo_surface_t *image;

    image = _cairo_boilerplate_svg_convert_to_image (surface);
    cairo_surface_set_device_offset (image,
				     cairo_image_surface_get_width (image) - width,
				     cairo_image_surface_get_height (image) - height);
    surface = _cairo_boilerplate_get_image_surface (image, width, height);
    cairo_surface_destroy (image);

    return surface;
}
cairo_surface_t *
_cairo_boilerplate_svg_get_image_surface (cairo_surface_t *surface,
					  int page,
					  int width,
					  int height)
{
    cairo_surface_t *image;

    if (page != 0)
	return cairo_boilerplate_surface_create_in_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH);

    image = _cairo_boilerplate_svg_convert_to_image (surface);
    cairo_surface_set_device_offset (image,
				     cairo_image_surface_get_width (image) - width,
				     cairo_image_surface_get_height (image) - height);
    surface = _cairo_boilerplate_get_image_surface (image, 0, width, height);
    cairo_surface_destroy (image);

    return surface;
}
static cairo_surface_t *
_cairo_boilerplate_test_paginated_get_image_surface (cairo_surface_t *surface,
						     int	      page,
						     int	      width,
						     int	      height)
{
    test_paginated_closure_t *tpc;
    cairo_status_t status;

    /* XXX separate finish as per PDF */
    if (page != 0)
	return cairo_boilerplate_surface_create_in_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH);

    /* show page first.  the automatic show_page is too late for us */
    cairo_surface_show_page (surface);
    status = cairo_surface_status (surface);
    if (status)
	return cairo_boilerplate_surface_create_in_error (status);

    tpc = cairo_surface_get_user_data (surface, &test_paginated_closure_key);
    return _cairo_boilerplate_get_image_surface (tpc->target, 0, width, height);
}