Stephan Boettcher <boettc...@physik.uni-kiel.de> writes:

> And the project file format shall be extended to include the alpha
> setting.  Maybe that's a patch I could work out.

Here it is, but not on top of gtk3

  git://git.psjt.org/gerbv


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;


-- 
Gruß,
Stephan

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
Gerbv-devel mailing list
Gerbv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gerbv-devel

Reply via email to