Does anyone have a working example of using Cairo Rendering to a PNG
file? I am converting some existing cairo code and can't seem to get it
to work. I get it to create the surface and write the file, but none of
the layer info is there. I'm sure its something simple I am missing
with libgerbv but can't figure it out.
Here is a code snippet:
#include "gerbv.h"
int
main(int argc, char *argv[]) {
/* create a top level libgerbv structure */
gerbv_project_t *mainProject = gerbv_create_project();
gerbv_render_info_t screenRenderInfo;
screenRenderInfo.renderType = GERBV_RENDER_TYPE_CAIRO_HIGH_QUALITY;
screenRenderInfo.displayWidth = 1024;
screenRenderInfo.displayHeight = 768;
screenRenderInfo.scaleFactorX = 0;
screenRenderInfo.scaleFactorY = 0;
/* parse my Gerber Files */
gerbv_open_layer_from_filename (mainProject, "Nixie Tube
Breakout.GTO");
gerbv_open_layer_from_filename (mainProject, "Nixie Tube
Breakout.GTS");
gerbv_open_layer_from_filename (mainProject, "Nixie Tube
Breakout.TXT");
gerbv_open_layer_from_filename (mainProject, "Nixie Tube
Breakout.GTL");
/* Invert the Solder Mask Layer */
mainProject->file[1]->transform.inverted = TRUE;
/* Create the Cairo Surface */
cairo_surface_t *surface;
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1024, 768);
cairo_t *cr = cairo_create (surface);
/* render all layers using the simple method */
gerbv_render_all_layers_to_cairo_target (mainProject, cr,
&screenRenderInfo);
/* Write the service to file */
cairo_surface_write_to_png(surface, "test.png");
cairo_destroy (cr);
return 0;
}
Thanks!
------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself;
WebMatrix provides all the features you need to develop and
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Gerbv-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gerbv-devel