pcb 4.1.1
An interactive printed circuit board layout editor.
|
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <time.h>
#include "global.h"
#include "error.h"
#include "data.h"
#include "misc.h"
#include "rats.h"
#include "hid.h"
#include "hid_draw.h"
#include "../hidint.h"
#include "hid/common/hidnogui.h"
#include "hid/common/draw_helpers.h"
#include <gd.h>
#include "hid/common/hidinit.h"
Go to the source code of this file.
Data Structures | |
struct | color_struct |
struct | hid_gc_struct |
Defines | |
#define | CRASH fprintf(stderr, "HID error: pcb called unimplemented PNG function %s.\n", __FUNCTION__); abort() |
Functions | |
REGISTER_ATTRIBUTES (nelma_attribute_list) | |
static char * | nelma_get_png_name (const char *basename, const char *suffix) |
static int | pin_name_to_xy (LibraryEntryType *pin, Coord *x, Coord *y) |
static void | nelma_write_space (FILE *out) |
static void | nelma_write_material (FILE *out, char *name, char *type, double e) |
static void | nelma_write_materials (FILE *out) |
static void | nelma_write_nets (FILE *out) |
static void | nelma_write_layer (FILE *out, int z, int h, const char *name, int full, char *mat) |
static void | nelma_write_layers (FILE *out) |
static void | nelma_write_object (FILE *out, LibraryEntryType *pin) |
static void | nelma_write_objects (FILE *out) |
static void | nelma_parse_arguments (int *argc, char ***argv) |
static HID_Attribute * | nelma_get_export_options (int *n) |
void | nelma_choose_groups () |
static void | nelma_alloc_colors () |
static void | nelma_start_png (const char *basename, const char *suffix) |
static void | nelma_finish_png () |
void | nelma_start_png_export () |
static void | nelma_do_export (HID_Attr_Val *options) |
static int | nelma_set_layer (const char *name, int group, int empty) |
static hidGC | nelma_make_gc (void) |
static void | nelma_destroy_gc (hidGC gc) |
static void | nelma_use_mask (enum mask_mode mode) |
static void | nelma_set_color (hidGC gc, const char *name) |
static void | nelma_set_line_cap (hidGC gc, EndCapStyle style) |
static void | nelma_set_line_width (hidGC gc, Coord width) |
static void | nelma_set_draw_xor (hidGC gc, int xor_) |
static void | nelma_set_draw_faded (hidGC gc, int faded) |
static void | use_gc (hidGC gc) |
static void | nelma_draw_rect (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) |
static void | nelma_fill_rect (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) |
static void | nelma_draw_line (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) |
static void | nelma_draw_arc (hidGC gc, Coord cx, Coord cy, Coord width, Coord height, Angle start_angle, Angle delta_angle) |
static void | nelma_fill_circle (hidGC gc, Coord cx, Coord cy, Coord radius) |
static void | nelma_fill_polygon (hidGC gc, int n_coords, Coord *x, Coord *y) |
static void | nelma_calibrate (double xval, double yval) |
static void | nelma_set_crosshair (int x, int y, int a) |
void | hid_nelma_init () |
Variables | |
static HID | nelma_hid |
static HID_DRAW | nelma_graphics |
static struct color_struct * | black = NULL |
static struct color_struct * | white = NULL |
static Coord | linewidth = -1 |
static gdImagePtr | lastbrush = (gdImagePtr)((void *) -1) |
static gdImagePtr | nelma_im = NULL |
static FILE * | nelma_f = NULL |
static int | is_mask |
static int | is_drill |
static int | nelma_export_group [MAX_GROUP] |
static int | nelma_cur_group |
static const char * | nelma_basename = NULL |
static int | nelma_dpi = -1 |
static int | nelma_copperh = -1 |
static int | nelma_substrateh = -1 |
static double | nelma_substratee = -1 |
static const double | nelma_air_epsilon = 8.85e-12 |
HID_Attribute | nelma_attribute_list [] |
#define CRASH fprintf(stderr, "HID error: pcb called unimplemented PNG function %s.\n", __FUNCTION__); abort() |
Definition at line 86 of file nelma.c.
Referenced by nelma_calibrate().
void hid_nelma_init | ( | ) |
Definition at line 1038 of file nelma.c.
References hid_st::calibrate, common_draw_helpers_init(), common_nogui_init(), hid_st::description, hid_draw_st::destroy_gc, hid_st::do_export, hid_draw_st::draw_arc, hid_draw_st::draw_line, hid_draw_st::draw_rect, hid_st::exporter, hid_draw_st::fill_circle, hid_draw_st::fill_polygon, hid_draw_st::fill_rect, hid_st::get_export_options, hid_st::graphics, hid_register_hid(), hid_draw_st::make_gc, hid_st::name, nelma_calibrate(), nelma_destroy_gc(), nelma_do_export(), nelma_draw_arc(), nelma_draw_line(), nelma_draw_rect(), nelma_fill_circle(), nelma_fill_polygon(), nelma_fill_rect(), nelma_get_export_options(), nelma_graphics, nelma_make_gc(), nelma_parse_arguments(), nelma_set_color(), nelma_set_crosshair(), nelma_set_draw_faded(), nelma_set_draw_xor(), nelma_set_layer(), nelma_set_line_cap(), nelma_set_line_width(), nelma_use_mask(), hid_st::parse_arguments, hid_st::poly_before, hid_draw_st::set_color, hid_st::set_crosshair, hid_draw_st::set_draw_faded, hid_draw_st::set_draw_xor, hid_st::set_layer, hid_draw_st::set_line_cap, hid_draw_st::set_line_width, hid_st::struct_size, and hid_draw_st::use_mask.
static void nelma_alloc_colors | ( | ) | [static] |
Definition at line 581 of file nelma.c.
References color_struct::b, color_struct::c, color_struct::g, malloc(), color_struct::r, and white.
Referenced by nelma_start_png().
static void nelma_calibrate | ( | double | xval, |
double | yval | ||
) | [static] |
void nelma_choose_groups | ( | ) |
Definition at line 549 of file nelma.c.
References LayerType::ArcN, PCBType::Data, GetLayerGroupNumberByNumber(), DataType::Layer, layer, LayerType::LineN, m, max_copper_layer, n, PCB, LayerType::PolygonN, SL_TYPE, and LayerType::TextN.
Referenced by nelma_do_export().
static void nelma_destroy_gc | ( | hidGC | gc | ) | [static] |
Definition at line 775 of file nelma.c.
Referenced by hid_nelma_init().
static void nelma_do_export | ( | HID_Attr_Val * | options | ) | [static] |
Definition at line 654 of file nelma.c.
References HID_Attribute::default_val, LayerGroupType::Entries, FNS_fixed, hid_restore_layer_ons(), hid_save_and_show_layer_ons(), HID_Attr_Val::int_value, layer_type_to_file_name(), PCBType::LayerGroups, len, malloc(), MAX_ALL_LAYER, max_group, nelma_choose_groups(), nelma_finish_png(), nelma_get_export_options(), nelma_start_png(), nelma_start_png_export(), nelma_write_layers(), nelma_write_materials(), nelma_write_nets(), nelma_write_objects(), nelma_write_space(), PCB, HID_Attr_Val::real_value, and HID_Attr_Val::str_value.
Referenced by hid_nelma_init().
static void nelma_draw_arc | ( | hidGC | gc, |
Coord | cx, | ||
Coord | cy, | ||
Coord | width, | ||
Coord | height, | ||
Angle | start_angle, | ||
Angle | delta_angle | ||
) | [static] |
Definition at line 948 of file nelma.c.
References color_struct::c, hid_gc_struct::color, im, linewidth, NormalizeAngle(), SCALE, SCALE_X, SCALE_Y, start_angle, and use_gc().
Referenced by hid_nelma_init().
Definition at line 932 of file nelma.c.
References linewidth, nelma_fill_rect(), use_gc(), and hid_gc_struct::width.
Referenced by hid_nelma_init().
Definition at line 913 of file nelma.c.
References color_struct::c, hid_gc_struct::color, and use_gc().
Referenced by hid_nelma_init().
Definition at line 989 of file nelma.c.
References color_struct::c, hid_gc_struct::color, linewidth, and use_gc().
Referenced by hid_nelma_init().
Definition at line 1001 of file nelma.c.
References color_struct::c, hid_gc_struct::color, linewidth, malloc(), and use_gc().
Referenced by hid_nelma_init().
Definition at line 922 of file nelma.c.
References color_struct::c, hid_gc_struct::color, linewidth, and use_gc().
Referenced by hid_nelma_init(), and nelma_draw_line().
static void nelma_finish_png | ( | ) | [static] |
Definition at line 620 of file nelma.c.
References Message(), and white.
Referenced by nelma_do_export().
static HID_Attribute* nelma_get_export_options | ( | int * | n | ) | [static] |
Definition at line 531 of file nelma.c.
References derive_default_filename(), PCBType::Filename, nelma_attribute_list, and PCB.
Referenced by hid_nelma_init(), and nelma_do_export().
static char* nelma_get_png_name | ( | const char * | basename, |
const char * | suffix | ||
) | [static] |
Definition at line 225 of file nelma.c.
Referenced by nelma_start_png(), and nelma_write_object().
static hidGC nelma_make_gc | ( | void | ) | [static] |
Definition at line 762 of file nelma.c.
References color_struct::b, color_struct::c, hid_gc_struct::cap, hid_gc_struct::color, color_struct::g, malloc(), hid_gc_struct::me_pointer, nelma_hid, color_struct::r, Trace_Cap, and hid_gc_struct::width.
Referenced by hid_nelma_init().
static void nelma_parse_arguments | ( | int * | argc, |
char *** | argv | ||
) | [static] |
Definition at line 522 of file nelma.c.
References hid_parse_command_line(), and hid_register_attributes().
Referenced by hid_nelma_init().
static void nelma_set_color | ( | hidGC | gc, |
const char * | name | ||
) | [static] |
Definition at line 787 of file nelma.c.
References black, hid_gc_struct::color, hid_gc_struct::erase, and white.
Referenced by hid_nelma_init().
static void nelma_set_crosshair | ( | int | x, |
int | y, | ||
int | a | ||
) | [static] |
Definition at line 1029 of file nelma.c.
Referenced by hid_nelma_init().
static void nelma_set_draw_faded | ( | hidGC | gc, |
int | faded | ||
) | [static] |
Definition at line 830 of file nelma.c.
Referenced by hid_nelma_init().
static void nelma_set_draw_xor | ( | hidGC | gc, |
int | xor_ | ||
) | [static] |
Definition at line 824 of file nelma.c.
Referenced by hid_nelma_init().
static int nelma_set_layer | ( | const char * | name, |
int | group, | ||
int | empty | ||
) | [static] |
Definition at line 730 of file nelma.c.
References PCBType::Data, LayerGroupType::Entries, DataType::Layer, PCBType::LayerGroups, max_group, LayerType::Name, PCB, SL_MASK, SL_PDRILL, SL_TYPE, and SL_UDRILL.
Referenced by hid_nelma_init().
static void nelma_set_line_cap | ( | hidGC | gc, |
EndCapStyle | style | ||
) | [static] |
Definition at line 812 of file nelma.c.
References hid_gc_struct::cap, and style.
Referenced by hid_nelma_init().
Definition at line 818 of file nelma.c.
References hid_gc_struct::width.
Referenced by hid_nelma_init().
static void nelma_start_png | ( | const char * | basename, |
const char * | suffix | ||
) | [static] |
Definition at line 598 of file nelma.c.
References PCBType::MaxHeight, PCBType::MaxWidth, nelma_alloc_colors(), nelma_get_png_name(), and PCB.
Referenced by nelma_do_export().
void nelma_start_png_export | ( | ) |
Definition at line 638 of file nelma.c.
References hid_expose_callback(), lastbrush, linewidth, PCBType::MaxHeight, PCBType::MaxWidth, PCB, region, BoxType::X1, BoxType::X2, BoxType::Y1, and BoxType::Y2.
Referenced by nelma_do_export().
static void nelma_use_mask | ( | enum mask_mode | mode | ) | [static] |
Definition at line 781 of file nelma.c.
Referenced by hid_nelma_init().
static void nelma_write_layer | ( | FILE * | out, |
int | z, | ||
int | h, | ||
const char * | name, | ||
int | full, | ||
char * | mat | ||
) | [static] |
Definition at line 373 of file nelma.c.
References LibraryMenuType::Entry, LibraryMenuType::EntryN, LibraryEntryType::ListEntry, m, LibraryType::Menu, LibraryType::MenuN, n, PCBType::NetlistLib, PCB, and pin.
Referenced by nelma_write_layers().
static void nelma_write_layers | ( | FILE * | out | ) | [static] |
Definition at line 411 of file nelma.c.
References LayerGroupType::Entries, FNS_fixed, layer_type_to_file_name(), PCBType::LayerGroups, max_group, nelma_copperh, nelma_write_layer(), and PCB.
Referenced by nelma_do_export().
static void nelma_write_material | ( | FILE * | out, |
char * | name, | ||
char * | type, | ||
double | e | ||
) | [static] |
Definition at line 304 of file nelma.c.
Referenced by nelma_write_materials().
static void nelma_write_materials | ( | FILE * | out | ) | [static] |
Definition at line 315 of file nelma.c.
References nelma_write_material().
Referenced by nelma_do_export().
static void nelma_write_nets | ( | FILE * | out | ) | [static] |
Definition at line 326 of file nelma.c.
References LayerGroupType::Entries, LibraryMenuType::Entry, LibraryMenuType::EntryN, FNS_fixed, layer_type_to_file_name(), PCBType::LayerGroups, LibraryEntryType::ListEntry, m, max_group, LibraryType::Menu, LibraryType::MenuN, n, LibraryMenuType::Name, PCBType::NetlistLib, PCB, and pin.
Referenced by nelma_do_export().
static void nelma_write_object | ( | FILE * | out, |
LibraryEntryType * | pin | ||
) | [static] |
Definition at line 458 of file nelma.c.
References LayerGroupType::Entries, f, FNS_fixed, layer_type_to_file_name(), PCBType::LayerGroups, LibraryEntryType::ListEntry, max_group, nelma_get_png_name(), PCB, pin_name_to_xy(), px, py, x, and y.
Referenced by nelma_write_objects().
static void nelma_write_objects | ( | FILE * | out | ) | [static] |
Definition at line 496 of file nelma.c.
References LibraryMenuType::Entry, LibraryMenuType::EntryN, m, LibraryType::Menu, LibraryType::MenuN, n, nelma_write_object(), PCBType::NetlistLib, PCB, and pin.
Referenced by nelma_do_export().
static void nelma_write_space | ( | FILE * | out | ) | [static] |
Definition at line 262 of file nelma.c.
References LayerGroupType::Entries, FNS_fixed, layer_type_to_file_name(), PCBType::LayerGroups, max_group, and PCB.
Referenced by nelma_do_export().
static int pin_name_to_xy | ( | LibraryEntryType * | pin, |
Coord * | x, | ||
Coord * | y | ||
) | [static] |
Definition at line 241 of file nelma.c.
References ConnectionType::ptr2, SeekPad(), ConnectionType::type, X, and Y.
Referenced by nelma_write_object().
REGISTER_ATTRIBUTES | ( | nelma_attribute_list | ) |
Definition at line 213 of file nelma.c.
References COORD_TO_INCH, and nelma_dpi.
static void use_gc | ( | hidGC | gc | ) | [static] |
Definition at line 835 of file nelma.c.
References color_struct::b, hid_gc_struct::brush, hid_gc_struct::cap, hid_gc_struct::color, color_struct::g, hid_cache_color(), lastbrush, linewidth, hid_gc_struct::me_pointer, hidval::ptr, color_struct::r, Round_Cap, Square_Cap, Trace_Cap, and hid_gc_struct::width.
Referenced by nelma_draw_arc(), nelma_draw_line(), nelma_draw_rect(), nelma_fill_circle(), nelma_fill_polygon(), and nelma_fill_rect().
struct color_struct* black = NULL [static] |
Definition at line 111 of file nelma.c.
Referenced by nelma_set_color().
gdImagePtr lastbrush = (gdImagePtr)((void *) -1) [static] |
Definition at line 113 of file nelma.c.
Referenced by nelma_start_png_export(), and use_gc().
Definition at line 112 of file nelma.c.
Referenced by nelma_draw_arc(), nelma_draw_line(), nelma_fill_circle(), nelma_fill_polygon(), nelma_fill_rect(), nelma_start_png_export(), and use_gc().
const double nelma_air_epsilon = 8.85e-12 [static] |
{ {"basename", "File name prefix", HID_String, 0, 0, {0, 0, 0}, 0, 0}, #define HA_basename 0 {"dpi", "Horizontal scale factor (grid points/inch)", HID_Integer, 0, 1000, {100, 0, 0}, 0, 0}, #define HA_dpi 1 {"copper-height", "Copper layer height (um)", HID_Integer, 0, 200, {100, 0, 0}, 0, 0}, #define HA_copperh 2 {"substrate-height", "Substrate layer height (um)", HID_Integer, 0, 10000, {2000, 0, 0}, 0, 0}, #define HA_substrateh 3 {"substrate-epsilon", "Substrate relative epsilon", HID_Real, 0, 100, {0, 0, 4.0}, 0, 0}, #define HA_substratee 4 }
Definition at line 152 of file nelma.c.
Referenced by nelma_get_export_options().
const char* nelma_basename = NULL [static] |
int nelma_copperh = -1 [static] |
Definition at line 143 of file nelma.c.
Referenced by nelma_write_layers().
int nelma_cur_group [static] |
int nelma_dpi = -1 [static] |
Definition at line 135 of file nelma.c.
Referenced by REGISTER_ATTRIBUTES().
int nelma_export_group[MAX_GROUP] [static] |
HID_DRAW nelma_graphics [static] |
Definition at line 109 of file nelma.c.
Referenced by hid_nelma_init().
Definition at line 108 of file nelma.c.
Referenced by nelma_make_gc().
double nelma_substratee = -1 [static] |
int nelma_substrateh = -1 [static] |
struct color_struct * white = NULL |