neuray API Programmer's Manual

mi::neuraylib::ICanvas Class Reference

[Miscellaneous]

Description

Abstract interface for a canvas represented by a rectangular array of tiles. A canvas represents a two-dimensional array of pixels. The size of this array is given by mi::neuraylib::ICanvas_base::get_resolution_x() and mi::neuraylib::ICanvas_base::get_resolution_y(). The pixels are grouped in rectangular tiles of size get_tile_resolution_x() and get_tile_resolution_y(). The number of tiles is given by get_tiles_size_x() and get_tiles_size_y() and it holds

get_tiles_size_x() * get_tile_resolution_x() >= get_resolution_x()
     get_tiles_size_y() * get_tile_resolution_y() >= get_resolution_y()

If the left-hand side is strictly larger than the right hand side then there are excess pixels which might have any color.

A pixel at position (canvas_pixel_x, canvas_pixel_y) of the canvas belongs to the tile (tile_number_x, tile_number_y) where tile_number_x and tile_number_y are computed as follows:

‎     tile_number_x = canvas_pixel_x / get_tile_resolution_x()
     tile_number_y = canvas_pixel_y / get_tile_resolution_y()

Within this tile the pixel has the coordinates (tile_pixel_x, tile_pixel_y) which are computed as follows

‎     tile_pixel_x = canvas_pixel_x % get_tile_resolution_x()
     tile_pixel_y = canvas_pixel_y % get_tile_resolution_y()

Optionally, there can be multiple layers of such tile arrays. The number of these layers is given by get_layers_size(). The format a layer, i.e., the type of each pixel in that layer, is described by get_type().

See also:

mi::neuraylib::ICanvas_base

Public Member Functions

virtual Float32 get_gamma() const =0
Returns the gamma value. More...
virtual Uint32 get_layers_size() const =0
Returns the number of layers this canvas has.
virtual const ITileget_tile( Uint32 pixel_x, Uint32 pixel_y, Uint32 layer = 0) const =0
Returns the tile which contains a given pixel. More...
virtual ITileget_tile( Uint32 pixel_x, Uint32 pixel_y, Uint32 layer = 0) =0
Returns the tile which contains a given pixel. More...
virtual Uint32 get_tile_resolution_x() const =0
Returns the tile size in x direction.
virtual Uint32 get_tile_resolution_y() const =0
Returns the tile size in y direction.
virtual Uint32 get_tiles_size_x() const =0
Returns the number of tiles in x direction.
virtual Uint32 get_tiles_size_y() const =0
Returns the number of tiles in y direction.
virtual void set_gamma( Float32 gamma) =0
Sets the gamma value. More...

Member Functions

virtual Float32 mi::​neuraylib::​ICanvas::get_gamma() const [pure virtual]

Returns the gamma value. The gamma value should be a positive number. Typical values are 2.2 for LDR pixel types, and 1.0 for HDR pixel types.

virtual Uint32 mi::​neuraylib::​ICanvas::get_layers_size() const [pure virtual]

Returns the number of layers this canvas has.

virtual const ITile* mi::​neuraylib::​ICanvas::get_tile( Uint32 pixel_x, Uint32 pixel_y, Uint32 layer = 0) const [pure virtual]

Returns the tile which contains a given pixel.

Parameters

pixel_x
The x coordinate of pixel with respect to the canvas.
pixel_y
The y coordinate of pixel with respect to the canvas.
layer
The layer of the pixel in the canvas.

Returns

The tile that contains the pixel, or NULL in case of invalid parameters.

virtual ITile* mi::​neuraylib::​ICanvas::get_tile( Uint32 pixel_x, Uint32 pixel_y, Uint32 layer = 0) [pure virtual]

Returns the tile which contains a given pixel.

Parameters

pixel_x
The x coordinate of pixel with respect to the canvas.
pixel_y
The y coordinate of pixel with respect to the canvas.
layer
The layer of the pixel in the canvas.

Returns

The tile that contains the pixel, or NULL in case of invalid parameters.

virtual Uint32 mi::​neuraylib::​ICanvas::get_tile_resolution_x() const [pure virtual]

Returns the tile size in x direction.

virtual Uint32 mi::​neuraylib::​ICanvas::get_tile_resolution_y() const [pure virtual]

Returns the tile size in y direction.

virtual Uint32 mi::​neuraylib::​ICanvas::get_tiles_size_x() const [pure virtual]

Returns the number of tiles in x direction.

virtual Uint32 mi::​neuraylib::​ICanvas::get_tiles_size_y() const [pure virtual]

Returns the number of tiles in y direction.

virtual void mi::​neuraylib::​ICanvas::set_gamma( Float32 gamma) [pure virtual]

Sets the gamma value.

Note:

This method just sets the gamma value. It does not change the pixel data itself.