common
Class ClipShapeMerge

Object
  extended by common:Generic
      extended by common:Transform
          extended by common:ClipShape
              extended by common:ClipShapeMerge

class 
ClipShape:ClipShapeMerge

This is a clip shape merge class. It takes multiple clip shapes (up to 10) and allows them to be merged together in various ways.


Ultra Fractal Source

Toggle UF Source Code Display

 class ClipShapeMerge(ClipShape) {
   ; This is a clip shape merge class. It takes multiple clip shapes
   ; (up to 10) and allows them to be merged together in various ways.
   
 public:
   func ClipShapeMerge(Generic pparent)
     ClipShape.ClipShape(pparent)
 
     m_Enables[0] = @p_clipshape1enable    
     m_Enables[1] = @p_clipshape2enable    
     m_Enables[2] = @p_clipshape3enable    
     m_Enables[3] = @p_clipshape4enable    
     m_Enables[4] = @p_clipshape5enable    
     m_Enables[5] = @p_clipshape6enable    
     m_Enables[6] = @p_clipshape7enable    
     m_Enables[7] = @p_clipshape8enable    
     m_Enables[8] = @p_clipshape9enable    
     m_Enables[9] = @p_clipshape10enable    
     m_Elements[0] = new @f_clipshape1(this)
     m_Elements[1] = new @f_clipshape2(this)
     m_Elements[2] = new @f_clipshape3(this)
     m_Elements[3] = new @f_clipshape4(this)
     m_Elements[4] = new @f_clipshape5(this)
     m_Elements[5] = new @f_clipshape6(this)
     m_Elements[6] = new @f_clipshape7(this)
     m_Elements[7] = new @f_clipshape8(this)
     m_Elements[8] = new @f_clipshape9(this)
     m_Elements[9] = new @f_clipshape10(this)
   endfunc
   
   func Init(complex pz)
     ClipShape.Init(pz)
     
     int j = 0
     while (j < 10)
       if (m_Enables[j])
         m_Elements[j].Init(pz)
       endif
       j = j + 1
     endwhile
   endfunc
   
   complex func Iterate(complex pz)
     complex c
     int j = 0
     while (j < 10)
       if (m_Enables[j])
         c = m_Elements[j].Iterate(pz)
       endif
       j = j + 1
     endwhile
     c = c      ; silences compiler warning
     return pz
   endfunc
   
   func IterateSilent()
     int j = 0
     while (j < 10)
       if (m_Enables[j])
         m_Elements[j].IterateSilent()
       endif
       j = j + 1
     endwhile
   endfunc
 
   ; IsSolid() must be defined in derived classes
   bool func IsSolid()
     if (@p_mergemode == 0)
       int j = 0
       while (j < 10)
         if (m_Enables[j])
           if (m_Elements[j].IsSolid())
             return true
           endif
         endif
         j = j + 1
       endwhile
       return false
     
     elseif (@p_mergemode == 1)
       bool s = true
       bool u = false
       int j = 0
       while (j < 10)
         if (m_Enables[j])
           if (!m_Elements[j].IsSolid())
             s = false
           elseif (@p_intersectionhelp && #calculationPurpose == 0 && #x % 2 == 0 && #y % 2 == 0)
             u = true
           endif
         endif
         j = j + 1
       endwhile
       return s || u
     
     elseif (@p_mergemode == 2)
       bool s = false
       bool u = false
       int j = 0
       while (j < 10)
         if (m_Enables[j])
           if (m_Elements[j].IsSolid())
             s = !s
             if (@p_intersectionhelp && #calculationPurpose == 0 && #x % 2 == 0 && #y % 2 == 0)
               u = true
             endif
           endif
         endif
         j = j + 1
       endwhile
       return s || u
     endif
 
     return false  ; all possible conditions are covered, but UF can't know that; appease its strict requirement for return
   endfunc
 
   func SetHandles(Handles phandles)
     if (@p_clipshapehandleselect < 10 && m_Enables[@p_clipshapehandleselect])
       m_Elements[@p_clipshapehandleselect].SetHandles(phandles)
     endif
   endfunc
   
   func SetAspect(float paspect)
     int j = 0
     while (j < 10)
       if (m_Enables[j])
         m_Elements[j].SetAspect(paspect)
       endif
       j = j + 1
     endwhile
   endfunc
   
 protected:
   bool m_Enables[10]
   ClipShape m_Elements[10]
   
 default:
   title = "Clip Shape Merge"
   
   int param v_clipshapemerge
     caption = "Version (ClipShapeMerge)"
     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_clipshapemerge < 100
   endparam
 
   int param p_mergemode
     caption = "Merge Mode"
     default = 0
     enum = "union (OR)" "intersection (AND)" "exclusion (XOR)"
     hint = "Sets the way the clip shapes will be merged together."
   endparam
   bool param p_intersectionhelp
     caption = "Show ghosted clip shapes"
     default = true
     hint = "If set, all clip shapes that contribute to the intersection will be shown at quarter-strength. This will automatically be disabled for disk renders; it is intended only as an aid in positioning elements. If you want all clip shapes to be combined in an 'OR' fashion, use the 'union' merge mode. Handles may be more difficult to see with this enabled. This option will not work correctly with Guessing; you must use Multi-pass Linear or One-pass Linear."
     visible = (@p_mergemode >= 1)
   endparam
   
   bool param p_showempty
     caption = "Show all slots"
     default = true
     hint = "Sets whether all slots should be shown, even if they are empty or disabled. By unchecking this box, you can quickly hide any trap shape slots that are empty or that you've disabled. Check the box again to show them."
   endparam
   int param p_clipshapehandleselect
     caption = "Show handles for clip shape"
     default = 0
     enum = "1" "2" "3" "4" "5" "6" "7" "8" "9" "10"
     hint = "Selects the clip shape to show handles for."
   endparam
 
   bool param p_clipshape1enable
     caption = "Enable Clip Shape 1"
     default = true
     hint = "Enables this clip shape. You can use this to temporarily disable a clip shape without unloading its parameters."
     visible = (@f_clipshape1 != NullClipShape)
   endparam
   ClipShape param f_clipshape1
     caption = "Clip Shape"
     default = NullClipShape
     hint = "Sets the clip shape for this slot."
     visible = ((@f_clipshape1 != NullClipShape && @p_clipshape1enable) || @p_showempty)
   endparam
   bool param p_clipshape2enable
     caption = "Enable Clip Shape 2"
     default = true
     hint = "Enables this clip shape. You can use this to temporarily disable a clip shape without unloading its parameters."
     visible = (@f_clipshape1 != NullClipShape)
   endparam
   ClipShape param f_clipshape2
     caption = "Clip Shape"
     default = NullClipShape
     hint = "Sets the clip shape for this slot."
     visible = ((@f_clipshape2 != NullClipShape && @p_clipshape2enable) || @p_showempty)
   endparam
   bool param p_clipshape3enable
     caption = "Enable Clip Shape 3"
     default = true
     hint = "Enables this clip shape. You can use this to temporarily disable a clip shape without unloading its parameters."
     visible = (@f_clipshape1 != NullClipShape)
   endparam
   ClipShape param f_clipshape3
     caption = "Clip Shape"
     default = NullClipShape
     hint = "Sets the clip shape for this slot."
     visible = ((@f_clipshape3 != NullClipShape && @p_clipshape3enable) || @p_showempty)
   endparam
   bool param p_clipshape4enable
     caption = "Enable Clip Shape 4"
     default = true
     hint = "Enables this clip shape. You can use this to temporarily disable a clip shape without unloading its parameters."
     visible = (@f_clipshape1 != NullClipShape)
   endparam
   ClipShape param f_clipshape4
     caption = "Clip Shape"
     default = NullClipShape
     hint = "Sets the clip shape for this slot."
     visible = ((@f_clipshape4 != NullClipShape && @p_clipshape4enable) || @p_showempty)
   endparam
   bool param p_clipshape5enable
     caption = "Enable Clip Shape 5"
     default = true
     hint = "Enables this clip shape. You can use this to temporarily disable a clip shape without unloading its parameters."
     visible = (@f_clipshape1 != NullClipShape)
   endparam
   ClipShape param f_clipshape5
     caption = "Clip Shape"
     default = NullClipShape
     hint = "Sets the clip shape for this slot."
     visible = ((@f_clipshape5 != NullClipShape && @p_clipshape5enable) || @p_showempty)
   endparam
   bool param p_clipshape6enable
     caption = "Enable Clip Shape 6"
     default = true
     hint = "Enables this clip shape. You can use this to temporarily disable a clip shape without unloading its parameters."
     visible = (@f_clipshape1 != NullClipShape)
   endparam
   ClipShape param f_clipshape6
     caption = "Clip Shape"
     default = NullClipShape
     hint = "Sets the clip shape for this slot."
     visible = ((@f_clipshape6 != NullClipShape && @p_clipshape6enable) || @p_showempty)
   endparam
   bool param p_clipshape7enable
     caption = "Enable Clip Shape 7"
     default = true
     hint = "Enables this clip shape. You can use this to temporarily disable a clip shape without unloading its parameters."
     visible = (@f_clipshape1 != NullClipShape)
   endparam
   ClipShape param f_clipshape7
     caption = "Clip Shape"
     default = NullClipShape
     hint = "Sets the clip shape for this slot."
     visible = ((@f_clipshape7 != NullClipShape && @p_clipshape7enable) || @p_showempty)
   endparam
   bool param p_clipshape8enable
     caption = "Enable Clip Shape 8"
     default = true
     hint = "Enables this clip shape. You can use this to temporarily disable a clip shape without unloading its parameters."
     visible = (@f_clipshape1 != NullClipShape)
   endparam
   ClipShape param f_clipshape8
     caption = "Clip Shape"
     default = NullClipShape
     hint = "Sets the clip shape for this slot."
     visible = ((@f_clipshape8 != NullClipShape && @p_clipshape8enable) || @p_showempty)
   endparam
   bool param p_clipshape9enable
     caption = "Enable Clip Shape 9"
     default = true
     hint = "Enables this clip shape. You can use this to temporarily disable a clip shape without unloading its parameters."
     visible = (@f_clipshape1 != NullClipShape)
   endparam
   ClipShape param f_clipshape9
     caption = "Clip Shape"
     default = NullClipShape
     hint = "Sets the clip shape for this slot."
     visible = ((@f_clipshape9 != NullClipShape && @p_clipshape9enable) || @p_showempty)
   endparam
   bool param p_clipshape10enable
     caption = "Enable Clip Shape 10"
     default = true
     hint = "Enables this clip shape. You can use this to temporarily disable a clip shape without unloading its parameters."
     visible = (@f_clipshape1 != NullClipShape)
   endparam
   ClipShape param f_clipshape10
     caption = "Clip Shape"
     default = NullClipShape
     hint = "Sets the clip shape for this slot."
     visible = ((@f_clipshape10 != NullClipShape && @p_clipshape10enable) || @p_showempty)
   endparam
 }
 


Constructor Summary
ClipShapeMerge()
           
ClipShapeMerge(Generic pparent)
           
 
Method Summary
 void Init(complex pz)
          Set up for a sequence of values
 boolean IsSolid()
          IsSolid() must be defined in derived classes
 complex Iterate(complex pz)
          Transform a single point within a sequence
 void IterateSilent()
          Update internal counters without transforming a point
 void SetAspect(float paspect)
           
 void SetHandles(Handles phandles)
           
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

ClipShapeMerge

public ClipShapeMerge(Generic pparent)

ClipShapeMerge

public ClipShapeMerge()
Method Detail

Init

public void Init(complex pz)
Description copied from class: Transform
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). It will be called even if only one value is being transformed (e.g. a normal transformation formula). Use this to perform any setup that is exactly the same for each value in the sequence being transformed.

Overrides:
Init in class Transform
Parameters:
pz - the value representing the sequence; for a normal transformation formula use, this will be #pixel. In some cases this may differ from the first value passed to Iterate() if the calling code applies some other transformations.

Iterate

public complex Iterate(complex pz)
Description copied from class: Transform
Transform a single point within a sequence

After a sequence has been set up with Init(), this function will be called once for each value in the sequence. Note that all values in the sequence must be processed in order (they cannot be processed out of order). If the sequence contains only one value, Init() will still be called and then Iterate() will be called just once.

Overrides:
Iterate in class Transform
Parameters:
pz - the complex value to be transformed
Returns:
the transformed value

IterateSilent

public void IterateSilent()
Description copied from class: Transform
Update internal counters without transforming a point

For some Transform classes, the actual transformation being performed changes for each value in the sequence (e.g. TrapTransform, which can rotate each iteration by a different amount). In some cases the calling code may determine in advance that a particular point does not need to be transformed (perhaps because it is not being used) but it still needs to be accounted for. This function is used in place of Iterate() for those situations; the Transform should update any internal state that changes between iterations within a sequence. Since no value is being transformed, no parameters are passed and no return value is provided.

Overrides:
IterateSilent in class Transform

IsSolid

public boolean IsSolid()
IsSolid() must be defined in derived classes

Overrides:
IsSolid in class Transform
Returns:
a Boolean flag indicating whether the sequence is solid-colored or not.

SetHandles

public void SetHandles(Handles phandles)
Overrides:
SetHandles in class ClipShape

SetAspect

public void SetAspect(float paspect)
Overrides:
SetAspect in class ClipShape