Index: trunk/src/thermal.c =================================================================== --- trunk/src/thermal.c (revision 35675) +++ trunk/src/thermal.c (revision 35676) @@ -132,7 +132,33 @@ *end++ = '\0'; } +int pcb_thermal_chars2bits(pcb_thermal_t *dst, const char *src) +{ + pcb_thermal_t res = 0; + if (src[0] == '\0') { + *dst = 0; + return 0; + } + + switch(src[0]) { + case 'n': res |= PCB_THERMAL_NOSHAPE; goto skip_diag; + case 'o': res |= PCB_THERMAL_ROUND; break; + case 'x': res |= PCB_THERMAL_SHARP; break; + case '@': res |= PCB_THERMAL_SOLID; goto skip_diag; + default: return -1; + } + + if (src[1] == 'd') + res |= PCB_THERMAL_DIAGONAL; + else if (src[1] != '\0') + return -1; + + skip_diag:; + *dst = res | PCB_THERMAL_ON; + return 0; +} + /* generate a round-cap line polygon */ static rnd_polyarea_t *pa_line_at(double x1, double y1, double x2, double y2, rnd_coord_t clr, rnd_bool square) { Index: trunk/src/thermal.h =================================================================== --- trunk/src/thermal.h (revision 35675) +++ trunk/src/thermal.h (revision 35676) @@ -58,10 +58,13 @@ - empty if there is no thermal - starts with n, o, x or @ for no-shape, round, sharp or solid - ends in d if diagonal + chars2bits() is the inverse transformation; returns 0 on success */ void pcb_thermal_bits2chars(char dst[3], pcb_thermal_t bits); +int pcb_thermal_chars2bits(pcb_thermal_t *dst, const char *src); + rnd_polyarea_t *pcb_thermal_area(pcb_board_t *p, pcb_any_obj_t *obj, rnd_layer_id_t lid, pcb_poly_t *in_poly); rnd_polyarea_t *pcb_thermal_area_line(pcb_board_t *pcb, pcb_line_t *line, rnd_layer_id_t lid, pcb_poly_t *in_poly); rnd_polyarea_t *pcb_thermal_area_poly(pcb_board_t *pcb, pcb_poly_t *poly, rnd_layer_id_t lid, pcb_poly_t *in_poly);