neuray Services API Programmer's Manual

mi::nservices::ICanvas Class Reference

[Types]

Description

This interface represents a canvas.

See also:

mi::neuraylib::ICanvas

Public Member Functions

virtual ICanvascrop( mi::Uint32 xl, mi::Uint32 yl, mi::Uint32 xh, mi::Uint32 yh, const char* pixel_type = nullptr) const =0
Returns a copy of this canvas cropped to the region bounded by xl (left edge), yl (bottom edge), xh (right edge) and yh (top edge). More...
virtual neuraylib::ICanvasget_canvas() const =0
Returns the canvas.
virtual ICanvasresize( Scaling_mode mode, mi::Uint32 resolution_x, mi::Uint32 resolution_y) const =0
Returns a copy of this canvas resized to resolution_x x resolution_y pixels. More...
virtual void set_canvas( neuraylib::ICanvas* canvas) =0
Sets the canvas to be used.

Member Functions

virtual ICanvas* mi::​nservices::​ICanvas::crop( mi::Uint32 xl, mi::Uint32 yl, mi::Uint32 xh, mi::Uint32 yh, const char* pixel_type = nullptr) const [pure virtual]

Returns a copy of this canvas cropped to the region bounded by xl (left edge), yl (bottom edge), xh (right edge) and yh (top edge). Values are relative to the bottom left corner of the image in raster space. If a pixel_type is specified then the canvas will be converted to the specified pixel type during the cropping process. By default the pixel type is retained.

Parameters

xl
the left edge of the crop region
yl
the bottom edge of the crop region
xh
the right edge of the crop region
yh
the top edge of the crop region
pixel_type
the pixel type used for the cropped image (retains existing pixel type by default)

Returns

the cropped canvas or NULL on error, errors include no underlying neuraylib canvas, any edge out of bounds, empty crop region or unsupported pixel_type .

virtual neuraylib::ICanvas* mi::​nservices::​ICanvas::get_canvas() const [pure virtual]

Returns the canvas.

virtual ICanvas* mi::​nservices::​ICanvas::resize( Scaling_mode mode, mi::Uint32 resolution_x, mi::Uint32 resolution_y) const [pure virtual]

Returns a copy of this canvas resized to resolution_x x resolution_y pixels. This method is optimized to simply clone the canvas if the requested resolution matches the current resolution.

Parameters

mode
the filtering mode to use
resolution_x
the target canvas size in x direction. If zero then current x resolution is preserved.
resolution_y
the target canvas size in y direction. If zero then current y resolution is preserved.

Returns

the resized canvas or NULL on error, errors include invalid mode or no underlying neuraylib canvas.

virtual void mi::​nservices::​ICanvas::set_canvas( neuraylib::ICanvas* canvas) [pure virtual]

Sets the canvas to be used.