MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / image_set_pixel

Function image_set_pixel

Source/astcenccli_toplevel.cpp:1363–1382  ·  view source on GitHub ↗

* @brief Set the value of a single pixel in an image. * * @param[out] img The output image; must use F32 texture components. * @param x The pixel x coordinate. * @param y The pixel y coordinate. * @param z The pixel z coordinate. * @param pixel The pixel color value to write. */

Source from the content-addressed store, hash-verified

1361 * @param pixel The pixel color value to write.
1362 */
1363static void image_set_pixel(
1364 astcenc_image& img,
1365 unsigned int x,
1366 unsigned int y,
1367 unsigned int z,
1368 vfloat4 pixel
1369) {
1370 // We should never escape bounds
1371 assert(x < img.dim_x);
1372 assert(y < img.dim_y);
1373 assert(z < img.dim_z);
1374 assert(img.data_type == ASTCENC_TYPE_F32);
1375
1376 float* data = static_cast<float*>(img.data[z]);
1377
1378 data[(4 * img.dim_x * y) + (4 * x )] = pixel.lane<0>();
1379 data[(4 * img.dim_x * y) + (4 * x + 1)] = pixel.lane<1>();
1380 data[(4 * img.dim_x * y) + (4 * x + 2)] = pixel.lane<2>();
1381 data[(4 * img.dim_x * y) + (4 * x + 3)] = pixel.lane<3>();
1382}
1383
1384/**
1385 * @brief Set the value of a single pixel in an image.

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected