[opengtl-commits] [762] add a node for alpha

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


Revision: 762
Author:   cyrille
Date:     2009-05-30 12:46:54 +0200 (Sat, 30 May 2009)

Log Message:
-----------
add a node for alpha

Modified Paths:
--------------
    trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/TemplateAST.cpp
    trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/TemplateAST_p.h

Added Paths:
-----------
    trunk/OpenGTL/OpenCTL/tests/templates/opalpha.ctlt


Modified: trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/TemplateAST.cpp
===================================================================
--- trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/TemplateAST.cpp	2009-05-30 10:38:39 UTC (rev 761)
+++ trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/TemplateAST.cpp	2009-05-30 10:46:54 UTC (rev 762)
@@ -204,6 +204,16 @@
   }
 }
 
+void AlphaNode::generate(TemplateGenerationContext* _context) {
+  int idx = _context->pixelDescription().alphaPos();
+  if( idx == -1) {
+    _context->append("1.0");
+  } else {
+    _context->append( "(in_" + GTLCore::String::number(idx) + " / " +
+                      typeUnit(_context->pixelDescription().channelTypes()[idx] )  + ")" );
+  }
+}
+
 InOutNode::InOutNode(Which _which) {
   switch(_which)
   {

Modified: trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/TemplateAST_p.h
===================================================================
--- trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/TemplateAST_p.h	2009-05-30 10:38:39 UTC (rev 761)
+++ trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/TemplateAST_p.h	2009-05-30 10:46:54 UTC (rev 762)
@@ -84,6 +84,10 @@
         NodesList* m_nodesList;
         WhichChannel m_whichChannel;
     };
+    class AlphaNode : public Node {
+      public:
+        virtual void generate(TemplateGenerationContext* _context);
+    };
     class InOutNode : public Node {
       public:
         enum Which {

Added: trunk/OpenGTL/OpenCTL/tests/templates/opalpha.ctlt
===================================================================
--- trunk/OpenGTL/OpenCTL/tests/templates/opalpha.ctlt	                        (rev 0)
+++ trunk/OpenGTL/OpenCTL/tests/templates/opalpha.ctlt	2009-05-30 10:46:54 UTC (rev 762)
@@ -0,0 +1,5 @@
+@operation(transformation)
+{
+  @colorchannels(@out = (@in * @alpha) );
+) @alphachannel(@out = @max; )
+}
\ No newline at end of file


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