bluebanana fixes and enhancements
[goodguy/history.git] / cinelerra-5.1 / plugins / bluebanana / bluebananacolor.c
index 0de216de661580925b992bb469c7782188d7af13..f770d878775053e2f266952d73091abefdada7d4 100644 (file)
@@ -225,6 +225,21 @@ static inline void RGB_to_rgb8(float *R, float *G, float *B, float *S, float F,
   }
 }
 
+static inline void Aal_to_alp8(float *S, float F, unsigned char *row, int w, int bpp){
+  if(S){
+    while(w--){
+      float a = *S*F*255.f +.5f;
+      row[3] = CLAMP(a,0,255);
+      row+=bpp;  ++S;
+    }
+  }else{
+    float a = F*255.f +.5f;
+    unsigned char s = CLAMP(a,0,255);
+    while(w--){ row[3] = s; row+=bpp; }
+  }
+}
+
+
 static inline void RGB_to_rgbF(float *R, float *G, float *B, float *S, float F, float *row, int w, int bpp){
   if(F>SELECT_THRESH){
     if(S){
@@ -264,6 +279,20 @@ static inline void RGB_to_rgbF(float *R, float *G, float *B, float *S, float F,
   }
 }
 
+static inline void Aal_to_alpF(float *S, float F, float *row, int w, int bpp){
+  if(S){
+    while(w--){
+      float a = *S*F;
+      row[3] = a;
+      row+=bpp;
+    }
+  }else{
+    float a = F;
+    while(w--){ row[3] = a; row+=bpp; }
+  }
+}
+
+
 static inline void unmask_rgba8(unsigned char *row,int w){
   while(w--){
     row[3] = 255;