icetImageGetColor(3)
π icetImageGetColor(3) β IceT Reference β¨
okay bestie, gather round, because today we're talking about icetImageGetColor and its little sibling icetImageGetDepth β the duo that pulls pixel data straight out of an image π
. This is from the IceT Reference, and it's lowkey one of the most useful things you'll ever touch, fr fr.
πΈ NAME πΈ
icetImageGetColor, icetImageGetDepth β retrieve pixel data buffer from image π
π¦ Synopsis π¦
#include <IceT.h>
IceTUByte * icetImageGetColorub ( IceTImage image );
IceTUInt * icetImageGetColorui ( IceTImage image );
IceTFloat * icetImageGetColorf ( IceTImage image );
IceTFloat * icetImageGetDepthf ( IceTImage image );
const IceTUByte * icetImageGetColorcub (
const IceTImage image );
const IceTUInt * icetImageGetColorcui (
const IceTImage image );
const IceTFloat * icetImageGetColorcf (
const IceTImage image );
const IceTFloat * icetImageGetDepthcf (
const IceTImage image );
β¨ Description β¨
So the icetImageGetColor suite of functions goes and gets you the color data from an image, and the icetImageGetDepth functions get you the depth data. Each one hands you back a pointer to a buffer that lives inside the image, no cap. π«Ά
Heads up bestie: writing to that data changes the data within the image object itself. It's not a copy, it's the real thing. π
You're supposed to use icetImageGetColor and icetImageGetDepth from inside drawing callbacks to pass image data back to IceT. That's the vibe. β¨
The pixel data is always tightly packed in horizontal major order. Color data that's made of tuples β like RGBA β has the components for each pixel packed together in that order. The first entry in the array corresponds to the pixel in the lower left corner of the image. The next entry is immediately to the right of the first pixel, and so on and so on. π
Wanna know the dimensions of that array? Use the icetImageGetWidth and icetImageGetHeight functions, queen. π
Each of these functions returns a typed version of the image data array, and they can only succeed if the type you're requesting matches the internal type of the array. Like, it is an error to request unsigned byte color data when the image stores images as floating point colors. Not me asking for the wrong type π.
You can use icetImageGetColorFormat and icetImageGetDepthFormat to retrieve the format for the internal data storage (which also implies the base data type). You can also use icetImageCopyColor and icetImageCopyDepth to convert the image data to whatever format you like. Options, options, iconic. π
Now let's break down each one, shall we:
icetImageGetColorubβ use this to retrieve an array of 8-bit unsigned bytes. Only valid if the color format isICET_IMAGE_COLOR_RGBA_UBYTE.icetImageGetColoruiβ use this to retrieve an array of 32-bit unsigned integers. Only valid if the color format isICET_IMAGE_COLOR_RGBA_UBYTE. In this case, each 32-bit integer represents all four RGBA channels. Accessing each pixel's color values as a single 32-bit integer is often faster than accessing it as 4 independent 8-bit integers, because most modern architectures can access 32-bit memory boundaries faster than independent 8-bit boundaries. Slay, architecture. π₯icetImageGetColorfβ use this to retrieve an array of floating point color values. Only valid if the color format isICET_IMAGE_COLOR_RGBA_FLOATorICET_IMAGE_COLOR_RGB_FLOAT.icetImageGetDepthfβ use this to retrieve an array of floating point depth values. Only valid if the depth format isICET_IMAGE_DEPTH_FLOAT.
π Return Value π
Returns an appropriately typed array pointing to the internal color or depth values stored in the image object. If there's an error, NULL is returned. π
The memory returned should not be freed. It's managed internally by IceT. Hands off, bestie. π«Ά
π Errors π
ICET_INVALID_OPERATIONβ the internal color or depth format is incompatible with the type of array the function retrieves. It's giving mismatch, and not the cute kind. π
π Warnings π
None. We're safe, we're unbothered, we're thriving. β¨
π§ Bugs π§
None known. Periodt. π
π Notes π
Okay so here's the tea: there is no mechanism to automatically determine the data type from the color or depth format enumeration (the one you get back from icetImageGetColorFormat or icetImageGetDepthFormat). Instead, you have to code your own internal logic to use an array of the appropriate type. π€
Why, you ask? The reasoning behind this decision is that the format encodes the data layout in addition to the data type, and your code must understand the basic semantics of the data to do anything worthwhile with it. If you want to write code that's indifferent to the underlying format of the image, use the icetImageCopyColor and icetImageCopyDepth functions to copy the data to a known format. iykyk π
π Copyright π
Copyright (C)2010 Sandia Corporation
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software.
This source code is released under the New BSD License.
π See Also π
icetImageCopyColor(3), icetImageCopyDepth(3), icetImageGetColorFormat(3), icetImageGetDepthFormat(3)
and that's the whole page, bestie β no cap, every last detail preserved π«Άπ this was the IceT Reference, dated March 13, 2018. go forth and get those pixels, you absolute icon β¨ππ
π¦ where this page comes from
- debian bookworm: paraview 5.11.0+dfsg-1+b1 Β· BSD-3-Clause
- debian trixie: paraview 5.13.2+dfsg-3 Β· BSD-3-Clause
- ubuntu jammy: paraview 5.10.0~rc1-1build3 Β· BSD-3-Clause
- ubuntu noble: paraview 5.11.2+dfsg-6build5 Β· BSD-3-Clause
- ubuntu questing: paraview 5.13.2+dfsg-3
- ubuntu resolute: paraview 6.0.1+dfsg1-7 Β· BSD-3-Clause
- ubuntu stonking: paraview 6.1.1+dfsg1-2build1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms