gerbv  2.10.1-dev~ccf6a3
example1.c
/*------------------------------------------------------------------------------
Filename: example1.c
Description: Loads example1-input.gbx into a project, and then exports
the layer back to another RS274X file.
Instructions: Make sure you are in the example-code directory, and compile
this program with the following command:
gcc -Wall -g `pkg-config --cflags libgerbv` `pkg-config --libs libgerbv` example1.c -o example1
Run with the following command:
./example1
Common compiling problems:
1. If you are compiling gerbv from source, make sure you run
"make install" before trying to compile this example. This
ensures libgerbv is correctly installed and can be found.
2. If you installed gerbv to "/usr/local" (the default), many
distributions don't correctly point pkgconfig to this target.
To fix this, add the following to your ~/.bashrc file:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:/usr/lib/pkgconfig/
------------------------------------------------------------------------------*/
#include "gerbv.h"
int
main(int argc, char *argv[]) {
/* create a top level libgerbv structure */
/* parse a Gerber file and store it in the gerbv_project_t struct */
/* make sure we parsed the file */
if (mainProject->file[0] == NULL)
g_error ("There was an error parsing the file.");
/* export the first (and only) image in the project, which will be the
one we just loaded */
gerbv_export_rs274x_file_from_image ("example1-output.gbx",
mainProject->file[0]->image, NULL);
/* destroy the top-level structure and free all memory */
return 0;
}
gboolean gerbv_export_rs274x_file_from_image(const gchar *filename, gerbv_image_t *inputImage, gerbv_user_transformation_t *transform)
Export an image to a new file in RS274X format.
void gerbv_open_layer_from_filename(gerbv_project_t *gerbvProject, const gchar *filename)
Open a file, parse the contents, and add a new layer to an existing project.
Definition: gerbv.c:214
void gerbv_destroy_project(gerbv_project_t *gerbvProject)
Free a project and all related variables.
Definition: gerbv.c:181
gerbv_project_t * gerbv_create_project(void)
Create a new project structure and initialize some important variables.
Definition: gerbv.c:164
The main header file for the libgerbv library.
gerbv_project_t * mainProject
Global state variable to keep track of what's happening on the screen.
Definition: main.c:169
gerbv_image_t * image
Definition: gerbv.h:746
gerbv_fileinfo_t ** file
Definition: gerbv.h:763