SOD C/C++ API Reference - Image Processing


void sod_img_set_pixel(sod_img input, int x, int y, int c, float val);


Replace pixel value at a given location. This value must be set between 0..1 such as 0.7.


sod_img    input

The input image to be processed. The image can be loaded from disk using sod_img_load_from_file(), from memory (i.e. network socket) via sod_img_load_from_mem() or dynamically created via sod_make_image().

int    x

The x-coordinate, in logical units, of the pixel to be set.

int    y

The y-coordinate, in logical units, of the pixel to be set.

int    c

The target color channel starting from 0 for Red, 1 for Green and 2 for Blue in a typical RGB colorspace. Note that in a grayscale image, this value must be set to 0.

float    val

The target value to be set/replaced at the selected location.

Return Value

None. If the coordinate is out-of-range then this function is a no-op.


Checkout the introduction course, the C/C++ samples on the download page or refer to the SOD Github Repository.

See also