dmj5
Class DMJ_BlurTrapWrapper

Object
  extended by common:Generic
      extended by common:ColorTrap
          extended by dmj5:DMJ_BlurTrapWrapper

class 
ColorTrap:DMJ_BlurTrapWrapper

This wrapper allows you to use any color trap and any convolution filter to produce blurred or sharpened (or other) trap effects.


Ultra Fractal Source

Toggle UF Source Code Display

 class DMJ_BlurTrapWrapper(common.ulb:ColorTrap) {
   ; This wrapper allows you to use any color trap and any convolution
   ; filter to produce blurred or sharpened (or other) trap effects.
   
 public:
   import "common.ulb"
   
   func DMJ_BlurTrapWrapper(Generic pparent)
     ColorTrap.ColorTrap(pparent)
 
     m_Filter = new @f_filter(this)
     m_Samples = length(m_Filter.m_Offsets)
     setLength(m_TrapShapes, m_Samples)
     int j = 0
     while (j < m_Samples)
       m_TrapShapes[j] = new @f_trapshape(this)
       j = j + 1
     endwhile
   endfunc
   
   func Init(complex pz)
     ColorTrap.Init(pz)
 
     int j = 0
     while (j < m_Samples)
       m_TrapShapes[j].Init(pz)
       j = j + 1
     endwhile
     if (@p_filterreset == 0 && DMJ_VariableConvolutionFilter(m_Filter) != 0)
       m_Filter.Init(pz)
     endif
   endfunc
 
   color func Iterate(complex pz)
     ColorTrap.Iterate(pz)
     
     if (@p_filterreset == 1 && DMJ_VariableConvolutionFilter(m_Filter) != 0)
       m_Filter.Init(pz)
     endif
 
     float r = 0.0
     float g = 0.0
     float b = 0.0
     float a = 0.0
     float w
     float o
     color c = rgb(0,0,0)
     
     int j = 0
     while (j < m_Samples)
       c = m_TrapShapes[j].Iterate(pz+m_Filter.m_Offsets[j])
       w = m_Filter.m_Weights[j]
       r = r + red(c) * w
       g = g + green(c) * w
       b = b + blue(c) * w
       a = a + alpha(c) * w
       j = j + 1
     endwhile
     w = m_Filter.m_Multiplier
     o = m_Filter.m_Bias
     r = r * w + o
     g = g * w + o
     b = b * w + o
     a = a * w + o
     return rgba(r,g,b,a)
   endfunc
 
 protected:
   DMJ_ConvolutionFilter m_Filter
   int m_Samples
   ColorTrap m_TrapShapes[]
 
 default:
   title = "Blurred Trap Wrapper"
   
   int param v_dmj_blurtrapwrapper
     caption = "Version (DMJ_BlurTrapWrapper)"
     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_dmj_blurtrapwrapper < 100
   endparam
 
   ColorTrap param f_trapshape
     caption = "Trap Shape"
     default = ColorTrapWrapper
     hint = "Sets the trap shape that the convolution filter will be applied to."
   endparam
   DMJ_ConvolutionFilter param f_filter
     caption = "Convolution Filter"
     default = DMJ_GaussianBlur
     hint = "Sets the filter that will be applied."
   endparam
   int param p_filterreset
     caption = "Reset Filter"
     default = 1
     enum = "first iteration" "every iteration"
     hint = "Some convolution filters are position-dependent: the filter's effect varies from one part of the complex plane to another. For this kind of filter, you may choose whether to recompute the filter's effect only at the first iteration or on every iteration."
     visible = (@f_filter == DMJ_VariableConvolutionFilter)
   endparam
 }
 


Constructor Summary
DMJ_BlurTrapWrapper()
           
DMJ_BlurTrapWrapper(Generic pparent)
           
 
Method Summary
 void Init(complex pz)
          call this before each sequence of values to be trapped
 color Iterate(complex pz)
          call this to produce a result you should always override this function
 
Methods inherited from class common:ColorTrap
IterateSilent
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

DMJ_BlurTrapWrapper

public DMJ_BlurTrapWrapper(Generic pparent)

DMJ_BlurTrapWrapper

public DMJ_BlurTrapWrapper()
Method Detail

Init

public void Init(complex pz)
Description copied from class: ColorTrap
call this before each sequence of values to be trapped

Overrides:
Init in class ColorTrap

Iterate

public color Iterate(complex pz)
Description copied from class: ColorTrap
call this to produce a result you should always override this function

Overrides:
Iterate in class ColorTrap