src

Syntax

int src(int x, int y, int z)

Arguments

x
The x coordinate of the pixel to be retrieved.
y
The y coordinate of the pixel to be retrieved.
z
The channel number to be retrieved for the pixel

Return

The integer value of the specified pixel for the specified channel.

Description

This function retrieves the value of a specified channel 'z' from the image pixel at position (x,y). The x and y coordinates should usually be within the image, i.e., 0 <= x < X and 0 <= y < Y, while the channel number z should be in the range 0 to Z - 1, where Z is the maximum number of channels in the image. For an image in the usual RGB color mode, channel z=0 is the red channel, z=1 is the green channel, and z=2 is the blue channel. If the RGB image has an alpha (transparency) channel, this is z=3. For images in different color modes (e.g., CMYK) the channels will be different. Note that use of the src() function in the ForEveryTile handler forces FilterMeister to handle the image as a single (and possibly large) tile.

Example

// A very simple slight blur!

%ffp

R,G,B: (src(x - 1, y, z) + src(x + 1, y, z)) / 2

A: a

Also see

pget, tget, t2get, pset, tset, t2set

Comments

How is pget different from src? src gets the pixel from the original image, while pget gets the pixel from the output buffer. Before your filter algorithm runs, the output buffer (i.e., the final output image) hasn't changed, which is why pget may seem identical to src at times. src is useful for times when you have modified the output, but still need data from the original image.