neuray API Programmer's Manual

iimage_api.h File Reference

Description

API component for various image-related functions.

Code Example

iimage_api.h

‎/***************************************************************************************************
 * Copyright 2024 NVIDIA Corporation. All rights reserved.
 **************************************************************************************************/

#ifndef MI_NEURAYLIB_IIMAGE_API_H
#define MI_NEURAYLIB_IIMAGE_API_H

#include <mi/base/interface_declare.h>
#include <mi/neuraylib/version.h>

namespace mi {

class IArray;
class IMap;

namespace neuraylib {

class IBuffer;
class ICanvas;
class ICanvas_cuda;
class IReader;
class ITile;




























class IImage_api : public
    mi::base::Interface_declare<0x4c25a4f0,0x2bac,0x4ce6,0xb0,0xab,0x4d,0x94,0xbf,0xfd,0x97,0xa5>
{
public:


    virtual ITile* create_tile(
        const char* pixel_type,
        Uint32 width,
        Uint32 height) const = 0;

    virtual ICanvas* create_canvas(
        const char* pixel_type,
        Uint32 width,
        Uint32 height,
        Uint32 layers = 1,
        bool is_cubemap = false,
        Float32 gamma = 0.0f) const = 0;

#ifndef MI_SKIP_WITH_MDL_SDK_DOXYGEN
#else // MI_SKIP_WITH_MDL_SDK_DOXYGEN
#endif // MI_SKIP_WITH_MDL_SDK_DOXYGEN
    virtual ICanvas_cuda* create_canvas_cuda(
        Sint32 cuda_device_id,
        const char* pixel_type,
        Uint32 width,
        Uint32 height,
        Uint32 layers = 1,
        Float32 gamma = 0.0f) const = 0;

    virtual IArray* create_mipmap(
        const ICanvas* canvas, Float32 gamma_override = 0.0f) const = 0;

#ifdef MI_NEURAYLIB_DEPRECATED_14_0
    inline IArray* create_mipmaps(
        const ICanvas* canvas, Float32 gamma_override = 0.0f) const
    { return create_mipmap( canvas, gamma_override); }
#endif // MI_NEURAYLIB_DEPRECATED_14_0

    virtual ITile* clone_tile( const ITile* tile) const = 0;

    virtual ICanvas* clone_canvas( const ICanvas* canvas) const = 0;




    virtual Sint32 
               read_raw_pixels(
        Uint32 width,
        Uint32 height,
        const ICanvas* canvas,
        Uint32 canvas_x,
        Uint32 canvas_y,
        Uint32 canvas_layer,
        void* buffer,
        bool buffer_topdown,
        const char* buffer_pixel_type,
        Uint32 buffer_padding = 0) const = 0;

    virtual Sint32 
               write_raw_pixels(
        Uint32 width,
        Uint32 height,
        ICanvas* canvas,
        Uint32 canvas_x,
        Uint32 canvas_y,
        Uint32 canvas_layer,
        const void* buffer,
        bool buffer_topdown,
        const char* buffer_pixel_type,
        Uint32 buffer_padding = 0) const = 0;




    virtual IBuffer* create_buffer_from_canvas(
        const ICanvas* canvas,
        const char* image_format,
        const char* pixel_type,
        const IMap* export_options = 0) const = 0;

    virtual ICanvas* create_canvas_from_buffer(
        const IBuffer* buffer, const char* image_format, const char* selector = 0) const = 0;

    virtual ICanvas* create_canvas_from_reader(
        IReader* reader, const char* image_format, const char* selector = 0) const = 0;

    virtual bool supports_format_for_decoding(
        const char* image_format, IReader* reader = 0) const = 0;

    virtual bool supports_format_for_encoding( const char* image_format) const = 0;




    virtual ITile* convert( const ITile* tile, const char* pixel_type) const = 0;

    virtual ICanvas* convert( const ICanvas* canvas, const char* pixel_type) const = 0;

    virtual void adjust_gamma( ITile* tile, Float32 old_gamma, Float32 new_gamma) const = 0;

    virtual void adjust_gamma( ICanvas* canvas, Float32 new_gamma) const = 0;




    virtual Uint32 
               get_components_per_pixel( const char* pixel_type) const = 0;

    virtual Uint32 
               get_bytes_per_component( const char* pixel_type) const = 0;




    virtual const char* get_pixel_type_for_channel(
        const char* pixel_type, const char* selector) const = 0;

    virtual ICanvas* extract_channel( const ICanvas* canvas, const char* selector) const = 0;

    virtual ITile* extract_channel( const ITile* tile, const char* selector) const = 0;


    virtual IBuffer* deprecated_create_buffer_from_canvas(
        const ICanvas* canvas,
        const char* image_format,
        const char* pixel_type,
        const char* quality,
        bool force_default_gamma) const = 0;

#ifdef MI_NEURAYLIB_DEPRECATED_15_0
    inline IBuffer* create_buffer_from_canvas(
        const ICanvas* canvas,
        const char* image_format,
        const char* pixel_type,
        const char* quality,
        bool force_default_gamma = false) const
    {
        return deprecated_create_buffer_from_canvas(
            canvas, image_format, pixel_type, quality, force_default_gamma);
    }
#endif
};
 // end group mi_neuray_rendering / mi_neuray_rtmp

} // namespace neuraylib

} // namespace mi

#endif // MI_NEURAYLIB_IIMAGE_API_H

Namespaces

namespace 
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH. More...
namespace 
Namespace for the neuray API. More...

Classes

class 
This interface provides various utilities related to canvases and buffers. More...