gerbv
gerbv.c File Reference

Go to the source code of this file.

Functions

const char * gerbv_aperture_type_name (gerbv_aperture_type_t type)
 
const char * gerbv_aperture_state_name (gerbv_aperture_state_t state)
 
const char * gerbv_interpolation_name (gerbv_interpolation_t interp)
 
gerbv_project_tgerbv_create_project (void)
 
void gerbv_destroy_project (gerbv_project_t *gerbvProject)
 
void gerbv_destroy_fileinfo (gerbv_fileinfo_t *fileInfo)
 
void gerbv_open_layer_from_filename (gerbv_project_t *gerbvProject, gchar const *filename)
 
void gerbv_open_layer_from_filename_with_color (gerbv_project_t *gerbvProject, gchar const *filename, guint16 red, guint16 green, guint16 blue, guint16 alpha)
 
int gerbv_open_image (gerbv_project_t *gerbvProject, gchar const *filename, int idx, int reload, gerbv_HID_Attribute *fattr, int n_fattr, gboolean forceLoadFile)
 
gboolean gerbv_is_loadable_file (const char *filename)
 
gerbv_image_tgerbv_create_excellon_image_from_filename (const gchar *filename)
 
gerbv_image_tgerbv_create_rs274x_image_from_filename (gchar const *filename)
 
void gerbv_render_zoom_to_fit_display (gerbv_project_t *gerbvProject, gerbv_render_info_t *renderInfo)
 
void gerbv_render_layer_to_cairo_target (cairo_t *cr, gerbv_fileinfo_t *fileInfo, gerbv_render_info_t *renderInfo)
 
gerbv_fileinfo_tgerbv_get_fileinfo_for_image (const gerbv_image_t *image, const gerbv_project_t *project)
 
void gerbv_rotate_coord (double *x, double *y, double rad)
 
void gerbv_transform_coord (double *x, double *y, const gerbv_user_transformation_t *trans)
 
int gerbv_transform_coord_for_image (double *x, double *y, const gerbv_image_t *image, const gerbv_project_t *project)
 
gboolean gerbv_endswith (const char *path, const char *ext)
 

Detailed Description

This file contains high-level functions for the libgerbv library.

Definition in file gerbv.c.

Function Documentation

◆ gerbv_aperture_state_name()

const char* gerbv_aperture_state_name ( gerbv_aperture_state_t  state)

< Off state

< On state

< Flash state

Definition at line 99 of file gerbv.c.

◆ gerbv_create_excellon_image_from_filename()

gerbv_image_t* gerbv_create_excellon_image_from_filename ( const gchar *  filename)

Parse an Excellon drill file and return the parsed image.

Returns
the new gerbv_image_t, or NULL if not successful
Parameters
filenamethe filename of the file to be parsed

Definition at line 674 of file gerbv.c.

◆ gerbv_create_rs274x_image_from_filename()

gerbv_image_t* gerbv_create_rs274x_image_from_filename ( const gchar *  filename)

Parse a RS274X file and return the parsed image.

Returns
the new gerbv_image_t, or NULL if not successful
Parameters
filenamethe filename of the file to be parsed
Examples
example2.c, and example4.c.

Definition at line 691 of file gerbv.c.

◆ gerbv_destroy_fileinfo()

void gerbv_destroy_fileinfo ( gerbv_fileinfo_t fileInfo)

Free a fileinfo structure.

Parameters
fileInfothe fileinfo to free

Definition at line 230 of file gerbv.c.

References gerbv_fileinfo_t::fullPathname, gerbv_destroy_image(), gerbv_fileinfo_t::image, gerbv_fileinfo_t::name, and gerbv_fileinfo_t::privateRenderData.

Referenced by gerbv_destroy_project().

◆ gerbv_destroy_project()

void gerbv_destroy_project ( gerbv_project_t gerbvProject)

Free a project and all related variables.

Parameters
gerbvProjectthe project to destroy
Examples
example1.c, example3.c, and example6.c.

Definition at line 207 of file gerbv.c.

References gerbv_project_t::execname, gerbv_project_t::execpath, gerbv_project_t::file, gerbv_destroy_fileinfo(), gerbv_project_t::last_loaded, gerbv_project_t::path, and gerbv_project_t::project.

◆ gerbv_endswith()

gboolean gerbv_endswith ( const char *  path,
const char *  ext 
)

See if 'path' ends with the filename extension 'ext'

Definition at line 1190 of file gerbv.c.

◆ gerbv_get_fileinfo_for_image()

gerbv_fileinfo_t* gerbv_get_fileinfo_for_image ( const gerbv_image_t image,
const gerbv_project_t project 
)

Return found fileinfo for image, or NULL

Definition at line 1130 of file gerbv.c.

References gerbv_project_t::file, gerbv_fileinfo_t::image, and gerbv_project_t::last_loaded.

Referenced by gerbv_transform_coord_for_image().

◆ gerbv_is_loadable_file()

gboolean gerbv_is_loadable_file ( const char *  filename)

Check if a file is a loadable gerber, drill, or pick-and-place file

Definition at line 655 of file gerbv.c.

◆ gerbv_open_image()

int gerbv_open_image ( gerbv_project_t gerbvProject,
gchar const *  filename,
int  idx,
int  reload,
gerbv_HID_Attribute *  fattr,
int  n_fattr,
gboolean  forceLoadFile 
)
Todo:
Rip out this whole really really really bad code
Todo:
Rip out this whole really really really bad code

Definition at line 481 of file gerbv.c.

References gerbv_project_t::file, gerbv_fileinfo_t::image, gerbv_image_t::info, and gerbv_project_t::max_files.

Referenced by gerbv_open_layer_from_filename(), and gerbv_open_layer_from_filename_with_color().

◆ gerbv_open_layer_from_filename()

void gerbv_open_layer_from_filename ( gerbv_project_t gerbvProject,
gchar const *  filename 
)

Open a file, parse the contents, and add a new layer to an existing project.

Parameters
gerbvProjectthe existing project to add the new layer to
filenamethe full pathname of the file to be parsed
Examples
example1.c, example3.c, and example6.c.

Definition at line 242 of file gerbv.c.

References gerbv_project_t::file, gerbv_open_image(), gerbv_project_t::last_loaded, and gerbv_fileinfo_t::layer_dirty.

◆ gerbv_open_layer_from_filename_with_color()

void gerbv_open_layer_from_filename_with_color ( gerbv_project_t gerbvProject,
gchar const *  filename,
guint16  red,
guint16  green,
guint16  blue,
guint16  alpha 
)

Open a file, parse the contents, and add a new layer to an existing project while setting the color of the layer.

Parameters
gerbvProjectthe existing project to add the new layer to
filenamethe full pathname of the file to be parsed
redthe value for the red color component
greenthe value for the green color component
bluethe value for the blue color component
alphathe value for the alpha color component

Definition at line 260 of file gerbv.c.

References gerbv_fileinfo_t::alpha, gerbv_fileinfo_t::color, gerbv_project_t::file, gerbv_open_image(), gerbv_project_t::last_loaded, and gerbv_fileinfo_t::layer_dirty.

◆ gerbv_render_layer_to_cairo_target()

void gerbv_render_layer_to_cairo_target ( cairo_t *  cr,
gerbv_fileinfo_t fileInfo,
gerbv_render_info_t renderInfo 
)

Render a layer to a cairo context.

Parameters
crthe cairo context
fileInfothe layer fileinfo pointer
renderInfothe scene render info

Definition at line 1025 of file gerbv.c.

◆ gerbv_render_zoom_to_fit_display()

void gerbv_render_zoom_to_fit_display ( gerbv_project_t gerbvProject,
gerbv_render_info_t renderInfo 
)

Calculate the zoom and translations to fit the rendered scene inside the given scene size.

Parameters
gerbvProjectthe project to use for calculating
renderInfothe scene render pointer (updates the values in this parameter)
Examples
example6.c.

Definition at line 781 of file gerbv.c.

Referenced by gerbv_export_png_file_from_project_autoscaled(), and open_files().

◆ gerbv_rotate_coord()

void gerbv_rotate_coord ( double *  x,
double *  y,
double  rad 
)
inline

Rotate coordinate x and y buy angle in radians

Definition at line 1144 of file gerbv.c.

Referenced by gerbv_transform_coord().

◆ gerbv_transform_coord()

◆ gerbv_transform_coord_for_image()

int gerbv_transform_coord_for_image ( double *  x,
double *  y,
const gerbv_image_t image,
const gerbv_project_t project 
)

Transform coordinate x and y for image in project

Definition at line 1173 of file gerbv.c.

References gerbv_get_fileinfo_for_image(), gerbv_transform_coord(), and gerbv_fileinfo_t::transform.