mmf
Class Layer

Object
  extended by common:Generic
      extended by mmf:Layer
Direct Known Subclasses:
DirectLayer, GradientLayer

class 
Generic:Layer



Ultra Fractal Source

Toggle UF Source Code Display

 class Layer(common.ulb:Generic) {
 public:
   ; <p>
   ; @param pparent typically 'this' from the parent or zero
   func Layer(Generic pparent)
     Generic.Generic(pparent)
     m_Merge = new @f_merge(this)
   endfunc
   ; <p>
   ; @param pbottom the base color
   ; @param ptop the top color
   ; @return layer merged color
   color func FullMerge(color pbottom, color ptop)
     if @f_invertcompose
       if @f_invertmerge
         return m_Merge.FullMerge(ptop, pbottom, @f_opacity)
       else
         return compose(ptop, \
                        blend(ptop,m_Merge.Merge(pbottom,ptop),alpha(pbottom)), \
                        @f_opacity)
       endif
     elseif @f_invertmerge
       return compose(pbottom, \
                      blend(pbottom,m_Merge.Merge(ptop,pbottom),alpha(ptop)), \
                      @f_opacity)
     else
       return m_Merge.FullMerge(pbottom, ptop, @f_opacity)
     endif
   endfunc
   ; <p>
   ; @param clr the base color
   ; @param index the gradient index for the top colour
   ; @return layer merged color
   color func GradientMerge(color clr,float index)
     return FullMerge(clr, gradient(index))
   endfunc
   ; <p>
   ; @param clr the base color
   ; @return layer merged color
   color func SolidMerge(color clr)
     return FullMerge(clr, @f_solid)
   endfunc
 private:
   ColorMerge m_Merge
 default:
   int param v_layer
     caption = "Version (Layer)"
     default = 100
     hint = "This version parameter is used to detect when a change \
             has been made to the formula that is incompatible with \
             the previous version. When that happens, this field will \
             reflect the old version number to alert you to the fact \
             that an alternate rendering is being used."
     visible = @v_layer < 100
   endparam
   color param f_solid
     caption = "Solid Colour"
     default = RGBA(0,0,0,1)
   endparam
   bool param f_invertmerge
     caption = "Inverted Merge"
     default = false
     hint = "When enabled this layer is treated as the lower layer in the \
             merge instead of as the upper layer, this inverts the way the \
             RGBA values are treated."
   endparam
   bool param f_invertcompose
     caption = "Inverted Compose"
     default = false
     hint = "When enabled this layer is treated as the lower layer in the \
             compose instead of as the upper layer, so reduced opacity \
             fades to this layer's colour instead of the underlying colour."
   endparam
   float param f_opacity
     caption = "Layer Opacity"
     default = 1.0
     hint = "The normal range to use is from 0.0 to 1.0."
   endparam
   ColorMerge param f_merge
     caption = "Layer Merge"
     default = MMF_ExtendedColorMerge
   endparam
 }
 


Constructor Summary
Layer()
           
Layer(Generic pparent)
          
 
Method Summary
 color FullMerge(color pbottom, color ptop)
          
 color GradientMerge(color clr, float index)
          
 color SolidMerge(color clr)
          
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

Layer

public Layer(Generic pparent)

Parameters:
pparent - typically 'this' from the parent or zero

Layer

public Layer()
Method Detail

FullMerge

public color FullMerge(color pbottom,
                       color ptop)

Parameters:
pbottom - the base color
ptop - the top color
Returns:
layer merged color

GradientMerge

public color GradientMerge(color clr,
                           float index)

Parameters:
clr - the base color
index - the gradient index for the top colour
Returns:
layer merged color

SolidMerge

public color SolidMerge(color clr)

Parameters:
clr - the base color
Returns:
layer merged color