Index: trunk/doc/TODO =================================================================== --- trunk/doc/TODO (revision 36601) +++ trunk/doc/TODO (revision 36602) @@ -14,7 +14,6 @@ + merge sch-rnd r4212 [report: Alain] - librnd 3.2.0+: use lib_exp_* and lib_imp_* - export_png, export_ps, export_svg - - remove import_pxm_* plugins in favor of librnd's import_pixmap_* - remove gd stuff from config.h.in - remove gd detection from scconfig - remove export_lpr/lpr_hid.[ch] in favor of librnd's Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 36601) +++ trunk/scconfig/Rev.h (revision 36602) @@ -1 +1 @@ -static const int myrev = 36562; +static const int myrev = 36602; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 36601) +++ trunk/scconfig/Rev.tab (revision 36602) @@ -1,3 +1,4 @@ +36602 configure remove local pixmap support in favor of librnd's 36562 configure font engine rewrite 36322 configure generalize export_lpr so it can be moved to librnd 36311 configure export dialog generalization so that the code can be moved for librnd Index: trunk/scconfig/plugins.h =================================================================== --- trunk/scconfig/plugins.h (revision 36601) +++ trunk/scconfig/plugins.h (revision 36602) @@ -82,8 +82,6 @@ plugin_def("import_orcad_net", "import Orcad netlist", sbuildin, 1) plugin_def("import_pads_net", "import PADS ascii netlist .asc", sbuildin, 1) plugin_def("import_protel_net","import Protel netlist 2.0", sbuildin, 1) -plugin_def("import_pxm_gd", "import pixmaps from png/gif/jpg", sbuildin, 1) -plugin_def("import_pxm_pnm", "import pixmaps from pnm ", sbuildin, 1) plugin_def("import_sch2", "import sch v2", sbuildin, 1) plugin_def("import_tinycad", "import tinycad .net", sbuildin, 1) plugin_def("import_ttf", "import ttf glyphs", sbuildin, 1) Index: trunk/src_plugins/import_pxm_pnm/Plug.tmpasm =================================================================== --- trunk/src_plugins/import_pxm_pnm/Plug.tmpasm (revision 36601) +++ trunk/src_plugins/import_pxm_pnm/Plug.tmpasm (nonexistent) @@ -1,8 +0,0 @@ -put /local/pcb/mod {import_pxm_pnm} -put /local/pcb/mod/OBJS [@ $(PLUGDIR)/import_pxm_pnm/import_pxm_pnm.o @] - -switch /local/pcb/import_pxm_pnm/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: trunk/src_plugins/import_pxm_pnm/import_pxm_pnm.c =================================================================== --- trunk/src_plugins/import_pxm_pnm/import_pxm_pnm.c (revision 36601) +++ trunk/src_plugins/import_pxm_pnm/import_pxm_pnm.c (nonexistent) @@ -1,183 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * - * pixmap loader for pnm - * pcb-rnd Copyright (C) 2019,2020 Tibor 'Igor2' Palinkas - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Contact: - * Project page: http://repo.hu/projects/pcb-rnd - * lead developer: http://repo.hu/projects/pcb-rnd/contact.html - * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") - */ - -#include "config.h" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -static const char *import_pxm_pnm_cookie = "import_pxm_pnm"; - -#define ADDPX(pxm, r_, g_, b_, not_transparent) \ -do { \ - int r = r_, g = g_, b = b_; \ - if ((r < 0) || (g < 0) || (b < 0)) \ - goto error; \ - if (not_transparent && (r == pxm->tr) && (g == pxm->tg) && (b == pxm->tb)) \ - b--; \ - *o++ = r; \ - *o++ = g; \ - *o++ = b; \ -} while(0) - -static void decode_comment(rnd_pixmap_t *pxm, char *comment) -{ - while(isspace(*comment)) comment++; - if (rnd_strncasecmp(comment, "transparent pixel:", 18) == 0) { - int r, g, b; - if (sscanf(comment+18, "%d %d %d", &r, &g, &b) == 3) { - if ((r >= 0) && (r <= 255) && (g >= 0) && (g <= 255) && (b >= 0) && (b <= 255)) { - pxm->tr = r; - pxm->tg = g; - pxm->tb = b; - pxm->has_transp = 1; - } - else - rnd_message(RND_MSG_ERROR, "pnm_load(): ignoring invalid transparent pixel: value out of range (%d %d %d)\n", r, g, b); - } - else - rnd_message(RND_MSG_ERROR, "pnm_load(): ignoring invalid transparent pixel: need 3 integers (got: %s)\n", comment+18); - } -} - -#define GETLINE \ -while(fgets(line, sizeof(line) - 1, f) != NULL) { \ - if (*line == '#') {\ - decode_comment(pxm, line+1); \ - continue; \ - } \ - break; \ -} - -static int pnm_load(rnd_hidlib_t *hidlib, rnd_pixmap_t *pxm, const char *fn) -{ - FILE *f; - char *s, line[1024]; - unsigned char *o; - int n, type; - - f = rnd_fopen(hidlib, fn, "rb"); - if (f == NULL) - return -1; - - pxm->tr = pxm->tg = 127; - pxm->tb = 128; - pxm->has_transp = 0; - - GETLINE; - if ((line[0] != 'P') || ((line[1] != '4') && (line[1] != '5') && (line[1] != '6')) || (line[2] != '\n')) { - fclose(f); - return -1; - } - type = line[1]; - - - GETLINE; - s = strchr(line, ' '); - if (s == NULL) { - fclose(f); - return -1; - } - *s = '\0'; - s++; - pxm->sx = atoi(line); - pxm->sy = atoi(s); - - if ((pxm->sx <= 0) || (pxm->sy <= 0) || (pxm->sx > 100000) || (pxm->sy > 100000)) { - fclose(f); - return -1; - } - - n = pxm->sx * pxm->sy; - pxm->size = n * 3; - o = pxm->p = malloc(pxm->size); - - switch(type) { - case '6': - GETLINE; - if (atoi(line) != 255) - goto error; - for(; n>0; n--) - ADDPX(pxm, fgetc(f), fgetc(f), fgetc(f), 0); - break; - case '5': - fgets(line, sizeof(line) - 1, f); - for(; n>0; n--) { - int px = fgetc(f); - ADDPX(pxm, px, px, px, 0); - } - break; - case '4': - for(;n>0;) { - int m, c, px; - c = fgetc(f); - for(m = 0; m < 8; m++) { - px = (c & 128) ? 0 : 255; - ADDPX(pxm, px, px, px, 0); - c <<= 1; - n--; - } - } - break; - } - fclose(f); - return 0; - - error:; - free(pxm->p); - pxm->p = NULL; - fclose(f); - return 0; -} - -static const rnd_pixmap_import_t pxm_pnm_imp = { - "pnm", - pnm_load -}; - -int pplg_check_ver_import_pxm_pnm(int ver_needed) { return 0; } - -void pplg_uninit_import_pxm_pnm(void) -{ - rnd_pixmap_unreg_import_all(import_pxm_pnm_cookie); -} - -int pplg_init_import_pxm_pnm(void) -{ - RND_API_CHK_VER; - rnd_pixmap_reg_import(&pxm_pnm_imp, import_pxm_pnm_cookie); - return 0; -} Index: trunk/src_plugins/import_pxm_pnm/import_pxm_pnm.pup =================================================================== --- trunk/src_plugins/import_pxm_pnm/import_pxm_pnm.pup (revision 36601) +++ trunk/src_plugins/import_pxm_pnm/import_pxm_pnm.pup (nonexistent) @@ -1,9 +0,0 @@ -$class import -$short import pixmaps from pnm -$long Import pnm P4, P5 and P6 into pcb-rnd pixmaps -$state works -$fmt-native no -$fmt-feature-r pnm (pixmap) -$package import-geo -default buildin -autoload 1 Index: trunk/src_plugins/import_pxm_pnm/Makefile =================================================================== --- trunk/src_plugins/import_pxm_pnm/Makefile (revision 36601) +++ trunk/src_plugins/import_pxm_pnm/Makefile (nonexistent) @@ -1,6 +0,0 @@ -all: - cd ../../src && $(MAKE) mod_import_pxm_pnm - -clean: - rm *.o *.so 2>/dev/null ; true - Index: trunk/src_plugins/import_pxm_gd/Plug.tmpasm =================================================================== --- trunk/src_plugins/import_pxm_gd/Plug.tmpasm (revision 36601) +++ trunk/src_plugins/import_pxm_gd/Plug.tmpasm (nonexistent) @@ -1,16 +0,0 @@ -put /local/pcb/mod {import_pxm_gd} -put /local/pcb/mod/OBJS [@ $(PLUGDIR)/import_pxm_gd/import_pxm_gd.o @] - -switch /local/pcb/import_pxm_gd/controls - case {disable} end; - default - put /local/pcb/mod/LDFLAGS libs/gui/gd/ldflags - put /local/pcb/mod/CFLAGS libs/gui/gd/cflags - end -end - -switch /local/pcb/import_pxm_gd/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: trunk/src_plugins/import_pxm_gd/import_pxm_gd.c =================================================================== --- trunk/src_plugins/import_pxm_gd/import_pxm_gd.c (revision 36601) +++ trunk/src_plugins/import_pxm_gd/import_pxm_gd.c (nonexistent) @@ -1,147 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * - * pixmap loader for pnm - * pcb-rnd Copyright (C) 2019 Tibor 'Igor2' Palinkas - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Contact: - * Project page: http://repo.hu/projects/pcb-rnd - * lead developer: http://repo.hu/projects/pcb-rnd/contact.html - * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") - */ - -#include "config.h" - -#include -#include -#include -#include - -#include -#include -#include - -static const char *import_pxm_gd_cookie = "import_pxm_gd"; - -static int gd_load(rnd_hidlib_t *hidlib, rnd_pixmap_t *pxm, const char *fn, gdImagePtr (*loader)(FILE *f)) -{ - int x, y; - gdImagePtr gdi; - FILE *f; - - f = rnd_fopen(hidlib, fn, "rb"); - if (f == NULL) - return -1; - gdi = loader(f); - if (gdi != NULL) { - unsigned char *p; - int r, g, b, a; - pxm->sx = gdi->sx; - pxm->sy = gdi->sy; - pxm->tr = pxm->tg = 127; - pxm->tb = 128; - pxm->size = pxm->sx * pxm->sy * 3; - pxm->has_transp = 0; - p = pxm->p = malloc(pxm->size); - for(y = 0; y < pxm->sy; y++) { - for(x = 0; x < pxm->sx; x++) { - int pix = gdImageGetPixel(gdi, x, y); - r = gdImageRed(gdi, pix); - g = gdImageGreen(gdi, pix); - b = gdImageBlue(gdi, pix); - a = gdImageAlpha(gdi, pix); - - if (a == 0) { - if ((r == pxm->tr) && (g == pxm->tg) && (b == pxm->tb)) - b--; - *p++ = r; - *p++ = g; - *p++ = b; - } - else { - *p++ = pxm->tr; - *p++ = pxm->tg; - *p++ = pxm->tb; - pxm->has_transp = 1; - } - } - } - } - fclose(f); - return (gdi == NULL); -} - -#ifdef PCB_HAVE_GDIMAGEPNG -static int gd_png_load(rnd_hidlib_t *hidlib, rnd_pixmap_t *pxm, const char *fn) -{ - return gd_load(hidlib, pxm, fn, gdImageCreateFromPng); -} - -static const rnd_pixmap_import_t pxm_gd_png_imp = { - "png (gd)", - gd_png_load -}; -#endif - -#ifdef PCB_HAVE_GDIMAGEJPEG -static int gd_jpg_load(rnd_hidlib_t *hidlib, rnd_pixmap_t *pxm, const char *fn) -{ - return gd_load(hidlib, pxm, fn, gdImageCreateFromJpeg); -} - -static const rnd_pixmap_import_t pxm_gd_jpg_imp = { - "jpg (gd)", - gd_jpg_load -}; -#endif - -#ifdef PCB_HAVE_GDIMAGEGIF -static int gd_gif_load(rnd_hidlib_t *hidlib, rnd_pixmap_t *pxm, const char *fn) -{ - return gd_load(hidlib, pxm, fn, gdImageCreateFromGif); -} - -static const rnd_pixmap_import_t pxm_gd_gif_imp = { - "gif (gd)", - gd_gif_load -}; -#endif - -int pplg_check_ver_import_pxm_gd(int ver_needed) { return 0; } - -void pplg_uninit_import_pxm_gd(void) -{ - rnd_pixmap_unreg_import_all(import_pxm_gd_cookie); -} - -int pplg_init_import_pxm_gd(void) -{ - RND_API_CHK_VER; - -#ifdef PCB_HAVE_GDIMAGEPNG - rnd_pixmap_reg_import(&pxm_gd_png_imp, import_pxm_gd_cookie); -#endif -#ifdef PCB_HAVE_GDIMAGEJPEG - rnd_pixmap_reg_import(&pxm_gd_jpg_imp, import_pxm_gd_cookie); -#endif -#ifdef PCB_HAVE_GDIMAGEGIF - rnd_pixmap_reg_import(&pxm_gd_gif_imp, import_pxm_gd_cookie); -#endif - return 0; -} Index: trunk/src_plugins/import_pxm_gd/import_pxm_gd.pup =================================================================== --- trunk/src_plugins/import_pxm_gd/import_pxm_gd.pup (revision 36601) +++ trunk/src_plugins/import_pxm_gd/import_pxm_gd.pup (nonexistent) @@ -1,9 +0,0 @@ -$class import -$short import pixmaps from png/gif/jpg -$long Import png, gif and jpeg using libgd -$state works -$fmt-native no -$fmt-feature-r pixmap (e.g. png) -$package import-geo -default buildin -autoload 1 Index: trunk/src_plugins/import_pxm_gd/Makefile =================================================================== --- trunk/src_plugins/import_pxm_gd/Makefile (revision 36601) +++ trunk/src_plugins/import_pxm_gd/Makefile (nonexistent) @@ -1,6 +0,0 @@ -all: - cd ../../src && $(MAKE) mod_import_pxm_gd - -clean: - rm *.o *.so 2>/dev/null ; true - Index: trunk/src_plugins/plugins_ALL.tmpasm =================================================================== --- trunk/src_plugins/plugins_ALL.tmpasm (revision 36601) +++ trunk/src_plugins/plugins_ALL.tmpasm (revision 36602) @@ -65,8 +65,6 @@ include {../src_plugins/import_orcad_net/Plug.tmpasm} include {../src_plugins/import_pads_net/Plug.tmpasm} include {../src_plugins/import_protel_net/Plug.tmpasm} -include {../src_plugins/import_pxm_gd/Plug.tmpasm} -include {../src_plugins/import_pxm_pnm/Plug.tmpasm} include {../src_plugins/import_sch2/Plug.tmpasm} include {../src_plugins/import_tinycad/Plug.tmpasm} include {../src_plugins/import_ttf/Plug.tmpasm}