PixelFormatIndexedColorInterface Class Reference

#include <gfx_image_pixelformat_indexed.h>

Inheritance diagram for PixelFormatIndexedColorInterface:

Detailed Description

PixelFormatIndexedColorInterface extends the PixelFormatInterface with the ability to handle color palettes/tables.

Public Member Functions

MAXON_METHOD Result< void > InitColorTable (Int count, const PixelFormat &srcFormatPtr)
 
MAXON_METHOD PixelFormat GetColorTablePixelFormat () const
 
MAXON_METHOD Int GetColorTableSize () const
 
MAXON_METHOD Result< void > SetIndex (Int idx, const ImageConstBuffer &srcPixelData)
 
MAXON_METHOD Result< void > GetIndex (Int idx, const ImageMutableBuffer &dstPixelData) const
 

Private Member Functions

 MAXON_INTERFACE (PixelFormatIndexedColorInterface, MAXON_REFERENCE_COPY_ON_WRITE, "net.maxon.image.interface.pixelformatindexedcolor")
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( PixelFormatIndexedColorInterface  ,
MAXON_REFERENCE_COPY_ON_WRITE  ,
"net.maxon.image.interface.pixelformatindexedcolor"   
)
private

◆ InitColorTable()

MAXON_METHOD Result<void> InitColorTable ( Int  count,
const PixelFormat &  srcFormatPtr 
)

Initialize the pixel format with a specific number of color entries and a given pixel format for the color entries.

Parameters
[in]countNumber of color entries in the table.
[in]srcFormatPtrPixel format of the color entries.
Returns
OK on success.

◆ GetColorTablePixelFormat()

MAXON_METHOD PixelFormat GetColorTablePixelFormat ( ) const

Returns the pixel format of the color table.

◆ GetColorTableSize()

MAXON_METHOD Int GetColorTableSize ( ) const

Returns the number of color entries.

◆ SetIndex()

MAXON_METHOD Result<void> SetIndex ( Int  idx,
const ImageConstBuffer srcPixelData 
)

Sets a specific color entry.

Parameters
[in]idxIndex of the entry to set.
[in]srcPixelDataSource color data. The color will be automatically converted into the color format provided in the Init function.
Returns
OK on success.

◆ GetIndex()

MAXON_METHOD Result<void> GetIndex ( Int  idx,
const ImageMutableBuffer dstPixelData 
) const

Returns a single color entry from the color table.

Parameters
[in]idxIndex of the entry to get.
[in]dstPixelDataDestination color pointer. The color will be automatically converted into the color format provided in the dstPixelData.
Returns
OK on success.