scx31...@yahoo.com writes:

> I want add support for assigning layer type to layers, as example: 
> "gtl,gts,bmp,grb,drl,png" ,
> default colors for different type of layers, and other minor changes.
> Basically i need this for supporing merging projects, and further i want 
> having config file for merging,
> in order to recreate it with little different gerbers. 

Please add the alpha channel to the color :-)
Thanks,
Stephan

diff --git a/src/main.c b/src/main.c
index 10e9c66..84cd524 100644
--- a/src/main.c
+++ b/src/main.c
@@ -219,6 +219,7 @@ main_open_project_from_filename(gerbv_project_t *gerbvProject, gchar *filename)
 							* Change color from default to from the project list
 							*/
 							gerbvProject->file[fileIndex]->color = colorTemplate;
+							gerbvProject->file[fileIndex]->alpha = project_list->rgb[3];
 							gerbvProject->file[fileIndex]->transform.inverted = project_list->inverted;
 							gerbvProject->file[fileIndex]->isVisible = project_list->visible;
 						}
@@ -260,6 +261,7 @@ main_save_project_from_filename(gerbv_project_t *gerbvProject, gchar *filename)
     project_list->rgb[0] = gerbvProject->background.red;
     project_list->rgb[1] = gerbvProject->background.green;
     project_list->rgb[2] = gerbvProject->background.blue;
+    project_list->rgb[3] = 0;
     project_list->next = NULL;
     
     /* loop over all layer files */
@@ -282,6 +284,7 @@ main_save_project_from_filename(gerbv_project_t *gerbvProject, gchar *filename)
 	    tmp->rgb[0] = gerbvProject->file[idx]->color.red;
 	    tmp->rgb[1] = gerbvProject->file[idx]->color.green;
 	    tmp->rgb[2] = gerbvProject->file[idx]->color.blue;
+	    tmp->rgb[3] = gerbvProject->file[idx]->alpha;
 	    tmp->inverted = gerbvProject->file[idx]->transform.inverted;
 	    tmp->visible = gerbvProject->file[idx]->isVisible;
 
diff --git a/src/project.c b/src/project.c
index 3cde5b4..73c2e9f 100644
--- a/src/project.c
+++ b/src/project.c
@@ -250,18 +250,21 @@ static void
 get_color(scheme *sc, pointer value, int *color)
 {
     int i;
+    int l;
     pointer elem;
 
     if (!sc->vptr->is_vector(value)) {
 	GERB_MESSAGE("Color parameter not a vector\n");
 	return;
     }
-    if (sc->vptr->vector_length(value) != 3) {
+    l = sc->vptr->vector_length(value);
+    if (l != 3 && l != 4) {
 	GERB_MESSAGE("Color vector of incorrect length\n");
 	return;
     }
-    
-    for (i = 0; i < 3; i++) {
+
+    color[3] = 45312;
+    for (i = 0; i < l; i++) {
 	elem = sc->vptr->vector_elem(value, i);
 	if (sc->vptr->is_integer(elem) && sc->vptr->is_number(elem))
 	    color[i] = sc->vptr->ivalue(elem);
@@ -933,7 +936,7 @@ write_project_file(gerbv_project_t *gerbvProject, char const* filename, project_
 	else
 	    fprintf(fd, "(cons 'visible #f)");
 
-	fprintf(fd, "(cons 'color #(%d %d %d))", p->rgb[0], p->rgb[1],	p->rgb[2]);
+	fprintf(fd, "(cons 'color #(%d %d %d %d))", p->rgb[0], p->rgb[1], p->rgb[2], p->rgb[3]);
 
 	/* now write out the attribute list which specifies the
 	 * file format 
diff --git a/src/project.h b/src/project.h
index cfe9f9b..97570df 100644
--- a/src/project.h
+++ b/src/project.h
@@ -33,7 +33,7 @@
 typedef struct project_list_t {
     int layerno;
     char *filename;
-    int rgb[3];
+    int rgb[4];
     char inverted;
     char is_pnp;
     char visible;
-- 
Stephan Böttcher Tel: +49-431-880-2508
Extraterrestrische Physik, IEAP, Leibnizstr. 11, 24118 Kiel
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Gerbv-devel mailing list
Gerbv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gerbv-devel

Reply via email to