GetPixelHandlerStruct Struct Reference

#include <gfx_image_pixelhandler.h>

Detailed Description

Helper class returned by GetPixelHandler. This class provides/caches a fast the access to pixels. A lambda contains the most efficient code to access the pixel data. This object is only valid as long as the bitmap properties (pixel format, pixel storage layout, width, height) wont change.

Public Types

using GetFunc = Delegate< Result< void >(const ImagePos &pos, const PixelMutableBuffer &buffer, GETPIXELFLAGS flags)>
 
using FreeFunc = Delegate< void(GetPixelHandlerStruct &selfPtr)>
 

Public Member Functions

 MAXON_DISALLOW_COPY_AND_ASSIGN (GetPixelHandlerStruct)
 
 GetPixelHandlerStruct ()
 
 GetPixelHandlerStruct (GetPixelHandlerStruct &&other)
 
template<typename GETFUNC , typename FREEFUNC >
 GetPixelHandlerStruct (GETFUNC &&getFunc, FREEFUNC &&freeFunc, const ColorProfile &destinationProfile)
 
MAXON_ATTRIBUTE_FORCE_INLINE ~GetPixelHandlerStruct ()
 
 MAXON_OPERATOR_MOVE_ASSIGNMENT (GetPixelHandlerStruct)
 
Bool IsValid () const
 
MAXON_ATTRIBUTE_FORCE_INLINE Result< void > GetPixel (const ImagePos &pos, const PixelMutableBuffer &buffer, GETPIXELFLAGS flags) const
 
const ColorProfileGetTargetColorProfile ()
 

Private Attributes

GetFunc _getFunc
 
FreeFunc _freeFunc
 
ColorProfile _targetColorProfile
 

Member Typedef Documentation

◆ GetFunc

using GetFunc = Delegate<Result<void>(const ImagePos &pos, const PixelMutableBuffer &buffer, GETPIXELFLAGS flags)>

◆ FreeFunc

using FreeFunc = Delegate<void(GetPixelHandlerStruct& selfPtr)>

Constructor & Destructor Documentation

◆ GetPixelHandlerStruct() [1/3]

Default Constructor. Initializes everything with nullptr.

◆ GetPixelHandlerStruct() [2/3]

Move Constructor.

◆ GetPixelHandlerStruct() [3/3]

GetPixelHandlerStruct ( GETFUNC &&  getFunc,
FREEFUNC &&  freeFunc,
const ColorProfile destinationProfile 
)

Constructor to initialize the helper class.

Parameters
[in]getFuncGet pixel function callback.
[in]freeFuncFree pixel handler callback.
[in]destinationProfileTODO: (Tilo) please document

◆ ~GetPixelHandlerStruct()

Member Function Documentation

◆ MAXON_DISALLOW_COPY_AND_ASSIGN()

MAXON_DISALLOW_COPY_AND_ASSIGN ( GetPixelHandlerStruct  )

◆ MAXON_OPERATOR_MOVE_ASSIGNMENT()

MAXON_OPERATOR_MOVE_ASSIGNMENT ( GetPixelHandlerStruct  )

◆ IsValid()

Bool IsValid ( ) const

Returns true if the structure is initialized correctly and a GetPixelHandler is set.

◆ GetPixel()

MAXON_ATTRIBUTE_FORCE_INLINE Result<void> GetPixel ( const ImagePos pos,
const PixelMutableBuffer buffer,
GETPIXELFLAGS  flags 
) const

Copies/Read the pixel data from the source to the given buffer.

Parameters
[in]posImagePos of the pixel data to read from.
[in]bufferDestination of the pixel data.
[in]flagsControl the operation with the flags.
Returns
OK on success.

◆ GetTargetColorProfile()

const ColorProfile& GetTargetColorProfile ( )

Returns the color profile for the pixel data delivered by this handler. This function is important the pixelhandler was requested without the GETPIXELHANDLERFLAGS::FORCECOLORPROFILECONVERSION flag! In that case the pixel handler will not process color profile conversions if the color space matches between the internal and requested pixel format. This speeds up the conversion and allows to pass the profile to the gpu or to the exporter. (e.g. a bitmap with a sRGB color profile will return the original data if the pixel handler requests a linear rgb profile).

Returns
The color profile in which the pixel data will be delivered. If GETPIXELHANDLERFLAGS::FORCECOLORPROFILECONVERSION was set on request of the pixel handler the color profile is the same as the requested profile. If GETPIXELHANDLERFLAGS::FORCECOLORPROFILECONVERSION was NOT set on request of the pixel handler the color profile might be different if the color space matched.

Member Data Documentation

◆ _getFunc

GetFunc _getFunc
private

◆ _freeFunc

FreeFunc _freeFunc
private

◆ _targetColorProfile

ColorProfile _targetColorProfile
private