#include <gfx_image_pixelhandler.h>
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 ColorProfile & | GetTargetColorProfile () |
Private Attributes | |
GetFunc | _getFunc |
FreeFunc | _freeFunc |
ColorProfile | _targetColorProfile |
using GetFunc = Delegate<Result<void>(const ImagePos &pos, const PixelMutableBuffer &buffer, GETPIXELFLAGS flags)> |
using FreeFunc = Delegate<void(GetPixelHandlerStruct& selfPtr)> |
Default Constructor. Initializes everything with nullptr.
GetPixelHandlerStruct | ( | GetPixelHandlerStruct && | other | ) |
Move Constructor.
GetPixelHandlerStruct | ( | GETFUNC && | getFunc, |
FREEFUNC && | freeFunc, | ||
const ColorProfile & | destinationProfile | ||
) |
Constructor to initialize the helper class.
[in] | getFunc | Get pixel function callback. |
[in] | freeFunc | Free pixel handler callback. |
[in] | destinationProfile | TODO: (Tilo) please document. |
Destructor.
MAXON_DISALLOW_COPY_AND_ASSIGN | ( | GetPixelHandlerStruct | ) |
MAXON_OPERATOR_MOVE_ASSIGNMENT | ( | GetPixelHandlerStruct | ) |
Bool IsValid | ( | ) | const |
Returns true if the structure is initialized correctly and a GetPixelHandler is set.
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.
[in] | pos | ImagePos of the pixel data to read from. |
[in] | buffer | Destination of the pixel data. |
[in] | flags | Control the operation with the flags. |
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).
|
private |
|
private |
|
private |