reb
Class ColorTrapChecker

Object
  extended by common:Generic
      extended by common:ColorTrap
          extended by reb:ColorTrapChecker

class 
ColorTrap:ColorTrapChecker

ColorTrap that provides checker coloring.

The coloring can be bicolor or use a gradient. There are mulitiple options the checker patterns.


Ultra Fractal Source

Toggle UF Source Code Display

 class ColorTrapChecker(common.ulb:ColorTrap) {
 ; ColorTrap that provides checker coloring. <br>
 ; <p>
 ; The coloring can be bicolor or use a gradient. There are mulitiple options
 ; the checker patterns.
 public:
   import "common.ulb"
 
   ; constructor
   func ColorTrapChecker(Generic pparent)
     ColorTrap.ColorTrap(pparent)
   endfunc
   
   ; Initializes the coloring
   func Init(complex pz)
     ColorTrap.Init(pz)
   endfunc
   
   ; call for each iterated point
   color func Iterate(complex pz)
     ColorTrap.Iterate(pz)
     float scale = @scalec/20
     color pat = rgba(0,0,0,0)
       pz = floor(@patfun(pz*#width*scale))
       int patmod = 2
       if @flavorc == 0
         patmod = 2
       elseif @flavorc == 1
         patmod = 3
       elseif @flavorc == 2
         patmod = 4
       elseif @flavorc == 3
         patmod = 5
       elseif @flavorc == 4
         patmod = 6
       elseif @flavorc == 5
         patmod = 7
       elseif @flavorc == 6
         patmod = 8
       endif
       float patval = 0
       if @patop == "+"
         patval = (real(pz) + imag(pz)) % patmod
       elseif @patop == "*"
         patval = (real(pz) * imag(pz)) % patmod
       elseif @patop == "/"
         patval = (real(pz) / imag(pz)) % patmod
       elseif @patop == "^"
         patval = (real(pz) ^ imag(pz)) % patmod
       endif
       if !@cgrad
         if patval == 0
           pat = @pattern1
         else
           pat = @pattern2
         endif
       else
         pat = gradient((patmod -1-patval)/patmod)
       endif
     return pat
   endfunc
   
 default:
   title = "Checker Coloring"
   int param v_ColorTrapChecker
     caption = "Version (Checker Coloring)"
     default = 101
     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_ColorTrapChecker < 101
   endparam
   color param pattern1
     caption = "Color 1"
     default = rgb(0.66,0.29,0.1)
     visible = !@cgrad
   endparam
   color param pattern2
     caption = "Color 2"
     default = rgb(0.89,0.84,0.30)
     visible = !@cgrad
   endparam
   float param scalec
     caption = "Scale"
     default = 1.0
   endparam
   param flavorc
     caption = "Flavor"
     default = 0
     enum = "0" "1" "2" "3" "4" "5" "6"
   endparam
   param patop
     caption = "Pattern Operator"
     default = 0
     enum = "+" "*" "/" "^"
   endparam
   func patfun
     default = ident()
   endfunc
   bool param cgrad
     caption = "Use Gradient"
     default = false
   endparam
 ;  bool param spherec
 ;   caption = "Spherical Mapping"
 ;   default = false
 ;   visible = @checker
 ;  endparam
 }
 


Constructor Summary
ColorTrapChecker()
           
ColorTrapChecker(Generic pparent)
          constructor
 
Method Summary
 void Init(complex pz)
          Initializes the coloring
 color Iterate(complex pz)
          call for each iterated point
 
Methods inherited from class common:ColorTrap
IterateSilent
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

ColorTrapChecker

public ColorTrapChecker(Generic pparent)
constructor


ColorTrapChecker

public ColorTrapChecker()
Method Detail

Init

public void Init(complex pz)
Initializes the coloring

Overrides:
Init in class ColorTrap

Iterate

public color Iterate(complex pz)
call for each iterated point

Overrides:
Iterate in class ColorTrap