dmj5
Class DMJ_Clipping

Object
  extended by common:Generic
      extended by common:Transform
          extended by common:UserTransform
              extended by dmj5:DMJ_Clipping

class 
UserTransform:DMJ_Clipping

Basic clipping framework transform.


Ultra Fractal Source

Toggle UF Source Code Display

 class DMJ_Clipping(common.ulb:UserTransform) {
   ; Basic clipping framework transform.
   
 public:
   import "common.ulb"
 
   func DMJ_Clipping(Generic pparent)
     UserTransform.UserTransform(pparent)
     
     m_ScreenRelative = new @f_screenrelative(this)
     m_Handles = new @f_handles(this)
     m_Handles.SetScreenRelative(m_ScreenRelative.GetScreenRelative())
     m_ClipShape = new @f_clipshape(this)
     m_ClipShape.SetHandles(m_Handles)
   endfunc
   
   func Init(complex pz)
     UserTransform.Init(pz)
     m_ScreenRelative.Init(pz)
     m_Handles.Init(pz)
     m_ClipShape.Init(pz)
   endfunc
   
   complex func Iterate(complex pz)
     UserTransform.Iterate(pz)
     
     bool inshape    ; flag for recording whether we're inside our shape
     bool inhandle    ; flag for recording whether we're inside a handle
     complex cz = pz    ; begin with pixel value
 
     ; apply screen-relative
     cz = m_ScreenRelative.Iterate(cz)
 
     ; apply offset
     cz = cz - ((0,1) ^ (@p_offsetangle / 90)) * @p_offsetamount
 
     ; see if point is in clipping shape
     cz = m_ClipShape.Iterate(cz)
     inshape = m_ClipShape.IsSolid()
     
     ; check handles
     cz = m_Handles.Iterate(cz)
     inhandle = m_Handles.IsSolid()
     
     ; merge results
     m_Solid = (inshape && !inhandle) || (!inshape && inhandle)
     if (@p_insideoutside == 1)
       m_Solid = !m_Solid
     endif
 
     return pz      ; return original value unchanged
   endfunc
   
 protected:
   DMJ_ScreenRelative m_ScreenRelative
   Handles m_Handles
   ClipShape m_ClipShape
 
 default:
   title = "Über Clipping"
 
   int param v_dmj_clipping
     caption = "Version (DMJ_Clipping)"
     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_dmj_clipping < 100
   endparam
 
   param p_insideoutside
     caption = "Clipping Region"
     default = 1
     enum = "inside" "outside"
     hint = "Determines whether points inside the clipping shape or outside the clipping shape will be solid-colored."
   endparam
   DMJ_ScreenRelative param f_screenrelative
     caption = "Screen Relative"
     selectable = false
   endparam
   float param p_offsetamount
     caption = "Offset Amount"
     default = 0.0
     hint = "If you need to shift your entire clipping region without altering its shape, you can specify an amount and a direction to offset it. Keep in mind that if you have an offset enabled, it will still be in effect while you use the eyedropper or explorer tools to select points."
   endparam
   float param p_offsetangle
     caption = "Offset Angle"
     default = 0.0
     visible = (@p_offsetamount != 0.0)
     hint = "Indicates the angle of the offset. Note that, if your image is rotated, and you're not using screen-relative clipping, offset angles will be rotated too. Normally an angle of 0 is to the right and 90 is up, if your image is not rotated."
   endparam
   float param p_rotation
     caption = "Rotation"
     default = 0.0
     hint = "Rotates the clipping shape. Note that, if you're using screen-relative coordinates and your image is not square, or if you've squashed or stretched the zoombox, the clipping shape will deform as you rotate it. Angles are in degrees, counter-clockwise."
   endparam
   param p_rotationtype
     caption = "Rotation Center"
     default = 0
     enum = "object center" "screen center" "specific point"
     visible = (@p_rotation != 0.0)
     hint = "Specifies around which point the object should be rotated. 'Object center' will try to determine a center point for the object, but for some complex object types this may not be the point you expect. 'Screen center' will always use the screen center, but this will cause your clipping shape to change if you zoom or pan your image. 'Specific point' will let you set an exact rotation center for your shape."
   endparam
   complex param p_rotationcenter
     caption = "Rotation Center"
     default = #center
     visible = (@p_rotation != 0.0 && @p_rotationtype == 2)
     hint = "Sets the center of rotation for your clip shape."
   endparam
   
   heading
     caption = "Handle Options"
     expanded = false
   endheading
   Handles param f_handles
     caption = "Handle Options"
     selectable = false
   endparam
 
   heading
     caption = "Clip Shape Options"
     expanded = true
   endheading
   ClipShape param f_clipshape
     caption = "Clipping Shape"
     default = DMJ_ClipShapeRectangle
     hint = "Selects the shape of the clipping region."
   endparam
 }
 


Constructor Summary
DMJ_Clipping()
           
DMJ_Clipping(Generic pparent)
           
 
Method Summary
 void Init(complex pz)
          Set up for a sequence of values
 complex Iterate(complex pz)
          Transform a single point within a sequence
 
Methods inherited from class common:Transform
IsSolid, IterateSilent
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

DMJ_Clipping

public DMJ_Clipping(Generic pparent)

DMJ_Clipping

public DMJ_Clipping()
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