Older Newer
Wed, 21 May 2008 08:21:01 . . . . afh [minor corrections]


Changes by last author:

Added:
= pget =

== Syntax ==

:int pget(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: 0->red, 1->green, 2->blue, 3->alpha.

== Return ==

:The integer value of the specified pixel for the specified channel, in the output buffer.

== Description ==

:This function retrieves the value of a specified channel 'z' from the image pixel at position (x,y) in the output buffer; in effect, it serves a similar purpose to the src() function, but retrieves from the output buffer rather than the source image. The 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 3 inclusive. Channels 0, 1 and 2 are the red, green and blue channels respectively, while channel 3 is the alpha (transparency) channel and is valid only on a layer. Note that use of the pget() function in the ForEveryTile handler forces FilterMeister to handle the image as a single (and possibly large) tile.

== Example ==

<code>

// Shift the whole image one pixel left

%ffp

R,G,B: pget(x+1, y, z)

A: a

</code>

== Also see ==

:src, 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. At the start of the filter the output buffer is the same as the original image, which is why they seem identical. pget is useful for times when you modify the output, but still need data from the original image.