A base class that defines the properties of a texture of resolution [x,y] for a given pixel format. More...
#include <itexture.h>
Inherits mi::base::Interface_declare< 0x633c679, ... >.
Public Types | |
enum | Pixel_format { RGBA_UINT8 = 0 , RGBA_FLOAT32 = 1 } |
Pixel format. More... | |
Public Member Functions | |
virtual mi::Uint32 | get_resolution_x () const =0 |
Get the horizontal resolution of the texture. More... | |
virtual mi::Uint32 | get_resolution_y () const =0 |
Get the vertical resolution of the texture. More... | |
virtual Pixel_format | get_pixel_format () const =0 |
Get the pixel format of the texture. More... | |
virtual bool | set_pixel_data (const void *pixel_data, mi::Uint32 width, mi::Uint32 height, Pixel_format format)=0 |
Set the texture data from a buffer. More... | |
virtual bool | set_pixel_data (const mi::neuraylib::ICanvas *canvas, Pixel_format format)=0 |
Set the texture data from a canvas. More... | |
virtual const void * | get_pixel_data () const =0 |
Get the texture data. More... | |
A base class that defines the properties of a texture of resolution [x,y] for a given pixel format.
The origin of the texture coordinate system is defined to be the lower-left corner.
|
pure virtual |
Get the texture data.
It returns a pointer to the raw texture data according to the pixel format.
The total size of the buffer in bytes is
where x
is the result of get_resolution_x(), y
is the result of get_resolution_y(), and t
is the size of a pixel of the type returned by get_pixel_format().
|
pure virtual |
Get the pixel format of the texture.
|
pure virtual |
Get the horizontal resolution of the texture.
|
pure virtual |
Get the vertical resolution of the texture.
|
pure virtual |
Set the texture data from a canvas.
[in] | canvas | Canvas from which the pixels will be copied. |
[in] | format | The pixel format of the texture. If the pixel type of the canvas is different, its data will be converted accordingly. |
|
pure virtual |
Set the texture data from a buffer.
[in] | pixel_data | Raw pixel data, this will be be copied. |
[in] | width | The horizontal resolution of the texture. |
[in] | height | The vertical resolution of the texture. |
[in] | format | The pixel format of the texture. |
The total size in bytes of the buffer referenced by pixel_data
must be
where t
is the size of a pixel according to format
.