mmf
Class MMF_QuickGradient

Object
  extended by common:Generic
      extended by common:Coloring
          extended by common:GradientColoring
              extended by mmf:MMF_QuickGradient

class 
GradientColoring:MMF_QuickGradient



Ultra Fractal Source

Toggle UF Source Code Display

 class MMF_QuickGradient(common.ulb:GradientColoring) {
 public:
   ; @param pparent usually "this" from the parent or zero
   func MMF_QuickGradient(Generic pparent)
     GradientColoring.GradientColoring(pparent)
   endfunc
 
   ; @param pz
   ; @return gradient index
   float func ResultIndex(complex pz)
     if @type=="Linear"
       if @offset
         return 16.5 + 0.25*(real(m_Pixel)*cos(@angle*(#pi/180)) \
                - imag(m_Pixel)*sin(@angle*(#pi/180)))
       else
         return 16.5 + 0.25*(real(m_Pixel)*cos(@angle*(#pi/180) - #angle) \
                - imag(m_Pixel)*sin(@angle*(#pi/180) - #angle))
       endif
     elseif @type=="Cone"
       if @offset
         pz = cos(@angle*(#pi/180)) + flip(sin(@angle*(#pi/180)))
       else
         pz = cos(@angle*(#pi/180) - #angle) \
              + flip(sin(@angle*(#pi/180) - #angle))
       endif
       if @usecentre
         m_Pixel = m_Pixel - #center
       else
         m_Pixel = m_Pixel - @centre
       endif
       pz = real(m_Pixel)*real(pz) - imag(m_Pixel)*imag(pz) \
            + flip(real(m_Pixel)*imag(pz) + imag(m_Pixel)*real(pz))
       return 0.5 - atan2(pz) / (2 * #pi)
     elseif @usecentre
       return cabs(m_Pixel - #center)
     else
       return cabs(m_Pixel - @centre)
     endif
   endfunc
 
 default:
   title = "MMF Quick Gradient"
   int param type
     caption = "Gradient Type"
     enum = "Linear" "Circular" "Cone"
     default = 0
   endparam
   bool param offset
     caption = "Offset from UF Angle ?"
     default = true
     hint = "When enabled the rotation angle you supply will be added to your \
             default UF rotation angle, when disabled the angle is always \
             from the horizontal."
     visible = @type==0 || @type==2
   endparam
   float param angle
     caption = "Angle (degrees)"
     default = 0.0
     hint = "The angle for the gradient."
     visible = @type==0 || @type==2
   endparam
   bool param usecentre
     caption = "Use Screen Centre ?"
     default = true
     visible = @type==1 || @type==2
   endparam
   complex param centre
     caption = "Circle Centre"
     default = (0,0)
     visible = (@type==1 || @type==2) && !@usecentre
   endparam
 }
 


Constructor Summary
MMF_QuickGradient()
           
MMF_QuickGradient(Generic pparent)
           
 
Method Summary
 float ResultIndex(complex pz)
          Produce a resulting color index after a sequence is finished
 
Methods inherited from class common:GradientColoring
Init, IsGradient, IsSolid, Iterate, Result
 
Methods inherited from class common:Coloring
GetPixel
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

MMF_QuickGradient

public MMF_QuickGradient(Generic pparent)
Parameters:
pparent - usually "this" from the parent or zero

MMF_QuickGradient

public MMF_QuickGradient()
Method Detail

ResultIndex

public float ResultIndex(complex pz)
Description copied from class: GradientColoring
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:
ResultIndex in class GradientColoring
Parameters:
pz -
Returns:
gradient index