[opengtl-commits] [704] use alpha/setAlpha and hints

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 704
Author:   cyrille
Date:     2009-03-26 15:15:05 +0100 (Thu, 26 Mar 2009)

Log Message:
-----------
use alpha/setAlpha and hints

Modified Paths:
--------------
    trunk/shiva-collections/filters/AntiBullify.shiva
    trunk/shiva-collections/filters/Droste.shiva


Modified: trunk/shiva-collections/filters/AntiBullify.shiva
===================================================================
--- trunk/shiva-collections/filters/AntiBullify.shiva	2009-03-26 14:09:19 UTC (rev 703)
+++ trunk/shiva-collections/filters/AntiBullify.shiva	2009-03-26 14:15:05 UTC (rev 704)
@@ -26,7 +26,7 @@
     return sqrt( v[0] + v[1] );
   }
   
-  void evaluatePixel(image4 img, out pixel4 result)
+  void evaluatePixel(image img, out pixel result)
   {
     float2 vec = result.coord - center;
     float factor = length( vec ) / lightLength;

Modified: trunk/shiva-collections/filters/Droste.shiva
===================================================================
--- trunk/shiva-collections/filters/Droste.shiva	2009-03-26 14:09:19 UTC (rev 703)
+++ trunk/shiva-collections/filters/Droste.shiva	2009-03-26 14:15:05 UTC (rev 704)
@@ -198,11 +198,10 @@
 {  
   const float pi = 3.14159265358979323846;
   const float2 I = { 0.0, 1.0};
-  const float2 imsize = { 300, 300 };
   const float3 polarCoordinates = { 90, 0, 0 };
   const float2 center = { xcenter, ycenter };
   const float2 centerShift = { xcenterShift + 1.0, ycenterShift + 1.0 };
-  dependent float     r1, r2, p1, p2, w, h, alphaThreshold;
+  dependent float     r1, r2, p1, p2, alphaThreshold;
   dependent float2    _rotate, xBounds, yBounds, xyMiddle, minDimension, _zoom;
   dependent bool      showPoles, hyperDroste, tileBasedOnTransparency, transparentPointsIn, twist;
   
@@ -295,9 +294,7 @@
     twist = (untwist == 0);
     alphaThreshold = 0.01;
     
-    w = imsize.x;
-    h = imsize.y;
-    float mdF = min(w, h) / 2.0;
+    float mdF = min(IMAGE_WIDTH, IMAGE_HEIGHT) / 2.0;
     minDimension = float2(mdF, mdF);
     
     // Autoset periodicity
@@ -321,7 +318,7 @@
     
     xyMiddle = float2(0.5 * (xBounds.x + xBounds.y), 0.5 * (yBounds.x + yBounds.y) );
     float2 xyRange  = float2(xBounds.y - xBounds.x, yBounds.y - yBounds.x);
-    xyRange.x = xyRange.y * (w / h);
+    xyRange.x = xyRange.y * (IMAGE_WIDTH / IMAGE_HEIGHT);
     xBounds = float2(xyMiddle.x - 0.5 * xyRange.x, xyMiddle.x + 0.5 * xyRange.x);
     
     // Polar options
@@ -336,7 +333,7 @@
         float radius; float theta; float div;
         int iteration;
         
-        float2 sbis = s / imsize - center + 0.5;
+        float2 sbis = s / IMAGE_SIZE - center + 0.5;
         z = float2(( xBounds.x + (xBounds.y - xBounds.x) *  sbis.x),
                    ( yBounds.x + (yBounds.y - yBounds.x) *  sbis.y));
         // Only allow for procedural zooming/scaling in the standard coordinates
@@ -346,7 +343,7 @@
         
        // Extra options
        
-        polar = (float2(polarCoordinates.y, polarCoordinates.z) * w / s.x) / 100.0;
+        polar = (float2(polarCoordinates.y, polarCoordinates.z) * IMAGE_WIDTH / s.x) / 100.0;
         
         if (showPoles) {
             theta = (pi/180.0) * polarCoordinates.x;
@@ -397,7 +394,7 @@
         float alphaRemaining = 1.0;
         float2 d = (z + centerShift) * minDimension ;
         pixel src = img.sampleNearest(d);
-        float alphasrc = src[3]; // TODO get alpha from pixel
+        float alphasrc = src.alpha();
         float4 colorSoFar = (src * (alphasrc * alphaRemaining));
         alphaRemaining *= (1.0 - alphasrc);
 
@@ -438,7 +435,7 @@
           z = complexMult(z, ratio);
           float2 d = (z + centerShift) * minDimension ;
           pixel src = img.sampleNearest(d);
-          float alphasrc = src[3]; // TODO get alpha from src
+          float alphasrc = src.alpha();
           colorSoFar += (src * (alphasrc * alphaRemaining));
           alphaRemaining *= ( 1 - alphasrc );
           radius = length( z );


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/