Older Newer
Mon, 30 Dec 2019 14:15:13 . . . . SyneRyder [formatting tweaks]


Changes by last author:

Added:
= pset =

== Syntax ==

int pset(int x, int y, int z, int v)

== Arguments ==

:x

::An integer pixel x-coordinate in the output buffer.

:y

::An integer pixel y-coordinate in the output buffer.

:z

::An integer channel number in the range 0 to Z - 1.

:v

::An integer value to be set for channel 'z'.

== Return ==

Returns the value of v, properly clamped to the range [0, 255] or [0, 0x8000], if the current pixel depth is 8 or 16 bits, respectively.

== Description ==

This function sets the value of one channel for a pixel in the output buffer to the properly clamped value of v. The pixel is at coordinates (x,y), and the channel to be set is given by 'z' (0 = red, 1 = green, 2 = blue, and 3 = alpha for the RGBA case).

If the coordinates (x,y) are outside the current image (i.e., x < 0 or x >= (X)? or y < 0 or y >= (Y)?), or if z < 0 or z >= Z, then the output buffer is not changed.

== Example ==

<code>

%ffp

ForEveryTile:

{

for (y=y_start; y<y_end; ++y)

{

for (x=x_start; x<x_end; ++x)

{

for (z=0; z<Z; ++z)

{

// set all pixels white!

pset(x, y, z, 255);

}

}

}

return true;

}

</code>

== See Also ==

tset, t2set, pget

== Comments ==

Everyone can add his or her comments about his or her experiences with this function here. Tips for using it are welcome, too.