Skip to content
Chung Leong edited this page Jan 10, 2022 · 3 revisions

sample_nearest - Nearest-neighbor interpolation

float[4] sample_nearest( image4 $image, float $x, float $y )

float[3] sample_nearest( image3 $image, float $x, float $y )

float[2] sample_nearest( image2 $image, float $x, float $y )

float[1] sample_nearest( image1 $image, float $x, float $y )

sample_nearest() samples an image at ( x, y ), returning the nearest pixel if the coordinates are off the grid.

Parameters:

image - The image to sample.

x - The horizontal position. It can be a scalar or an array.

y - The vertical position. It can be a scalar or an array.

Return Value:

Pixel value at ( x, y ). If either x or y is an array, multiple pixels are returned.

Version

1.0 and above.

Clone this wiki locally