ImagePixelStorageInterface Class Reference

#include <gfx_image_storage.h>

Inheritance diagram for ImagePixelStorageInterface:

Detailed Description

Object that can store pixel data in a special layout (e.g. compact, plain, or tiles).

Public Member Functions

MAXON_METHOD Result< void > Init (Int width, Int height, const PixelFormat &format, const Block< Pix > *defaultColor)
 
MAXON_METHOD Int GetWidth () const
 
MAXON_METHOD Int GetHeight () const
 
MAXON_METHOD Int GetChannelCount () const
 
MAXON_METHOD PixelFormat GetPixelFormat () const
 
MAXON_METHOD Result< GetPixelHandlerStructGetPixelHandler (const PixelFormat &dstFormat, const ChannelOffsets &channelOffsets, const ColorProfile &srcColorProfile, const ColorProfile &dstColorProfile, GETPIXELHANDLERFLAGS flags) const
 
MAXON_METHOD Result< SetPixelHandlerStructSetPixelHandler (const PixelFormat &srcFormat, const ChannelOffsets &channelOffsets, const ColorProfile &srcColorProfile, const ColorProfile &dstColorProfile, SETPIXELHANDLERFLAGS flags, const Delegate< void(const UpdateRegion &)> &updateRegionNotification)
 
MAXON_METHOD Result< void > GetComponent (Int component, const ImagePos &pos, Pix *data, Int inc, GETPIXELFLAGS flags) const
 
MAXON_METHOD Result< void > SetComponent (Int component, const ImagePos &pos, const Pix *data, Int inc, SETPIXELFLAGS flags)
 

Private Member Functions

 MAXON_INTERFACE (ImagePixelStorageInterface, MAXON_REFERENCE_COPY_ON_WRITE, "net.maxon.image.interface.imagepixelstorage", MAXON_IMPLEMENTATION_MODULE("net.maxon.image"))
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( ImagePixelStorageInterface  ,
MAXON_REFERENCE_COPY_ON_WRITE  ,
"net.maxon.image.interface.imagepixelstorage"  ,
MAXON_IMPLEMENTATION_MODULE("net.maxon.image")   
)
private

◆ Init()

MAXON_METHOD Result<void> Init ( Int  width,
Int  height,
const PixelFormat &  format,
const Block< Pix > *  defaultColor 
)

Initializes the pixel storage.

Parameters
[in]widthWidth of the image data.
[in]heightHeight of the image data.
[in]formatPixel format of the pixel storage, e.g. ImagePixelStorageClasses::Normal.
[in]defaultColorOptional default color to return if no image data is present. Must be in the given PixelFormat. Can be nullptr.
Returns
OK on success.

◆ GetWidth()

MAXON_METHOD Int GetWidth ( ) const

Returns the width of the pixel storage.

◆ GetHeight()

MAXON_METHOD Int GetHeight ( ) const

Returns the height of the pixel storage.

◆ GetChannelCount()

MAXON_METHOD Int GetChannelCount ( ) const

Returns the total number of channels of the pixel storage.

◆ GetPixelFormat()

MAXON_METHOD PixelFormat GetPixelFormat ( ) const

Returns the pixel format connected to this pixel storage.

◆ GetPixelHandler()

MAXON_METHOD Result<GetPixelHandlerStruct> GetPixelHandler ( const PixelFormat &  dstFormat,
const ChannelOffsets channelOffsets,
const ColorProfile srcColorProfile,
const ColorProfile dstColorProfile,
GETPIXELHANDLERFLAGS  flags 
) const

To access pixel data a GetPixelHandlerStruct is needed. This optimizes the access to the pixel data see GetPixelHandlerStruct.

Parameters
[in]dstFormatDestination pixel format that should be read with this pixel handler.
[in]channelOffsetsDestination channel offset in bits.
[in]srcColorProfileOptional parameter which is only necessary if the color spaces of the given pixel formats doesn't match. In that case the conversion will be performed using the correct color conversion.
[in]dstColorProfileOptional parameter which is only necessary if the color spaces of the given pixel formats doesn't match. In that case the conversion will be performed using the correct color conversion.
[in]flagsFlags for the GetPixel operation.
Returns
A valid GetPixelHandlerStruct struct if successful.

◆ SetPixelHandler()

MAXON_METHOD Result<SetPixelHandlerStruct> SetPixelHandler ( const PixelFormat &  srcFormat,
const ChannelOffsets channelOffsets,
const ColorProfile srcColorProfile,
const ColorProfile dstColorProfile,
SETPIXELHANDLERFLAGS  flags,
const Delegate< void(const UpdateRegion &)> &  updateRegionNotification 
)

To access pixel data a SetPixelHandlerStruct is needed. This optimizes the access to the pixel data see SetPixelHandlerStruct.

Parameters
[in]srcFormatSource pixel format that should be written with this pixel handler.
[in]channelOffsetsSource channel offsets in bits.
[in]srcColorProfileOptional parameter which is only necessary if the color spaces of the given pixel formats doesn't match. In that case the conversion will be performed using the correct color conversion.
[in]dstColorProfileOptional parameter which is only necessary if the color spaces of the given pixel formats doesn't match. In that case the conversion will be performed using the correct color conversion.
[in]flagsFlags for the SetPixel operation.
Returns
A valid SetPixelHandlerStruct struct if successful.

◆ GetComponent()

MAXON_METHOD Result<void> GetComponent ( Int  component,
const ImagePos pos,
Pix data,
Int  inc,
GETPIXELFLAGS  flags 
) const

Access single components of the image.

Parameters
[in]componentIndex of the component.
[in]posImagePos of the data to read.
[in]dataDestination buffer.
[in]incDistance between 2 pixels in the destination buffer.
[in]flagsFlags to control the read operation.
Returns
OK on success.

◆ SetComponent()

MAXON_METHOD Result<void> SetComponent ( Int  component,
const ImagePos pos,
const Pix data,
Int  inc,
SETPIXELFLAGS  flags 
)

Access single components of the image.

Parameters
[in]componentIndex of the component.
[in]posImagePos of the data to write.
[in]dataSource buffer.
[in]incDistance between 2 pixels in the source buffer.
[in]flagsFlags to control the write operation.
Returns
OK on success.