dmj5
Class DMJ_OrbitTrapsDirect

Object
  extended by common:Generic
      extended by common:Coloring
          extended by common:DirectColoring
              extended by dmj5:DMJ_OrbitTrapsDirect

class 
DirectColoring:DMJ_OrbitTrapsDirect

...need details...


Ultra Fractal Source

Toggle UF Source Code Display

 class DMJ_OrbitTrapsDirect(common.ulb:DirectColoring) {
   ;
   ; ...need details...
   ;
 
 public:
   import "common.ulb"
 
   func DMJ_OrbitTrapsDirect(Generic pparent)
     DirectColoring.DirectColoring(pparent)
     
     m_TrapSelect = new @f_trapselect(this)
     m_Blend = new @f_trapmergemode(this)
     m_TrapTransform = new @f_traptransform(this)
     m_TrapShape = new @f_trapshape(this)
     m_ColorTransfer = new @f_colortransfer(this)
   endfunc
   
   func Init(complex pz, complex ppixel)
     DirectColoring.Init(pz, ppixel)
 
     m_TrapSelectSequence = m_TrapSelect.InitDefault()
     m_TrapTransform.Init(pz)
     m_TrapShape.Init(pz)
     m_ColorTransfer.Init(pz)
     
     m_AccumulatedColor = @p_basecolor
     m_Opaque = false
   endfunc
   
   func Iterate(complex pz)
     DirectColoring.Iterate(pz)
 
     if (m_Opaque)
       return
     endif
     
     m_TrapSelectSequence = m_TrapSelect.Iterate(m_TrapSelectSequence)
     if ((@f_trapselect == DMJ_TrapSelect && m_TrapSelectSequence > 0.5) || m_TrapSelectSequence > @p_trapselectthreshold)
       complex zt = m_TrapTransform.Iterate(pz)
       color current = m_TrapShape.Iterate(zt)
       current = m_ColorTransfer.Iterate(current)
       if (m_TrapTransform.IsSolid())
         current = @p_transformsolidcolor
       endif
     
       if (@p_trapmergeorder == 0)
         m_AccumulatedColor = m_Blend.FullMerge(m_AccumulatedColor, current, @p_trapmergeopacity)
       elseif (@p_trapmergeorder == 1)
         m_AccumulatedColor = m_Blend.FullMerge(current, m_AccumulatedColor, @p_trapmergeopacity)
         m_Opaque = m_Blend.IsOpaque(m_AccumulatedColor)
       endif
 
     else
       m_TrapTransform.IterateSilent()
       m_TrapShape.IterateSilent()
       m_ColorTransfer.IterateSilent()
     endif
 
   endfunc
   
   color func Result(complex pz)
     DirectColoring.Result(pz)
 
     if (@p_trapmergeorder == 0)
       m_AccumulatedColor = m_Blend.FullMerge(m_AccumulatedColor, @p_finalcolor, @p_trapmergeopacity)
     elseif (@p_trapmergeorder == 1)
       m_AccumulatedColor = m_Blend.FullMerge(@p_finalcolor, m_AccumulatedColor, @p_trapmergeopacity)
     endif
 
     return m_AccumulatedColor
   endfunc
 
 protected:
   Generator m_TrapSelect
   ColorMerge m_Blend
   UserTransform m_TrapTransform
   ColorTrap m_TrapShape
   ColorTransfer m_ColorTransfer
   color m_AccumulatedColor
   bool m_Opaque
 
   float m_TrapSelectSequence
 
 default:
   title = "Orbit Traps Direct (UF5)"
   
   int param v_dmj_orbittrapsdirect
     caption = "Version (DMJ_OrbitTrapsDirect)"
     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_orbittrapsdirect < 100
   endparam
 
   Generator param f_trapselect
     caption = "Trap Iteration"
     default = DMJ_TrapSelect
     expanded = false
   endparam
   float param p_trapselectthreshold
     caption = "Threshold"
     default = 0.5
     hint = "When using a Generator other than a TrapSelect type, values could range anywhere from 0 to 1. This threshold sets which values will be interpreted as 'do not trap' and which will be interpreted as 'trap'."
     visible = (@f_trapselect != DMJ_TrapSelect)
   endparam
   color param p_transformsolidcolor
     caption = "Transform Solid Color"
     default = rgb(0,0,1)
     hint = "If you place a Transform in the Trap Position slot, and it produces areas with solid colors, they will get this color."
     visible = (@f_traptransform != TrapTransform)
   endparam
   color param p_basecolor
     caption = "Base Color"
     default = rgb(0,0,0)
     hint = "Specifies the 'base', or starting color with which all iterations' colors will be merged. If you are merging top-down rather than bottom-up, you will likely want this to be transparent."
   endparam
   color param p_finalcolor
     caption = "Final Color"
     default = rgba(0,0,0,0)
     hint = "Specifies the 'final' color that will be merged with the result after all iterations are complete. If you are merging top-down you can use this to provide a background color."
   endparam
   ColorMerge param f_trapmergemode
     caption = "Trap Color Merge"
     default = DefaultColorMerge
     hint = "This chooses the merge mode used to blend colors at each iteration."
   endparam
   ; additional alpha options go here
   float param p_trapmergeopacity
     caption = "Trap Merge Opacity"
     default = 0.2
     hint = "Sets the opacity of each trap shape. Even if you set this value to 1 (forcing all traps to be fully opaque) you can still control opacity using the alpha channel in the gradient."
   endparam
   param p_trapmergeorder
     caption = "Trap Merge Order"
     default = 0
     enum = "bottom-up" "top-down"
     hint = "Sets the order in which traps will be merged. Bottom-up merges new traps on top of previous ones; top-down merges new traps underneath previous ones."
   endparam
   
   UserTransform param f_traptransform
     caption = "Trap Position"
     default = TrapTransform
   endparam
   ColorTrap param f_trapshape
     caption = "Trap Shape"
     default = ColorTrapWrapper
   endparam
   ColorTransfer param f_colortransfer
     caption = "Color Transfer"
     default = NullColorTransfer
     hint = "This is the color effect to apply. By default, this is none."
   endparam
 }
 


Constructor Summary
DMJ_OrbitTrapsDirect()
           
DMJ_OrbitTrapsDirect(Generic pparent)
           
 
Method Summary
 void Init(complex pz, complex ppixel)
          Set up for a sequence of values
 void Iterate(complex pz)
          Process the next value in the sequence
 color Result(complex pz)
          Produce a resulting color index after a sequence is finished
 
Methods inherited from class common:DirectColoring
IsSolid
 
Methods inherited from class common:Coloring
GetPixel, IsGradient
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

DMJ_OrbitTrapsDirect

public DMJ_OrbitTrapsDirect(Generic pparent)

DMJ_OrbitTrapsDirect

public DMJ_OrbitTrapsDirect()
Method Detail

Init

public void Init(complex pz,
                 complex ppixel)
Description copied from class: DirectColoring
Set up for a sequence of values

This function will be called at the beginning of each sequence of values (e.g. at the beginning of each fractal orbit).

Overrides:
Init in class DirectColoring
Parameters:
pz - first value for the sequence; for a normal coloring formula, this will be #z
ppixel - seed value for the sequence; for a normal coloring formula, this will be #pixel

Iterate

public void Iterate(complex pz)
Description copied from class: DirectColoring
Process the next value in the sequence

As long as the sequence has not bailed out, this function will be continually called to produce sequence values. Note that such processing generally will not know in advance precisely how long the sequence is, and should be prepared to deal with sequences of arbitrary length.

Your coloring may determine at some point that a solid color should be used rather than an index value.

Overrides:
Iterate in class DirectColoring
Parameters:
pz - next value in the sequence; corresponds to #z in a coloring formula

Result

public color Result(complex pz)
Description copied from class: DirectColoring
Produce a resulting color index after a sequence is finished

This corresponds to the final: section in a coloring formula. Once it is called, no further calls to Iterate() should be made without calling Init() first.

Overrides:
Result in class DirectColoring
Returns:
the gradient index (corresponding to #index in a coloring formula)