reb
Class REB_EmbossFilter

Object
  extended by common:Generic
      extended by dmj5:DMJ_ConvolutionFilter
          extended by reb:REB_EmbossFilter

class 
DMJ_ConvolutionFilter:REB_EmbossFilter

Basic Emboss filter.


Ultra Fractal Source

Toggle UF Source Code Display

 class REB_EmbossFilter(dmj5.ulb:DMJ_ConvolutionFilter) {
   ; Basic Emboss filter. <br>
     
 public:
   import "common.ulb"
   import "dmj5.ulb"
   
   ; contructor
   func REB_EmbossFilter(Generic pparent)
     DMJ_ConvolutionFilter.DMJ_ConvolutionFilter(pparent)
     
     int count = (@p_samples*2+1)
     int elements = sqr(count)
     setLength(m_Offsets, elements)
     setLength(m_Weights, elements)
     m_Bias = @p_bias
     if  @v_embossfilter < 101 && @pgray
       m_bias = m_bias + 0.5
     else
       if @etype != "full color"
         m_bias = m_bias + 0.5
       endif
     endif
     m_Multiplier = 0.0
     complex v = @p_radius * ((0,1) ^ (@p_angle / 90.0)) / @p_samples
 
     int j = -@p_samples
     int k = 0
     int l = 0
     while (j <= @p_samples)
       k = -@p_samples
       while (k <= @p_samples)
         if @v_embossfilter < 101
            m_Offsets[l] = v * j/100
           m_Weights[l] = (k-j)
           if @pgray
             m_Offsets[l] = v * j/100 * (0.5/@p_samples^2)
           endif
           if (j == 0 && k == 0) && !@pgray
              m_weights[l] = m_multiplier
           endif
         else
           if @etype == "full color"
             m_Offsets[l] = v * j/100
             m_Weights[l] = (k-j)
           elseif @etype == "pseudo gray"
             m_Offsets[l] = v * j/100 * (0.5/@p_samples^2)
             m_Weights[l] = (k-j)
           elseif @etype == "Laplacian"
             m_Offsets[l] = v * j/100
             if (l % 2 == 0) &&  !(j == 0 && k == 0) && (abs(j) == abs(k))
               m_Weights[l] = -1
             endif
           elseif @etype == "corner"
             m_Offsets[l] = v * j/100
             if k <= 0 && j < 0
               m_Weights[l] = 1
             endif
             if k > 0 && j >= 0
               m_Weights[l] = -1
             endif
           elseif @etype == "extrude"
             m_Offsets[l] = v * j/100
             if j == -@p_samples
               m_Weights[l] = 1
             endif
             if j == @p_samples
               m_Weights[l] = -1
             endif
           endif
           if (j == 0 && k == 0)
             if @etype == "full color"
               m_weights[l] = m_multiplier
             elseif @etype == "Laplacian"
               m_weights[l] = @p_samples*4
             endif
           endif
         endif  
         m_Multiplier = m_Multiplier + m_Weights[l]
         l = l + 1
         k = k + 1
       endwhile
       j = j + 1
     endwhile
     if m_Multiplier == 0
       m_multiplier = 1
     endif
     m_Multiplier = 1 / m_Multiplier
   endfunc
   
 default:
   title = "Emboss Filter"
 
   int param v_embossfilter
     caption = "Version (Emboss Filter)"
     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_embossfilter < 101
   endparam
   float param p_bias
     caption = "bias"
     default = 0
   endparam
   param etype
     caption = "Emboss Type"
     default = 0
     enum = "full color" "pseudo gray" "Laplacian" "corner" "extrude"
     visible = @v_embossfilter >= 101
   endparam
   bool param pgray
     caption = "Pseudo gray"
     default = false
     visible = @v_embossfilter < 101
   endparam
   float param p_angle
     caption = "Angle"
     default = 60.0
   endparam
   float param p_radius
     caption = "Filter Radius"
     default = 0.1
   endparam
   int param p_samples
     caption = "Sample Density"
     default = 2
     min = 1
     max = 9
   endparam
 }
 


Constructor Summary
REB_EmbossFilter()
           
REB_EmbossFilter(Generic pparent)
          contructor
 
Method Summary
 
Methods inherited from class dmj5:DMJ_ConvolutionFilter
Init
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

REB_EmbossFilter

public REB_EmbossFilter(Generic pparent)
contructor


REB_EmbossFilter

public REB_EmbossFilter()