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

 SetPixelHandlerStruct ()
 SetPixelHandlerStruct (SetPixelHandlerStruct &&other)
Bool IsValid () const
template<typename SETFUNC , typename FREEFUNC >
 SetPixelHandlerStruct (SETFUNC &&setFunc, FREEFUNC &&freeFunc)
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

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

◆ 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.

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

◆ ~SetPixelHandlerStruct()

Member Function Documentation



◆ IsValid()

Bool IsValid ( ) const

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



◆ SetPixel()

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

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

[in]posImagePos of the pixel data to write into the bitmap.
[in]bufferDestination of the pixel data.
[in]flagsControl the operation with the flags.
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

◆ _freeFunc

FreeFunc _freeFunc

◆ _region

Range<IntVector2d> _region