reb
Class ColorTrapImageTiles

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

class 
ColorTrap:ColorTrapImageTiles

ColorTrap Wrapper for Image Import

Image Import has a major defect in that many images are imported upside down. This ColorTrap provides the capability to rotate the image so that the original doesn't need to altered to be imported correctly. The image can also be scaled, offset and tiled. Image Import leaves a row of outside pixels without color, and so there is also a built-in capability to adjust the tiling.


Ultra Fractal Source

Toggle UF Source Code Display

 class ColorTrapImageTiles(common.ulb:ColorTrap) {
 ; ColorTrap Wrapper for Image Import <br>
 ; <p>
 ; Image Import has a major defect in that many images are imported upside down.
 ; This ColorTrap provides the capability to rotate the image so that the original
 ; doesn't need to altered to be imported correctly. The image can also be scaled,
 ; offset and tiled. Image Import leaves a row of outside pixels without color, and
 ; so there is also a built-in capability to adjust the tiling.
 ;
 public:
   import "common.ulb"
 
   ; constructor
   func ColorTrapImageTiles(Generic pparent)
     ColorTrap.ColorTrap(pparent)
     m_img = new @f_image(this)
     m_empty = m_img.GetEmpty()
   endfunc
 
   ; call for each iterated point
   color func Iterate(complex pz)
     ColorTrap.Iterate(pz)
       color pcolor = rgba(0,0,0,0)
       if !m_empty
         complex m_zi = (0,1)^(@iangle/90.0)
         complex m_zs = (0,1)^(@sangle/90.0)
         complex pzrs = pz
         ; offset
         if !@itile
           pzrs = pzrs+@ioffset
         endif
         ; aspect ratio
         pzrs = real(pzrs) + flip(imag(pzrs)*@iaspect)
         ; rotation
         pzrs = pzrs*m_zi
         ; skew
         pzrs = real(pzrs)*m_zs + flip(imag(pzrs))
 
         float width =  m_img.getWidth()
         float height = m_img.getHeight()
         if @itile
           if  @v_colortrapimagetiles >= 103
             pzrs = (pzrs+500+flip(500))*@scale*500
           else
             pzrs = (pzrs+#width/2+flip(#height/2))*@scale*#width
           endif
           complex c = @adjx-2*((real(pzrs) % (width-1))/width) + \
            flip(@adjy-2*((imag(pzrs) % (height-1))/height))
           pcolor = m_img.getColor(c)
         else
           pcolor = m_img.getColor(pzrs*@scale)
         endif
       endif
     return pcolor
   endfunc
 
   bool m_empty
 protected:
   ImageImport m_img
   int m_image_width
   int m_image_height
   float m_ratio
 
 default:
   title = "Color Trap Image Tiles"
   int param v_colortrapimagetiles
     caption = "Version (Color Trap Image Tiles)"
     default = 103
     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_colortrapimagetiles < 103
   endparam
   heading
     caption = "Image Parameters"
   endheading
   ImageImport param f_image
     caption = "Image"
     default = ImageImport
   endparam
   float param scale
     caption = "Image scale"
     default = 1
     min = 0
     hint = "Changes the scale of the image."
   endparam
   float param adjx
     caption = "Tile adj x"
     default = 0.99
     min = 0.9
     max = 1.1
   endparam
   float param adjy
     caption = "Tile adj y"
     default = 0.999
     min = 0.9
     max = 1.1
   endparam
   complex param ioffset
     caption = "Image offset"
     default = (0,0)
     visible = !@itile
   endparam
   float param iaspect
     caption = "Image aspect"
     default = 1.0
   endparam
   float param iangle
     caption = "Image rotation"
     default = 0
     hint = "Rotates the image"
   endparam
   float param sangle
     caption = "Image skew"
     default = 0
     hint = "Skews the image"
   endparam
   bool param itile
     caption = "Tile the image"
     default = false
   endparam
 }
 


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

Constructor Detail

ColorTrapImageTiles

public ColorTrapImageTiles(Generic pparent)
constructor


ColorTrapImageTiles

public ColorTrapImageTiles()
Method Detail

Iterate

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

Overrides:
Iterate in class ColorTrap