#screenpixel (predefined symbol)

Type Readable Writeable Constant
complex Always, except in global sections Never No

This predefined symbol contains the pixel coordinates of the pixel currently being calculated, packed in a complex number. The real part contains the x-coordinate; the imaginary part contains the y-coordinate. These coordinates can also be accessed using the #x and #y predefined symbols, but there is an important difference.

The coordinates accessible through #screenpixel are float coordinates, while #x and #y contain int coordinates. For normal fractal calculations, this doesn’t matter. It does matter, however, when using the Render to Disk feature with anti-aliasing. In this case, Ultra Fractal can subdivide pixels and calculate pixels that actually fall between the physical pixels on the screen. The coordinates of these subdivided pixels cannot be properly expressed using int values, of course.

So if your formula uses the #x and #y predefined symbols, it won’t work properly with anti-aliasing. It will work properly with anti-aliasing if it uses the #screenpixel predefined symbol instead. You should decide how your formula should work and choose the right predefined symbol for the job. Of course, you can also experiment and see which choice works best with your formula.

Examples:

  float pix_x = real(#screenpixel)  float pix_y = imag(#screenpixel)    

Notes

  • When anti-aliasing, the real and imaginary parts of #screenpixel range from 0 up to and including #width and #height. If you use #screenpixel to index an array, you should declare the array with size [#width + 1, #height + 1].
  • This predefined symbol can also be accessed as scrnpix both with and without the # prefix for Fractint compatibility.

See Also
#x (predefined symbol)
#y (predefined symbol)
#pixel (predefined symbol)

#screenpixel