40 #include <gdk-pixbuf/gdk-pixbuf.h>
48 #include <cairo-pdf.h>
50 #include <cairo-svg.h>
54 void exportimage_render_to_surface_and_destroy (
gerbv_project_t *gerbvProject,
56 cairo_t *cairoTarget = cairo_create (cSurface);
58 gerbv_render_all_layers_to_cairo_target_for_vector_output (gerbvProject, cairoTarget, renderInfo);
59 cairo_destroy (cairoTarget);
60 cairo_surface_destroy (cSurface);
65 gerbv_render_get_boundingbox(gerbvProject, &bb);
69 bb.
right += (tempWidth*0.05);
70 bb.
left -= (tempWidth*0.05);
71 bb.
bottom += (tempHeight*0.05);
72 bb.
top -= (tempHeight*0.05);
74 float height = bb.
bottom - bb.
top + 0.001;
82 int heightInPixels, gchar
const* filename) {
85 widthInPixels, heightInPixels};
92 cairo_surface_t *cSurface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
94 cairo_t *cairoTarget = cairo_create (cSurface);
95 gerbv_render_all_layers_to_cairo_target (gerbvProject, cairoTarget, renderInfo);
96 if (CAIRO_STATUS_SUCCESS != cairo_surface_write_to_png (cSurface, filename)) {
97 GERB_COMPILE_ERROR (_(
"Exporting error to file \"%s\""), filename);
99 cairo_destroy (cairoTarget);
100 cairo_surface_destroy (cSurface);
109 gchar
const* filename) {
110 cairo_surface_t *cSurface = cairo_pdf_surface_create (filename, renderInfo->
displayWidth,
113 exportimage_render_to_surface_and_destroy (gerbvProject, cSurface, renderInfo, filename);
122 gchar
const* filename) {
123 cairo_surface_t *cSurface = cairo_ps_surface_create (filename, renderInfo->
displayWidth,
125 exportimage_render_to_surface_and_destroy (gerbvProject, cSurface, renderInfo, filename);
134 gchar
const* filename) {
135 cairo_surface_t *cSurface = cairo_svg_surface_create (filename, renderInfo->
displayWidth,
137 exportimage_render_to_surface_and_destroy (gerbvProject, cSurface, renderInfo, filename);