reb
Class REB_ImageTileTexture
Object
common:Generic
common:TrapShape
reb:REB_ImageTileTexture
class
- TrapShape:REB_ImageTileTexture
Uses an image to create a texture.
Converts the colors of an imported image to greyscale and then converts
the greyscale value to a complex number to use as a texture.
Ultra Fractal Source
Toggle UF Source Code Display
class REB_ImageTileTexture(common.ulb:TrapShape) {
;
; Uses an image to create a texture. <br>
; <p>
; Converts the colors of an imported image to greyscale and then converts
; the greyscale value to a complex number to use as a texture.
;
public:
import "common.ulb"
; Constructor
func REB_ImageTileTexture(Generic pparent)
TrapShape.TrapShape(pparent)
m_img = new @f_image(0)
m_empty = m_img.GetEmpty()
endfunc
; Call this for each iteration being trapped.
float func Iterate(complex pz)
TrapShape.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_trapshapeimagetiletexture >= 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
m_LastZ = exp(flip(2 * #pi * sqrt(2) * (1 - (0.3 * red(pcolor)+ 0.59 * green(pcolor) + 0.11 * blue(pcolor)))))
return 1 - (0.3 * red(pcolor)+ 0.59 * green(pcolor) + 0.11 * blue(pcolor))
endfunc
protected:
ImageImport m_img
int m_image_width
int m_image_height
float m_ratio
bool m_empty
default:
title = "Image Tile Texture"
int param v_trapshapeimagetiletexture
caption = "Version (Trap Shape Image Tile Texture)"
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_trapshapeimagetiletexture < 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
}
Method Summary |
float |
Iterate(complex pz)
Call this for each iteration being trapped. |
Methods inherited from class Object |
|
REB_ImageTileTexture
public REB_ImageTileTexture(Generic pparent)
- Constructor
REB_ImageTileTexture
public REB_ImageTileTexture()
Iterate
public float Iterate(complex pz)
- Call this for each iteration being trapped.
- Overrides:
Iterate
in class TrapShape