mmf
Class MMF_RGBColorMerge

Object
  extended by common:Generic
      extended by common:ColorMerge
          extended by common:DefaultColorMerge
              extended by mmf:MMF_RGBColorMerge

class 
DefaultColorMerge:MMF_RGBColorMerge

Extended colour merges.
David Makin May 2008
Anyone interested in merge modes may like to look here:
http://www.pegtop.net/delphi/articles/blendmodes/


Ultra Fractal Source

Toggle UF Source Code Display

 class MMF_RGBColorMerge(common.ulb:DefaultColorMerge) {
 ;
 ; Extended colour merges.<br>
 ; David Makin May 2008<br>
 ;
 ; Anyone interested in merge modes may like to look here:<br>
 ; http://www.pegtop.net/delphi/articles/blendmodes/<br>
 public:
   ; <p>
   ; @param pparent the parent, generally "this" for the parent, or zero
   func MMF_RGBColorMerge(Generic pparent)
     DefaultColorMerge.DefaultColorMerge(pparent)
   endfunc
   ; <p>
   ; @param pbottom the base color
   ; @param ptop the top color
   ; @return merged color
   color func Merge(color pbottom, color ptop)
     float red
     float green
     float blue
     float bottom
     float top
     if @redtop=="Red"
       top = red(ptop)
     elseif @redtop=="Green"
       top = green(ptop)
     else
       top = blue(ptop)
     endif
     if @redbtm=="Red"
       bottom = red(pbottom)
     elseif @redbtm=="Green"
       bottom = green(pbottom)
     else
       bottom = blue(pbottom)
     endif
     if @p_modeselectred==1
       red = MergeChannels(bottom, top, @p_mmfmergemodered, @qminred, @qmaxred, \
                           @mingammared, @maxgammared)
     else
       red = red(@f_mergemode(RGB(bottom,bottom,bottom), RGB(top,top,top)))
     endif
     if @greentop=="Red"
       top = red(ptop)
     elseif @greentop=="Green"
       top = green(ptop)
     else
       top = blue(ptop)
     endif
     if @greenbtm=="Red"
       bottom = red(pbottom)
     elseif @greenbtm=="Green"
       bottom = green(pbottom)
     else
       bottom = blue(pbottom)
     endif
     if @p_modeselectgreen==1
       green = MergeChannels(bottom, top, @p_mmfmergemodegreen, @qmingreen, \
                           @qmaxgreen, @mingammagreen, @maxgammagreen)
     else
       green = green(@f_mergemodegreen(RGB(bottom,bottom,bottom), RGB(top,top,top)))
     endif
     if @bluetop=="Red"
       top = red(ptop)
     elseif @bluetop=="Green"
       top = green(ptop)
     else
       top = blue(ptop)
     endif
     if @bluebtm=="Red"
       bottom = red(pbottom)
     elseif @bluebtm=="Green"
       bottom = green(pbottom)
     else
       bottom = blue(pbottom)
     endif
     if @p_modeselectblue==1
       blue = MergeChannels(bottom, top, @p_mmfmergemodeblue, @qminblue, \
                           @qmaxblue, @mingammablue, @maxgammablue)
     else
       blue = blue(@f_mergemodeblue(RGB(bottom,bottom,bottom), RGB(top,top,top)))
     endif
     return RGBA(red, green, blue, alpha(ptop))
   endfunc
 
   float func MergeChannels(float bottom, float top, int mode, int qmin, \
                            int qmax, float mingamma, float maxgamma)
 
     if @clamp
       if top<0.0
         top = 0.0
       elseif top>1.0
         top = 1.0
       endif
       if bottom<0.0
         bottom = 0.0
       elseif bottom>1.0
         bottom = 1.0
       endif
     endif
 
     if mode==0;"Exclusion"
       return bottom + top - 2*bottom*top
     elseif mode==1;"Fade Down"
       return top * (1 - top + bottom)
     elseif mode==2;"Fade Up"
       return bottom + top*(top - bottom)
     elseif mode==3;"Contrast Down"
       return 0.5 + top*(bottom - 0.5)
     elseif mode==4;"Contrast Up"
       if bottom<0.5
         return bottom - 2.0*top*bottom*(0.5 - bottom)
       else
         return bottom + 2.0*top*(1.0 - bottom)*(bottom - 0.5)
       endif
     elseif mode==5;"Dodge"
 ; Here we clamp the maximum returned to 1.0 because of the special case
 ; when the color channel in ptop is one (or more).
       top = 1.0 - top
       if bottom<=0
         return 0.0
       elseif top<=0.0
         return 1.0
       else
         top = bottom/top
         if top>1.0
           top = 1.0
         endif
         return top
       endif
     elseif mode==6;"Burn"
 ; Here we clamp the minimum returned to 0 because of the special case
 ; when the color channel in ptop is zero (or less).
       if top<=0.0
         return 0.0
       else
         top = 1.0 - (1.0 - bottom)/top
         if top<0.0
           top = 0.0
         endif
         return top
       endif
     elseif mode==7;"Negation"
       return 1.0 - abs(1.0 - top - bottom)
     elseif mode==8;"Reflect"
 ; Here we clamp the maximum returned to 1.0 because of the special case
 ; when the color channel in ptop is one (or more).
       top = 1.0 - top
       if bottom<=0
         return 0.0
       elseif top<=0.0
         return 1.0
       else
         top = sqr(bottom)/top
         if top>1.0
           top = 1.0
         endif
         return top
       endif
     elseif mode==9;"Freeze"
 ; Here we clamp the minimum returned to 0 because of the special case
 ; when the color channel in ptop is zero (or less).
       if top<=0.0
         return 0.0
       else
         top = 1.0 - sqr(1.0 - bottom)/top
         if top<0.0
           top = 0.0
         endif
         return top
       endif
     elseif mode==10;"Rev. Contrast Down"
       return 0.5 + (1.0 - top)*(bottom - 0.5)
     elseif mode==11;"Rev. Contrast Up"
       if bottom<0.5
         return bottom - 2.0*(1.0 - top)*bottom*(0.5 - bottom)
       else
         return bottom + 2.0*(1.0 - top)*(1.0 - bottom)*(bottom - 0.5)
       endif
     elseif mode==12;"Fade"
       if top<0.5
         return 2.0 * top * (0.5 - top + bottom)
       else
         return bottom + 2.0 * (top - 0.5)*(top - bottom)
       endif
     elseif mode==13;"Reverse Fade"
       if top<0.5
         return bottom + 2.0 * top * (top - bottom)
       else
         return bottom + 2.0 * (1.0 - top)*(top - bottom)
       endif
     elseif mode==14 || mode==15;"Contrast" || "Reverse Contrast"
       if mode==15;"Reverse Contrast"
         top = 1.0 - top
       endif
       if top<0.5
         return 0.5 + 2.0 * top * (bottom - 0.5)
       else
         top = 2.0 * (top - 0.5)
         if bottom<0.5
           return bottom - 2.0*top*bottom*(0.5 - bottom)
         else
           return bottom + 2.0*top*(1.0 - bottom)*(bottom - 0.5)
         endif
       endif
     elseif mode==16;"Quantize"
       int nr = round(qmax - (qmax-qmin)*(2.0/(1.0 + top) - 1.0)) - 1
       return floor(bottom*(nr+0.999))/nr
     elseif mode==17;"Reverse Quantize"
       int nr = round(qmax - (qmax-qmin)*(2.0/(2.0 - top) - 1.0)) - 1
       return floor(bottom*(nr+0.999))/nr
     elseif mode==18;"Gamma"
       return bottom^(mingamma+(maxgamma-mingamma)*top)
     elseif mode==19;"Inverse Gamma"
       return bottom^(1.0/(mingamma+(maxgamma-mingamma)*top))
     elseif mode==20;"Reverse Gamma"
       return bottom^(mingamma+(maxgamma-mingamma)*(1.0-top))
     elseif mode==21;"Rev. Inv. Gamma"
       return bottom^(1.0/(mingamma+(maxgamma-mingamma)*(1.0-top)))
     elseif mode==22;"Combined Gamma"
       if top<0.5
         return bottom^(mingamma+2.0*(maxgamma-mingamma)*(0.5-top))
       else
         return bottom^(1.0/(mingamma+2.0*(maxgamma-mingamma)*(top-0.5)))
       endif
     elseif mode==23;"Rev. Comb. Gamma"
       if top<0.5
         return bottom^(1.0/(mingamma+2.0*(maxgamma-mingamma)*(0.5-top)))
       else
         return bottom^(mingamma+2.0*(maxgamma-mingamma)*(top-0.5))
       endif
     elseif mode==24;"Stamp"
       top = bottom + 2.0*top - 1.0
       if top<0.0
         return 0.0
       elseif top>1.0
         return 1.0
       endif
       return top
     elseif mode==25;"Soft Dodge"
       if bottom<=0
         return 0.0
       elseif bottom+top<=1.0
         if top>=1.0
           return 1.0
         elseif (top = 0.5*bottom/(1.0 - top))>1.0
           return 1.0
         endif
       elseif (top = 1.0 - 0.5*(1.0 - top)/bottom)<0.0
         return 0.0
       endif
       return top
     elseif mode==26;"Soft Burn"
       if top<=0
         return 0.0
       elseif top+bottom<=1.0
         if bottom>=1.0
           return 1.0
         elseif (top = 0.5*top/(1.0 - bottom))>1.0
           return 1.0
         endif
       elseif (top = 1.0 - 0.5*(1.0 - bottom)/top)<0.0
         return 0.0
       endif
       return top
     elseif mode==27;"Inverse Dodge"
 ; Here we clamp the maximum returned to 1.0 because of the special case
 ; when the color channel in ptop is one (or more).
       bottom = 1.0 - bottom
       if top<=0
         return 0
       elseif bottom<=0.0
         return 1.0
       else
         top = top/bottom
         if top>1.0
           return 1.0
         endif
         return top
       endif
     elseif mode==28;"Inverse Burn"
 ; Here we clamp the minimum returned to 0 because of the special case
 ; when the color channel in ptop is zero (or less).
       if bottom<=0.0
         return 0.0
       else
         top = 1.0 - (1.0 - top)/bottom
         if top<0.0
           return 0.0
         endif
         return top
       endif
     elseif mode==29;"Glow"
 ; Here we clamp the maximum returned to 1.0 because of the special case
 ; when the color channel in ptop is one (or more).
       bottom = 1.0 - bottom
       if top<=0
         return 0.0
       elseif bottom<=0.0
         return 1.0
       else
         top = sqr(top)/bottom
         if top>1.0
           return 1.0
         endif
         return top
       endif
     elseif mode==30;"Heat"
 ; Here we clamp the minimum returned to 0 because of the special case
 ; when the color channel in ptop is zero (or less).
       if bottom<=0.0
         return 0.0
       else
         top = 1.0 - sqr(1.0 - top)/bottom
         if top<0.0
           return 0.0
         endif
         return top
       endif
     elseif mode==31;"Inv. Fade Down"
       return bottom * (1 - bottom + top)
     elseif mode==32;"Inv. Fade Up"
       return top + bottom*(bottom - top)
     elseif mode==33;"Inv. Contrast Down"
       return 0.5 + bottom*(top - 0.5)
     elseif mode==34;"Inv. Contrast Up"
       if top<0.5
         return top - 2.0*bottom*top*(0.5 - top)
       else
         return top + 2.0*bottom*(1.0 - top)*(top - 0.5)
       endif
     elseif mode==35;"Inv. Rev. Con. Down"
       return 0.5 + (1.0 - bottom)*(top - 0.5)
     elseif mode==36;"Inv. Rev. Con. Up"
       if top<0.5
         return top - 2.0*(1.0 - bottom)*top*(0.5 - top)
       else
         return top + 2.0*(1.0 - bottom)*(1.0 - top)*(top - 0.5)
       endif
     elseif mode==37;"Inverse Fade"
       if bottom<0.5
         return 2.0 * bottom * (0.5 - bottom + top)
       else
         return top + 2.0 * (bottom - 0.5)*(bottom - top)
       endif
     elseif mode==38;"Inv. Rev. Fade"
       if bottom<0.5
         return top + 2.0 * bottom * (bottom - top)
       else
         return top + 2.0 * (1.0 - bottom)*(bottom - top)
       endif
     elseif mode==39 \
            || mode==40 ;"Inverse Contrast" || "Inv. Rev. Contrast"
       if mode==40
         bottom = 1.0 - bottom
       endif
       if bottom<0.5
         return 0.5 + 2.0 * bottom * (top - 0.5)
       else
         bottom = 2.0 * (bottom - 0.5)
         if top<0.5
           return top - 2.0*bottom*top*(0.5 - top)
         else
           return top + 2.0*bottom*(1.0 - top)*(top - 0.5)
         endif
       endif
     elseif mode==41;"Inverse Quantize"
       int nr = round(qmax - (qmax-qmin)*(2.0/(1.0 + bottom) - 1.0)) - 1
       return floor(top*(nr+0.999))/nr
     elseif mode==42;"Inv. Rev. Quantize"
       int nr = round(qmax - (qmax-qmin)*(2.0/(2.0 - bottom) - 1.0)) - 1
       return floor(top*(nr+0.999))/nr
     elseif mode==43;"Inv. Gamma"
       return top^(mingamma+(maxgamma-mingamma)*bottom)
     elseif mode==44;"Inv. Inverse Gamma"
       return top^(1.0/(mingamma+(maxgamma-mingamma)*bottom))
     elseif mode==45;"Inv. Reverse Gamma"
       return top^(mingamma+(maxgamma-mingamma)*(1.0-bottom))
     elseif mode==46;"Inv. Rev. Inv. Gamma"
       return top^(1.0/(mingamma+(maxgamma-mingamma)*(1.0-bottom)))
     elseif mode==47;"Inv. Combined Gamma"
       if bottom<0.5
         return top^(mingamma+2.0*(maxgamma-mingamma)*(0.5-bottom))
       else
         return top^(1.0/(mingamma+2.0*(maxgamma-mingamma)*(bottom-0.5)))
       endif
     elseif mode==48;"Inv. Rev. Comb. Gamma"
       if bottom<0.5
         return top^(1.0/(mingamma+2.0*(maxgamma-mingamma)*(0.5-bottom)))
       else
         return top^(mingamma+2.0*(maxgamma-mingamma)*(bottom-0.5))
       endif
     elseif mode==49;"Inverse Stamp"
       top = top + 2.0*bottom - 1.0
       if top<0.0
         return 0.0
       elseif top>1.0
         return 1.0
       endif
       return top
     elseif mode==50;"Pin Light"
       if (top>=0.5 && top<bottom) || (top<0.5 && top>bottom)
         return bottom
       endif
       return top
     elseif mode==51;"Reverse Pin Light"
       if (top>=0.5 && top>bottom) || (top<0.5 && top<bottom)
         return bottom
       endif
       return top
     elseif mode==52;"Inv. Pin Light"
       if (bottom>=0.5 && bottom<top) || (bottom<0.5 && bottom>top)
         return top
       endif
       return bottom
     elseif mode==53;"Inv. Rev. Pin Light"
       if (bottom>=0.5 && bottom>top) || (bottom<0.5 && bottom<top)
         return top
       endif
       return bottom
     elseif mode==54;"Soft Quantize"
       int nr = round(qmax - (qmax-qmin)*(2.0/(1.0 + top) - 1.0))
       return (1+2*floor(0.9999*nr*bottom))/(2*nr)
     elseif mode==55;"Rev. Soft Quantize"
       int nr = round(qmax - (qmax-qmin)*(2.0/(2.0 - top) - 1.0))
       return (1+2*floor(0.9999*nr*bottom))/(2*nr)
     elseif mode==56;"Inv. Soft Quantize"
       int nr = round(qmax - (qmax-qmin)*(2.0/(1.0 + bottom) - 1.0))
       return (1+2*floor(0.9999*nr*top))/(2*nr)
     elseif mode==57;"Inv. Rev. Soft Quantize"
       int nr = round(qmax - (qmax-qmin)*(2.0/(2.0 - bottom) - 1.0))
       return (1+2*floor(0.9999*nr*top))/(2*nr)
     elseif mode==58;"Inverse Subtraction"
       float r = top - bottom
       if r<0.0
         r = 0.0
       endif
       return r
     elseif mode==59;"Double"
       float r = (top+1.0)*bottom
       if r>1.0
         r = 1.0
       endif
       return r
     else;if mode==60;"Inverse Double"
       float r = (bottom+1.0)*top
       if r>1.0
         r = 1.0
       endif
       return r
     endif ; mode
 
   endfunc
 
 
 default:
   Title = "MMF RGB Colour Merge"
   int param v_mmfrgbcolormerge
     caption = "Version (MMF RGB Colour Merge)"
     enum = "1.0"
     default = 0
     hint = "This field is to absolutely ensure backward compatibility, \
             the default will always be set to the latest version, but \
             there may be some cases where an older effect that you like \
             is lost in an update and you could still use it by selecting \
             the older version number."
     visible = false
   endparam
   bool param clamp
     caption = "Clamp Values"
     default = false
     hint = "When enabled the RGB values in both the top and bottom colours \
             are clamped to the range 0<=v<=1. Should not be necessary most \
             of the time."
     visible = @p_modeselectred=="MMF Merge Modes" \
               || @p_modeselectgreen=="MMF Merge Modes" \
               || @p_modeselectblue=="MMF Merge Modes"
   endparam
   heading
     text = "Output Red"
   endheading
   int param redtop
     caption = "Red Top Colour"
     enum = "Red" "Green" "Blue"
     default = 0
     hint = "Choose which colour from the top layer is used to produce \
             the output red."
   endparam
   int param redbtm
     caption = "Red Bottom Colour"
     enum = "Red" "Green" "Blue"
     default = 0
     hint = "Choose which colour from the bottom layer is used to produce \
             the output red."
   endparam
   int param p_modeselectred
     caption = "Merge Modes for Red"
     enum = "Original Merge Modes" "MMF Merge Modes"
     default = 0
     hint = "Choose from different collections of merge modes."
   endparam
   color func f_mergemode
     caption = "Merge Mode (Red)"
     default = mergemultiply()
     hint = "Sets the method used to merge input colors with."
     visible = @p_modeselectred=="Original Merge Modes"
   endfunc
   int param p_mmfmergemodered
     caption = "MMF Merge Mode (Red)"
     enum = "Exclusion" "Fade Down" "Fade Up" "Contrast Down" "Contrast Up" \
            "Dodge" "Burn" "Negation" "Reflect" "Freeze" "Rev. Contrast Down" \
            "Rev. Contrast Up" "Fade" "Reverse Fade" "Contrast" \
            "Reverse Contrast" "Quantize" "Reverse Quantize" "Gamma" \
            "Inverse Gamma" "Reverse Gamma" "Rev. Inv. Gamma" "Combined Gamma" \
            "Rev. Comb. Gamma" "Stamp" "Soft Dodge" "Soft Burn" \
            "Inverse Dodge" "Inverse Burn" "Glow" "Heat" "Inv. Fade Down" \
            "Inv. Fade Up" "Inv. Contrast Down" "Inv. Contrast Up" \
            "Inv. Rev. Con. Down" "Inv. Rev. Con. Up" "Inverse Fade" \
            "Inv. Rev. Fade" "Inverse Contrast" "Inv. Rev. Contrast" \
            "Inverse Quantize" "Inv. Rev. Quantize" "Inv. Gamma" \
            "Inv. Inverse Gamma" "Inv. Reverse Gamma" "Inv. Rev. Inv. Gamma" \
            "Inv. Combined Gamma" "Inv. Rev. Comb. Gamma" "Inverse Stamp" \
            "Pin Light" "Reverse Pin Light" "Inv. Pin Light" \
            "Inv. Rev. Pin Light" "Soft Quantize" "Rev. Soft Quantize" \
            "Inv. Soft Quantize" "Inv. Rev. Soft Quantize" \
            "Inverse Subtraction" "Double" "Inverse Double"
     default = 0
     hint = "Extra merge modes, just try them out !"
     visible = @p_modeselectred=="MMF Merge Modes"
   endparam
   int param qminred
     caption =  "Minimum Quantize"
     default = 2
     min = 2
     hint = "Sets the minimum number of colour levels used after merging."
     visible = @p_modeselectred=="MMF Merge Modes" && \
               (@p_mmfmergemodered=="Quantize" \
               || @p_mmfmergemodered=="Reverse Quantize" \
               || @p_mmfmergemodered=="Inverse Quantize" \
               || @p_mmfmergemodered=="Inv. Rev. Quantize" \
               || @p_mmfmergemodered=="Soft Quantize" \
               || @p_mmfmergemodered=="Rev. Soft Quantize" \
               || @p_mmfmergemodered=="Inv. Soft Quantize" \
               || @p_mmfmergemodered=="Inv. Rev. Soft Quantize")
   endparam
   int param qmaxred
     caption = "Maximum Quantize"
     default = 32
     min = 2
     hint = "Sets the maximum number of colour levels used after merging. \
             Should be set larger than 'Minimum Quantize' for correct use."
     visible = @p_modeselectred=="MMF Merge Modes" && \
               (@p_mmfmergemodered=="Quantize" \
               || @p_mmfmergemodered=="Reverse Quantize" \
               || @p_mmfmergemodered=="Inverse Quantize" \
               || @p_mmfmergemodered=="Inv. Rev. Quantize" \
               || @p_mmfmergemodered=="Soft Quantize" \
               || @p_mmfmergemodered=="Rev. Soft Quantize" \
               || @p_mmfmergemodered=="Inv. Soft Quantize" \
               || @p_mmfmergemodered=="Inv. Rev. Soft Quantize")
   endparam
   float param mingammared
     caption = "Minimum Gamma"
     default = 1.0
     min = 1.0
     hint = "Sets the minimum gamma to be used, use 1.0 for 'no change'."
     visible = @p_modeselectred=="MMF Merge Modes" && \
               (@p_mmfmergemodered=="Gamma" \
               || @p_mmfmergemodered=="Inverse Gamma" \
               || @p_mmfmergemodered=="Reverse Gamma" \
               || @p_mmfmergemodered=="Rev. Inv. Gamma" \
               || @p_mmfmergemodered=="Combined Gamma" \
               || @p_mmfmergemodered=="Rev. Comb. Gamma" \
               || @p_mmfmergemodered=="Inv. Gamma" \
               || @p_mmfmergemodered=="Inv. Inverse Gamma" \
               || @p_mmfmergemodered=="Inv. Reverse Gamma" \
               || @p_mmfmergemodered=="Inv. Rev. Inv. Gamma" \
               || @p_mmfmergemodered=="Inv. Combined Gamma" \
               || @p_mmfmergemodered=="Inv. Rev. Comb. Gamma")
   endparam
   float param maxgammared
     caption = "Maximum Gamma"
     default = 2.0
     min = 1.0
     hint = "Sets the maximum gamma to be used. Should be set larger than \
             'Minimum Gamma' for correct use."
     visible = @p_modeselectred=="MMF Merge Modes" && \
               (@p_mmfmergemodered=="Gamma" \
               || @p_mmfmergemodered=="Inverse Gamma" \
               || @p_mmfmergemodered=="Reverse Gamma" \
               || @p_mmfmergemodered=="Rev. Inv. Gamma" \
               || @p_mmfmergemodered=="Combined Gamma" \
               || @p_mmfmergemodered=="Rev. Comb. Gamma" \
               || @p_mmfmergemodered=="Inv. Gamma" \
               || @p_mmfmergemodered=="Inv. Inverse Gamma" \
               || @p_mmfmergemodered=="Inv. Reverse Gamma" \
               || @p_mmfmergemodered=="Inv. Rev. Inv. Gamma" \
               || @p_mmfmergemodered=="Inv. Combined Gamma" \
               || @p_mmfmergemodered=="Inv. Rev. Comb. Gamma")
   endparam
   heading
     text = "Output Green"
   endheading
   int param greentop
     caption = "Green Top Colour"
     enum = "Red" "Green" "Blue"
     default = 1
     hint = "Choose which colour from the top layer is used to produce \
             the output green."
   endparam
   int param greenbtm
     caption = "Green Bottom Colour"
     enum = "Red" "Green" "Blue"
     default = 1
     hint = "Choose which colour from the bottom layer is used to produce \
             the output green."
   endparam
   int param p_modeselectgreen
     caption = "Merge Modes for Green"
     enum = "Original Merge Modes" "MMF Merge Modes"
     default = 0
     hint = "Choose from different collections of merge modes."
   endparam
   color func f_mergemodegreen
     caption = "Merge Mode (Green)"
     default = mergemultiply()
     hint = "Sets the method used to merge input colors with."
     visible = @p_modeselectgreen=="Original Merge Modes"
   endfunc
   int param p_mmfmergemodegreen
     caption = "MMF Merge Mode (Green)"
     enum = "Exclusion" "Fade Down" "Fade Up" "Contrast Down" "Contrast Up" \
            "Dodge" "Burn" "Negation" "Reflect" "Freeze" "Rev. Contrast Down" \
            "Rev. Contrast Up" "Fade" "Reverse Fade" "Contrast" \
            "Reverse Contrast" "Quantize" "Reverse Quantize" "Gamma" \
            "Inverse Gamma" "Reverse Gamma" "Rev. Inv. Gamma" "Combined Gamma" \
            "Rev. Comb. Gamma" "Stamp" "Soft Dodge" "Soft Burn" \
            "Inverse Dodge" "Inverse Burn" "Glow" "Heat" "Inv. Fade Down" \
            "Inv. Fade Up" "Inv. Contrast Down" "Inv. Contrast Up" \
            "Inv. Rev. Con. Down" "Inv. Rev. Con. Up" "Inverse Fade" \
            "Inv. Rev. Fade" "Inverse Contrast" "Inv. Rev. Contrast" \
            "Inverse Quantize" "Inv. Rev. Quantize" "Inv. Gamma" \
            "Inv. Inverse Gamma" "Inv. Reverse Gamma" "Inv. Rev. Inv. Gamma" \
            "Inv. Combined Gamma" "Inv. Rev. Comb. Gamma" "Inverse Stamp" \
            "Pin Light" "Reverse Pin Light" "Inv. Pin Light" \
            "Inv. Rev. Pin Light" "Soft Quantize" "Rev. Soft Quantize" \
            "Inv. Soft Quantize" "Inv. Rev. Soft Quantize" \
            "Inverse Subtraction" "Double" "Inverse Double"
     default = 0
     hint = "Extra merge modes, just try them out !"
     visible = @p_modeselectgreen=="MMF Merge Modes"
   endparam
   int param qmingreen
     caption =  "Minimum Quantize"
     default = 2
     min = 2
     hint = "Sets the minimum number of colour levels used after merging."
     visible = @p_modeselectgreen=="MMF Merge Modes" && \
               (@p_mmfmergemodegreen=="Quantize" \
               || @p_mmfmergemodegreen=="Reverse Quantize" \
               || @p_mmfmergemodegreen=="Inverse Quantize" \
               || @p_mmfmergemodegreen=="Inv. Rev. Quantize" \
               || @p_mmfmergemodegreen=="Soft Quantize" \
               || @p_mmfmergemodegreen=="Rev. Soft Quantize" \
               || @p_mmfmergemodegreen=="Inv. Soft Quantize" \
               || @p_mmfmergemodegreen=="Inv. Rev. Soft Quantize")
   endparam
   int param qmaxgreen
     caption = "Maximum Quantize"
     default = 32
     min = 2
     hint = "Sets the maximum number of colour levels used after merging. \
             Should be set larger than 'Minimum Quantize' for correct use."
     visible = @p_modeselectgreen=="MMF Merge Modes" && \
               (@p_mmfmergemodegreen=="Quantize" \
               || @p_mmfmergemodegreen=="Reverse Quantize" \
               || @p_mmfmergemodegreen=="Inverse Quantize" \
               || @p_mmfmergemodegreen=="Inv. Rev. Quantize" \
               || @p_mmfmergemodegreen=="Soft Quantize" \
               || @p_mmfmergemodegreen=="Rev. Soft Quantize" \
               || @p_mmfmergemodegreen=="Inv. Soft Quantize" \
               || @p_mmfmergemodegreen=="Inv. Rev. Soft Quantize")
   endparam
   float param mingammagreen
     caption = "Minimum Gamma"
     default = 1.0
     min = 1.0
     hint = "Sets the minimum gamma to be used, use 1.0 for 'no change'."
     visible = @p_modeselectgreen=="MMF Merge Modes" && \
               (@p_mmfmergemodegreen=="Gamma" \
               || @p_mmfmergemodegreen=="Inverse Gamma" \
               || @p_mmfmergemodegreen=="Reverse Gamma" \
               || @p_mmfmergemodegreen=="Rev. Inv. Gamma" \
               || @p_mmfmergemodegreen=="Combined Gamma" \
               || @p_mmfmergemodegreen=="Rev. Comb. Gamma" \
               || @p_mmfmergemodegreen=="Inv. Gamma" \
               || @p_mmfmergemodegreen=="Inv. Inverse Gamma" \
               || @p_mmfmergemodegreen=="Inv. Reverse Gamma" \
               || @p_mmfmergemodegreen=="Inv. Rev. Inv. Gamma" \
               || @p_mmfmergemodegreen=="Inv. Combined Gamma" \
               || @p_mmfmergemodegreen=="Inv. Rev. Comb. Gamma")
   endparam
   float param maxgammagreen
     caption = "Maximum Gamma"
     default = 2.0
     min = 1.0
     hint = "Sets the maximum gamma to be used. Should be set larger than \
             'Minimum Gamma' for correct use."
     visible = @p_modeselectgreen=="MMF Merge Modes" && \
               (@p_mmfmergemodegreen=="Gamma" \
               || @p_mmfmergemodegreen=="Inverse Gamma" \
               || @p_mmfmergemodegreen=="Reverse Gamma" \
               || @p_mmfmergemodegreen=="Rev. Inv. Gamma" \
               || @p_mmfmergemodegreen=="Combined Gamma" \
               || @p_mmfmergemodegreen=="Rev. Comb. Gamma" \
               || @p_mmfmergemodegreen=="Inv. Gamma" \
               || @p_mmfmergemodegreen=="Inv. Inverse Gamma" \
               || @p_mmfmergemodegreen=="Inv. Reverse Gamma" \
               || @p_mmfmergemodegreen=="Inv. Rev. Inv. Gamma" \
               || @p_mmfmergemodegreen=="Inv. Combined Gamma" \
               || @p_mmfmergemodegreen=="Inv. Rev. Comb. Gamma")
   endparam
   heading
     text = "Output Blue"
   endheading
   int param bluetop
     caption = "Blue Top Colour"
     enum = "Red" "Green" "Blue"
     default = 2
     hint = "Choose which colour from the top layer is used to produce \
             the output blue."
   endparam
   int param bluebtm
     caption = "Blue Bottom Colour"
     enum = "Red" "Green" "Blue"
     default = 2
     hint = "Choose which colour from the bottom layer is used to produce \
             the output blue."
   endparam
   int param p_modeselectblue
     caption = "Merge Modes for Blue"
     enum = "Original Merge Modes" "MMF Merge Modes"
     default = 0
     hint = "Choose from different collections of merge modes."
   endparam
   color func f_mergemodeblue
     caption = "Merge Mode (Blue)"
     default = mergemultiply()
     hint = "Sets the method used to merge input colors with."
     visible = @p_modeselectblue=="Original Merge Modes"
   endfunc
   int param p_mmfmergemodeblue
     caption = "MMF Merge Mode (Blue)"
     enum = "Exclusion" "Fade Down" "Fade Up" "Contrast Down" "Contrast Up" \
            "Dodge" "Burn" "Negation" "Reflect" "Freeze" "Rev. Contrast Down" \
            "Rev. Contrast Up" "Fade" "Reverse Fade" "Contrast" \
            "Reverse Contrast" "Quantize" "Reverse Quantize" "Gamma" \
            "Inverse Gamma" "Reverse Gamma" "Rev. Inv. Gamma" "Combined Gamma" \
            "Rev. Comb. Gamma" "Stamp" "Soft Dodge" "Soft Burn" \
            "Inverse Dodge" "Inverse Burn" "Glow" "Heat" "Inv. Fade Down" \
            "Inv. Fade Up" "Inv. Contrast Down" "Inv. Contrast Up" \
            "Inv. Rev. Con. Down" "Inv. Rev. Con. Up" "Inverse Fade" \
            "Inv. Rev. Fade" "Inverse Contrast" "Inv. Rev. Contrast" \
            "Inverse Quantize" "Inv. Rev. Quantize" "Inv. Gamma" \
            "Inv. Inverse Gamma" "Inv. Reverse Gamma" "Inv. Rev. Inv. Gamma" \
            "Inv. Combined Gamma" "Inv. Rev. Comb. Gamma" "Inverse Stamp" \
            "Pin Light" "Reverse Pin Light" "Inv. Pin Light" \
            "Inv. Rev. Pin Light" "Soft Quantize" "Rev. Soft Quantize" \
            "Inv. Soft Quantize" "Inv. Rev. Soft Quantize" \
            "Inverse Subtraction" "Double" "Inverse Double"
     default = 0
     hint = "Extra merge modes, just try them out !"
     visible = @p_modeselectblue=="MMF Merge Modes"
   endparam
   int param qminblue
     caption =  "Minimum Quantize"
     default = 2
     min = 2
     hint = "Sets the minimum number of colour levels used after merging."
     visible = @p_modeselectblue=="MMF Merge Modes" && \
               (@p_mmfmergemodeblue=="Quantize" \
               || @p_mmfmergemodeblue=="Reverse Quantize" \
               || @p_mmfmergemodeblue=="Inverse Quantize" \
               || @p_mmfmergemodeblue=="Inv. Rev. Quantize" \
               || @p_mmfmergemodeblue=="Soft Quantize" \
               || @p_mmfmergemodeblue=="Rev. Soft Quantize" \
               || @p_mmfmergemodeblue=="Inv. Soft Quantize" \
               || @p_mmfmergemodeblue=="Inv. Rev. Soft Quantize")
   endparam
   int param qmaxblue
     caption = "Maximum Quantize"
     default = 32
     min = 2
     hint = "Sets the maximum number of colour levels used after merging. \
             Should be set larger than 'Minimum Quantize' for correct use."
     visible = @p_modeselectblue=="MMF Merge Modes" && \
               (@p_mmfmergemodeblue=="Quantize" \
               || @p_mmfmergemodeblue=="Reverse Quantize" \
               || @p_mmfmergemodeblue=="Inverse Quantize" \
               || @p_mmfmergemodeblue=="Inv. Rev. Quantize" \
               || @p_mmfmergemodeblue=="Soft Quantize" \
               || @p_mmfmergemodeblue=="Rev. Soft Quantize" \
               || @p_mmfmergemodeblue=="Inv. Soft Quantize" \
               || @p_mmfmergemodeblue=="Inv. Rev. Soft Quantize")
   endparam
   float param mingammablue
     caption = "Minimum Gamma"
     default = 1.0
     min = 1.0
     hint = "Sets the minimum gamma to be used, use 1.0 for 'no change'."
     visible = @p_modeselectblue=="MMF Merge Modes" && \
               (@p_mmfmergemodeblue=="Gamma" \
               || @p_mmfmergemodeblue=="Inverse Gamma" \
               || @p_mmfmergemodeblue=="Reverse Gamma" \
               || @p_mmfmergemodeblue=="Rev. Inv. Gamma" \
               || @p_mmfmergemodeblue=="Combined Gamma" \
               || @p_mmfmergemodeblue=="Rev. Comb. Gamma" \
               || @p_mmfmergemodeblue=="Inv. Gamma" \
               || @p_mmfmergemodeblue=="Inv. Inverse Gamma" \
               || @p_mmfmergemodeblue=="Inv. Reverse Gamma" \
               || @p_mmfmergemodeblue=="Inv. Rev. Inv. Gamma" \
               || @p_mmfmergemodeblue=="Inv. Combined Gamma" \
               || @p_mmfmergemodeblue=="Inv. Rev. Comb. Gamma")
   endparam
   float param maxgammablue
     caption = "Maximum Gamma"
     default = 2.0
     min = 1.0
     hint = "Sets the maximum gamma to be used. Should be set larger than \
             'Minimum Gamma' for correct use."
     visible = @p_modeselectblue=="MMF Merge Modes" && \
               (@p_mmfmergemodeblue=="Gamma" \
               || @p_mmfmergemodeblue=="Inverse Gamma" \
               || @p_mmfmergemodeblue=="Reverse Gamma" \
               || @p_mmfmergemodeblue=="Rev. Inv. Gamma" \
               || @p_mmfmergemodeblue=="Combined Gamma" \
               || @p_mmfmergemodeblue=="Rev. Comb. Gamma" \
               || @p_mmfmergemodeblue=="Inv. Gamma" \
               || @p_mmfmergemodeblue=="Inv. Inverse Gamma" \
               || @p_mmfmergemodeblue=="Inv. Reverse Gamma" \
               || @p_mmfmergemodeblue=="Inv. Rev. Inv. Gamma" \
               || @p_mmfmergemodeblue=="Inv. Combined Gamma" \
               || @p_mmfmergemodeblue=="Inv. Rev. Comb. Gamma")
   endparam
 }
 


Constructor Summary
MMF_RGBColorMerge()
           
MMF_RGBColorMerge(Generic pparent)
          
 
Method Summary
 color Merge(color pbottom, color ptop)
          
 float MergeChannels(float bottom, float top, int mode, int qmin, int qmax, float mingamma, float maxgamma)
           
 
Methods inherited from class common:ColorMerge
FullMerge, IsOpaque, Stack
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

MMF_RGBColorMerge

public MMF_RGBColorMerge(Generic pparent)

Parameters:
pparent - the parent, generally "this" for the parent, or zero

MMF_RGBColorMerge

public MMF_RGBColorMerge()
Method Detail

Merge

public color Merge(color pbottom,
                   color ptop)

Overrides:
Merge in class DefaultColorMerge
Parameters:
pbottom - the base color
ptop - the top color
Returns:
merged color

MergeChannels

public float MergeChannels(float bottom,
                           float top,
                           int mode,
                           int qmin,
                           int qmax,
                           float mingamma,
                           float maxgamma)