|
MaterialX 1.38.2
|
Class representing an image in system memory. More...
#include <Image.h>
Public Types | |
| enum class | BaseType { UINT8 = 0 , UINT16 = 1 , HALF = 2 , FLOAT = 3 } |
Public Member Functions | |
Property Accessors | |
| unsigned int | getWidth () const |
| Return the width of the image. | |
| unsigned int | getHeight () const |
| Return the height of the image. | |
| unsigned int | getChannelCount () const |
| Return the channel count of the image. | |
| BaseType | getBaseType () const |
| Return the base type of the image. | |
| unsigned int | getBaseStride () const |
| Return the stride of our base type in bytes. | |
| unsigned int | getRowStride () const |
| Return the stride of an image row in bytes. | |
| unsigned int | getMaxMipCount () const |
| Return the maximum number of mipmaps for this image. | |
Texel Accessors | |
| void | setTexelColor (unsigned int x, unsigned int y, const Color4 &color) |
| Set the texel color at the given coordinates. More... | |
| Color4 | getTexelColor (unsigned int x, unsigned int y) const |
| Return the texel color at the given coordinates. More... | |
Image Analysis | |
| Color4 | getAverageColor () |
| Compute the average color of the image. | |
| bool | isUniformColor (Color4 *uniformColor=nullptr) |
| Return true if all texels of this image are identical in color. More... | |
Image Processing | |
| void | setUniformColor (const Color4 &color) |
| Set all texels of this image to a uniform color. | |
| ImagePtr | applyBoxBlur () |
| Apply a 3x3 box blur to this image, returning a new blurred image. | |
| ImagePtr | applyGaussianBlur () |
| Apply a 7x7 Gaussian blur to this image, returning a new blurred image. | |
| ImagePair | splitByLuminance (float luminance) |
| Split this image by the given luminance threshold, returning the resulting underflow and overflow images. | |
| void | writeTable (const FilePath &filePath, unsigned int channel) |
| Save a channel of this image to disk as a text table, in a format that can be used for curve and surface fitting. | |
Resource Buffers | |
| void | setResourceBuffer (void *buffer) |
| Set the resource buffer for this image. | |
| void * | getResourceBuffer () const |
| Return the resource buffer for this image. | |
| void | createResourceBuffer () |
| Allocate a resource buffer for this image that matches its properties. | |
| void | releaseResourceBuffer () |
| Release the resource buffer for this image. | |
| void | setResourceBufferDeallocator (ImageBufferDeallocator deallocator) |
| Set the resource buffer deallocator for this image. | |
| ImageBufferDeallocator | getResourceBufferDeallocator () const |
| Return the resource buffer deallocator for this image. | |
Resource IDs | |
| void | setResourceId (unsigned int id) |
| Set the resource ID for this image. | |
| unsigned int | getResourceId () const |
| Return the resource ID for this image. | |
Static Public Member Functions | |
| static ImagePtr | create (unsigned int width, unsigned int height, unsigned int channelCount, BaseType baseType=BaseType::UINT8) |
| Create an empty image with the given properties. | |
Protected Member Functions | |
| Image (unsigned int width, unsigned int height, unsigned int channelCount, BaseType baseType) | |
Protected Attributes | |
| unsigned int | _width |
| unsigned int | _height |
| unsigned int | _channelCount |
| BaseType | _baseType |
| void * | _resourceBuffer |
| ImageBufferDeallocator | _resourceBufferDeallocator |
| unsigned int | _resourceId |
Class representing an image in system memory.
| Color4 getTexelColor | ( | unsigned int | x, |
| unsigned int | y | ||
| ) | const |
Return the texel color at the given coordinates.
If the coordinates or image resource buffer are invalid, then an exception is thrown.
| bool isUniformColor | ( | Color4 * | uniformColor = nullptr | ) |
Return true if all texels of this image are identical in color.
| uniformColor | Return the uniform color of the image, if any. |
| void setTexelColor | ( | unsigned int | x, |
| unsigned int | y, | ||
| const Color4 & | color | ||
| ) |
Set the texel color at the given coordinates.
If the coordinates or image resource buffer are invalid, then an exception is thrown.