From 24cf0fb1d6e2f7467fa3de0f0b7152ee4712d221 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 27 Aug 2002 02:03:34 +0000
Subject: [PATCH] check if colortable has some alpha components

---
 Common/ColorTable.cpp | 11 +++++++++--
 Common/ColorTable.h   |  5 +++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/Common/ColorTable.cpp b/Common/ColorTable.cpp
index c259027a3e..1584c9c8fe 100644
--- a/Common/ColorTable.cpp
+++ b/Common/ColorTable.cpp
@@ -1,4 +1,4 @@
-// $Id: ColorTable.cpp,v 1.11 2002-05-20 18:28:24 geuzaine Exp $
+// $Id: ColorTable.cpp,v 1.12 2002-08-27 02:03:34 geuzaine Exp $
 //
 // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle
 //
@@ -264,4 +264,11 @@ void ColorTable_Print(GmshColorTable *ct, FILE *fp){
 
 }
 
-
+int ColorTable_IsAlpha(GmshColorTable *ct){
+  int i, a;
+  for (i=0;i<ct->size;i++) {
+    a = UNPACK_ALPHA( ct->table[i] );
+    if(a<255) return 1;
+  }
+  return 0;
+}
diff --git a/Common/ColorTable.h b/Common/ColorTable.h
index 4f94c0683f..ccc22ea7ec 100644
--- a/Common/ColorTable.h
+++ b/Common/ColorTable.h
@@ -48,8 +48,8 @@ typedef struct{
 
 // float parameters indices
 
-#define COLORTABLE_CURVE     0  // curvature */
-#define COLORTABLE_BIAS      1  // offset */
+#define COLORTABLE_CURVE     0  // curvature
+#define COLORTABLE_BIAS      1  // offset
 #define COLORTABLE_ALPHAPOW  2  // alpha channel power
 #define COLORTABLE_ALPHAVAL  3  // alpha channel value
 #define COLORTABLE_BETA      4  // beta coeff for brighten
@@ -59,5 +59,6 @@ void ColorTable_Recompute (GmshColorTable * ct, int rgb_flag, int alpha_flag);
 void ColorTable_Copy(GmshColorTable *ct);
 void ColorTable_Paste(GmshColorTable *ct);
 void ColorTable_Print(GmshColorTable *ct, FILE *fp) ;
+int  ColorTable_IsAlpha(GmshColorTable *ct) ;
 
 #endif
-- 
GitLab