SetPixelHandlerStruct Struct Reference

#include <gfx_image_pixelhandler.h>

Detailed Description

Helper class returned by SetPixelHandler. 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. The SetPixelHandlerStruct must be accessed only from once thread. If you want to sett pixel in a multi threaded way you need to get a SetPixelHandlerStruct for each thread.

Public Types

using SetFunc = Delegate< Result< void >(const ImagePos &pos, const PixelConstBuffer &buffer, SETPIXELFLAGS flags)>
 
using FreeFunc = Delegate< void(SetPixelHandlerStruct &selfPtr)>
 

Public Member Functions

 MAXON_DISALLOW_COPY_AND_ASSIGN (SetPixelHandlerStruct)
 
 SetPixelHandlerStruct ()
 
 SetPixelHandlerStruct (SetPixelHandlerStruct &&other)
 
Bool IsValid () const
 
template<typename SETFUNC , typename FREEFUNC >
 SetPixelHandlerStruct (SETFUNC &&setFunc, FREEFUNC &&freeFunc)
 
MAXON_ATTRIBUTE_FORCE_INLINE ~SetPixelHandlerStruct ()
 
 MAXON_OPERATOR_MOVE_ASSIGNMENT (SetPixelHandlerStruct)
 
MAXON_ATTRIBUTE_FORCE_INLINE Result< void > SetPixel (const ImagePos &pos, const PixelConstBuffer &buffer, SETPIXELFLAGS flags) const
 
const Range< IntVector2d > & GetModifiedRegion () const
 

Private Attributes

SetFunc _setFunc
 
FreeFunc _freeFunc
 
Range< IntVector2d_region
 

Member Typedef Documentation

◆ SetFunc

◆ FreeFunc

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

Constructor & Destructor Documentation

◆ SetPixelHandlerStruct() [1/3]

Default Constructor. Initializes everything with nullptr.

◆ SetPixelHandlerStruct() [2/3]

Move Constructor.

◆ SetPixelHandlerStruct() [3/3]

SetPixelHandlerStruct ( SETFUNC &&  setFunc,
FREEFUNC &&  freeFunc 
)

Constructor to initialize the helper class.

Parameters
[in]setFuncSet pixel function callback.
[in]freeFuncFree pixel handler callback.

◆ ~SetPixelHandlerStruct()

Member Function Documentation

◆ MAXON_DISALLOW_COPY_AND_ASSIGN()

MAXON_DISALLOW_COPY_AND_ASSIGN ( SetPixelHandlerStruct  )

◆ IsValid()

Bool IsValid ( ) const

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

◆ MAXON_OPERATOR_MOVE_ASSIGNMENT()

MAXON_OPERATOR_MOVE_ASSIGNMENT ( SetPixelHandlerStruct  )

◆ SetPixel()

MAXON_ATTRIBUTE_FORCE_INLINE Result<void> SetPixel ( const ImagePos pos,
const PixelConstBuffer buffer,
SETPIXELFLAGS  flags 
) const

Copies/Writes the pixel data from the buffer to the bitmap.

Parameters
[in]posImagePos of the pixel data to write into the bitmap.
[in]bufferDestination of the pixel data.
[in]flagsControl the operation with the flags.
Returns
True if the operation operates successful.

◆ GetModifiedRegion()

const Range<IntVector2d>& GetModifiedRegion ( ) const

Returns the modified region that was touched by all the SetPixel() calls of this handler.

Member Data Documentation

◆ _setFunc

SetFunc _setFunc
private

◆ _freeFunc

FreeFunc _freeFunc
private

◆ _region

Range<IntVector2d> _region
mutableprivate