Index: trunk/src/plugins/io_easyeda/read_hi_pro_draw.c =================================================================== --- trunk/src/plugins/io_easyeda/read_hi_pro_draw.c (revision 10714) +++ trunk/src/plugins/io_easyeda/read_hi_pro_draw.c (revision 10715) @@ -649,16 +649,17 @@ } /* "OBJ","e674","",494,43,155,30,0,0,"data:image/svg+xml;base64,PD94b...==",0 - kw id ? x y w h ? ? image ? */ -static int easypro_parse_obj(read_ctx_t *ctx, gdom_node_t *obj, csch_cgrp_t *parent) + kw id ? x y w h ? ? image ? + spotted in version 1.1 files */ +static int easypro_parse_obj_1_1(read_ctx_t *ctx, gdom_node_t *obj, csch_cgrp_t *parent) { double x, y, w, h; - REQ_ARGC_GTE(obj, 11, "easypro_parse_obj", return -1); - GET_ARG_DBL(x, obj, 3, "easypro_parse_obj: coord x", return -1); - GET_ARG_DBL(y, obj, 4, "easypro_parse_obj: coord x", return -1); - GET_ARG_DBL(w, obj, 5, "easypro_parse_obj: coord x", return -1); - GET_ARG_DBL(h, obj, 6, "easypro_parse_obj: coord x", return -1); + REQ_ARGC_GTE(obj, 11, "easypro_parse_obj (1.1)", return -1); + GET_ARG_DBL(x, obj, 3, "easypro_parse_obj (1.1): coord x", return -1); + GET_ARG_DBL(y, obj, 4, "easypro_parse_obj (1.1): coord y", return -1); + GET_ARG_DBL(w, obj, 5, "easypro_parse_obj (1.1): coord w", return -1); + GET_ARG_DBL(h, obj, 6, "easypro_parse_obj (1.1): coord h", return -1); easyeda_mkimage_sym(ctx, parent, obj, x, y-h, w, h); @@ -665,6 +666,40 @@ return 0; } +/* "OBJ","e367","","image/svg+xml;base64",620,70,300,61,0,"PD94b...",0 + kw id ? data_type x y w h ? image ? + spotted in version 1.0 files */ +static int easypro_parse_obj_1_0(read_ctx_t *ctx, gdom_node_t *obj, csch_cgrp_t *parent) +{ + double x, y, w, h; + + REQ_ARGC_GTE(obj, 11, "easypro_parse_obj (1.0)", return -1); + GET_ARG_DBL(x, obj, 4, "easypro_parse_obj (1.0): coord x", return -1); + GET_ARG_DBL(y, obj, 5, "easypro_parse_obj (1.0): coord y", return -1); + GET_ARG_DBL(w, obj, 6, "easypro_parse_obj (1.0): coord w", return -1); + GET_ARG_DBL(h, obj, 7, "easypro_parse_obj (1.0): coord h", return -1); + + easyeda_mkimage_sym(ctx, parent, obj, x, y-h, w, h); + + return 0; +} + +/* There seem to be two different OBJ variants; detect and dispatch */ +static int easypro_parse_obj(read_ctx_t *ctx, gdom_node_t *obj, csch_cgrp_t *parent) +{ + REQ_ARGC_GTE(obj, 4, "easypro_parse_obj", return -1); + + if (obj->value.array.child[3]->type == GDOM_DOUBLE) + return easypro_parse_obj_1_1(ctx, obj, parent); + + if (obj->value.array.child[3]->type == GDOM_STRING) + return easypro_parse_obj_1_0(ctx, obj, parent); + + error_at(ctx, obj, ("easypro_parse_obj: unrecognized OBJ format\n")); + return -1; +} + + /* "LINESTYLE","st12",null,null,"#99CCFF",null kw name ? ? fill ? */ static int easypro_parse_linestyle(read_ctx_t *ctx, gdom_node_t *obj, csch_cgrp_t *parent)