Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions
Image_PixMap Class Reference

Class represents packed image plane. More...

#include <Image_PixMap.hxx>

Inheritance diagram for Image_PixMap:
Inheritance graph
[legend]

Public Member Functions

Image_Format Format () const
 Return pixel format.
 
void SetFormat (const Image_Format thePixelFormat)
 Override pixel format specified by InitXXX() methods. Will throw exception if pixel size of new format is not equal to currently initialized format. Intended to switch formats indicating different interpretation of the same data (e.g. ImgGray and ImgAlpha).
 
size_t Width () const
 Return image width in pixels.
 
size_t Height () const
 Return image height in pixels.
 
size_t Depth () const
 Return image depth in pixels.
 
size_t SizeX () const
 Return image width in pixels.
 
size_t SizeY () const
 Return image height in pixels.
 
size_t SizeZ () const
 Return image depth in pixels.
 
NCollection_Vec3< size_tSizeXYZ () const
 Return image width x height x depth in pixels.
 
double Ratio () const
 Return width / height.
 
bool IsEmpty () const
 Return true if data is NULL.
 
 Image_PixMap ()
 Empty constructor. Initialize the NULL image plane.
 
 ~Image_PixMap () override
 Destructor.
 
Quantity_ColorRGBA PixelColor (int theX, int theY, bool theToLinearize=false) const
 Returns the pixel color. This function is relatively slow. Beware that this method takes coordinates in opposite order in contrast to Value() and ChangeValue().
 
void SetPixelColor (const int theX, const int theY, const Quantity_Color &theColor, const bool theToDeLinearize=false)
 Sets the pixel color. This function is relatively slow. Beware that this method takes coordinates in opposite order in contrast to Value() and ChangeValue().
 
void SetPixelColor (const int theX, const int theY, const Quantity_ColorRGBA &theColor, const bool theToDeLinearize=false)
 Sets the pixel color. This function is relatively slow. Beware that this method takes coordinates in opposite order in contrast to Value() and ChangeValue().
 
virtual bool InitWrapper (Image_Format thePixelFormat, uint8_t *theDataPtr, const size_t theSizeX, const size_t theSizeY, const size_t theSizeRowBytes=0)
 Initialize image plane as wrapper over alien data. Data will not be copied! Notice that caller should ensure that data pointer will not be released during this wrapper lifetime. You may call InitCopy() to perform data copying.
 
virtual bool InitTrash (Image_Format thePixelFormat, const size_t theSizeX, const size_t theSizeY, const size_t theSizeRowBytes=0)
 Initialize image plane with required dimensions. Memory will be left uninitialized (performance trick).
 
virtual bool InitCopy (const Image_PixMap &theCopy)
 Initialize by copying data. If you want to copy alien data you should create wrapper using InitWrapper() before.
 
bool InitZero (Image_Format thePixelFormat, const size_t theSizeX, const size_t theSizeY, const size_t theSizeRowBytes=0, const uint8_t theValue=0)
 Initialize image plane with required dimensions. Buffer will be zeroed (black color for most formats).
 
virtual void Clear ()
 Method correctly deallocate internal buffer.
 
virtual bool InitWrapper3D (Image_Format thePixelFormat, uint8_t *theDataPtr, const NCollection_Vec3< size_t > &theSizeXYZ, const size_t theSizeRowBytes=0)
 Initialize 2D/3D image as wrapper over alien data. Data will not be copied! Notice that caller should ensure that data pointer will not be released during this wrapper lifetime. You may call InitCopy() to perform data copying.
 
virtual bool InitTrash3D (Image_Format thePixelFormat, const NCollection_Vec3< size_t > &theSizeXYZ, const size_t theSizeRowBytes=0)
 Initialize 2D/3D image with required dimensions. Memory will be left uninitialized (performance trick).
 
bool InitZero3D (Image_Format thePixelFormat, const NCollection_Vec3< size_t > &theSizeXYZ, const size_t theSizeRowBytes=0, const uint8_t theValue=0)
 Initialize 2D/3D image with required dimensions. Buffer will be zeroed (black color for most formats).
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor.
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing.
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter.
 
virtual ~Standard_Transient ()=default
 Destructor must be virtual.
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object.
 
bool IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type.
 
bool IsInstance (const char *const theTypeName) const
 Returns a true value if this is an instance of TypeName.
 
bool IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
bool IsKind (const char *const theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
 
int GetRefCount () const noexcept
 Get the reference counter of this object.
 
void IncrementRefCounter () noexcept
 Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
 
int DecrementRefCounter () noexcept
 Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
 
virtual void Delete () const
 Memory deallocator for transient classes.
 

Static Public Member Functions

static bool IsBigEndianHost ()
 Determine Big-Endian at runtime.
 
static size_t SizePixelBytes (const Image_Format thePixelFormat)
 Return bytes reserved for one pixel (may include extra bytes for alignment).
 
static bool SwapRgbaBgra (Image_PixMap &theImage)
 Auxiliary method for swapping bytes between RGB and BGR formats. This method modifies the image data but does not change pixel format! Method will fail if pixel format is not one of the following:
 
static void ToBlackWhite (Image_PixMap &theImage)
 Convert image to Black/White.
 
static bool FlipY (Image_PixMap &theImage)
 Reverse line order as it draws it from bottom to top.
 
static const occ::handle< NCollection_BaseAllocator > & DefaultAllocator ()
 Return default image data allocator.
 
static const charImageFormatToString (Image_Format theFormat)
 Return string representation of pixel format.
 
static const charImageFormatToString (Image_CompressedFormat theFormat)
 Return string representation of compressed pixel format.
 
static Quantity_ColorRGBA ColorFromRawPixel (const uint8_t *theRawValue, const Image_Format theFormat, const bool theToLinearize=false)
 Convert raw pixel value into Quantity_ColorRGBA. This function is relatively slow.
 
static void ColorToRawPixel (uint8_t *theRawValue, const Image_Format theFormat, const Quantity_ColorRGBA &theColor, const bool theToDeLinearize=false)
 Set raw pixel value from Quantity_ColorRGBA. This function is relatively slow.
 
- Static Public Member Functions inherited from Standard_Transient
static constexpr const charget_type_name ()
 Returns a type descriptor about this object.
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class.
 

low-level API for batch-processing (pixels reading / comparison / modification)

Returns TRUE if image data is stored from Top to the Down. By default Bottom Up order is used instead (topmost scanlines starts from the bottom in memory). which is most image frameworks naturally support.

Notice that access methods within this class automatically convert input row-index to apply this flag! You should use this flag only if interconnect with alien APIs and buffers.

Returns
true if image data is top-down
Image_PixMapData myData
 data buffer
 
Image_Format myImgFormat
 pixel format
 
static float ConvertFromHalfFloat (const uint16_t theHalf)
 Convert 16-bit half-float value into 32-bit float (simple conversion).
 
static uint16_t ConvertToHalfFloat (const float theFloat)
 Convert 32-bit float value into IEEE-754 16-bit floating-point format without infinity: 1-5-10, exp-15, +-131008.0, +-6.1035156E-5, +-5.9604645E-8, 3.311 digits.
 
bool IsTopDown () const
 data buffer
 
void SetTopDown (const bool theIsTopDown)
 Setup scanlines order in memory - top-down or bottom-up. Drawers should explicitly specify this value if current state IsTopDown() was ignored!
 
size_t TopDownInc () const
 Returns +1 if scanlines ordered in Top->Down order in memory and -1 otherwise.
 
const uint8_tData () const
 Return data pointer for low-level operations (copying entire buffer, parsing with extra tools etc.).
 
uint8_tChangeData ()
 Return data pointer for low-level operations (copying entire buffer, parsing with extra tools etc.).
 
const uint8_tRow (size_t theRow) const
 Return data pointer to requested row (first column). Indexation starts from 0.
 
uint8_tChangeRow (size_t theRow)
 Return data pointer to requested row (first column). Indexation starts from 0.
 
const uint8_tSlice (size_t theSlice) const
 Return data pointer to requested 2D slice. Indexation starts from 0.
 
uint8_tChangeSlice (size_t theSlice)
 Return data pointer to requested 2D slice. Indexation starts from 0.
 
const uint8_tSliceRow (size_t theSlice, size_t theRow) const
 Return data pointer to requested row (first column). Indexation starts from 0.
 
uint8_tChangeSliceRow (size_t theSlice, size_t theRow)
 Return data pointer to requested row (first column). Indexation starts from 0.
 
size_t SizePixelBytes () const
 Return bytes reserved for one pixel (may include extra bytes for alignment).
 
size_t SizeRowBytes () const
 Return bytes reserved per row. Could be larger than needed to store packed row (extra bytes for alignment etc.).
 
size_t RowExtraBytes () const
 Return the extra bytes in the row.
 
size_t MaxRowAligmentBytes () const
 Compute the maximal row alignment for current row size.
 
size_t SizeSliceBytes () const
 Return number of bytes per 2D slice.
 
size_t SizeBytes () const
 Return buffer size.
 
template<typename ColorType_t >
const ColorType_tValue (size_t theRow, size_t theCol) const
 Access image pixel with specified color type. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in the decreasing majority following memory layout - e.g. row first, column next.
 
template<typename ColorType_t >
ColorType_tChangeValue (size_t theRow, size_t theCol)
 Access image pixel with specified color type. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in the decreasing majority following memory layout - e.g. row first, column next.
 
const uint8_tRawValue (size_t theRow, size_t theCol) const
 Access image pixel as raw data pointer. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in the decreasing majority following memory layout - e.g. row first, column next.
 
uint8_tChangeRawValue (size_t theRow, size_t theCol)
 Access image pixel as raw data pointer. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in the decreasing majority following memory layout - e.g. row first, column next.
 
template<typename ColorType_t >
const ColorType_tValueXY (size_t theX, size_t theY) const
 Access image pixel with specified color type. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in traditional X, Y order.
 
template<typename ColorType_t >
ColorType_tChangeValueXY (size_t theX, size_t theY)
 Access image pixel with specified color type. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in traditional X, Y order.
 
const uint8_tRawValueXY (size_t theX, size_t theY) const
 Access image pixel as raw data pointer. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in traditional X, Y order.
 
uint8_tChangeRawValueXY (size_t theX, size_t theY)
 Access image pixel as raw data pointer. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in traditional X, Y order.
 
template<typename ColorType_t >
const ColorType_tValueXYZ (size_t theX, size_t theY, size_t theZ) const
 Access image pixel with specified color type. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in traditional X, Y, Z order.
 
template<typename ColorType_t >
ColorType_tChangeValueXYZ (size_t theX, size_t theY, size_t theZ)
 Access image pixel with specified color type. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in traditional X, Y, Z order.
 
const uint8_tRawValueXYZ (size_t theX, size_t theY, size_t theZ) const
 Access image pixel as raw data pointer. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in traditional X, Y, Z order.
 
uint8_tChangeRawValueXYZ (size_t theX, size_t theY, size_t theZ)
 Access image pixel as raw data pointer. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in traditional X, Y, Z order.
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object.
 

Detailed Description

Class represents packed image plane.

Constructor & Destructor Documentation

◆ Image_PixMap()

Image_PixMap::Image_PixMap ( )

Empty constructor. Initialize the NULL image plane.

◆ ~Image_PixMap()

Image_PixMap::~Image_PixMap ( )
override

Destructor.

Member Function Documentation

◆ ChangeData()

uint8_t * Image_PixMap::ChangeData ( )
inline

Return data pointer for low-level operations (copying entire buffer, parsing with extra tools etc.).

◆ ChangeRawValue()

uint8_t * Image_PixMap::ChangeRawValue ( size_t theRow,
size_t theCol )
inline

Access image pixel as raw data pointer. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in the decreasing majority following memory layout - e.g. row first, column next.

◆ ChangeRawValueXY()

uint8_t * Image_PixMap::ChangeRawValueXY ( size_t theX,
size_t theY )
inline

Access image pixel as raw data pointer. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in traditional X, Y order.

◆ ChangeRawValueXYZ()

uint8_t * Image_PixMap::ChangeRawValueXYZ ( size_t theX,
size_t theY,
size_t theZ )
inline

Access image pixel as raw data pointer. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in traditional X, Y, Z order.

◆ ChangeRow()

uint8_t * Image_PixMap::ChangeRow ( size_t theRow)
inline

Return data pointer to requested row (first column). Indexation starts from 0.

◆ ChangeSlice()

uint8_t * Image_PixMap::ChangeSlice ( size_t theSlice)
inline

Return data pointer to requested 2D slice. Indexation starts from 0.

◆ ChangeSliceRow()

uint8_t * Image_PixMap::ChangeSliceRow ( size_t theSlice,
size_t theRow )
inline

Return data pointer to requested row (first column). Indexation starts from 0.

◆ ChangeValue()

template<typename ColorType_t >
ColorType_t & Image_PixMap::ChangeValue ( size_t theRow,
size_t theCol )
inline

Access image pixel with specified color type. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in the decreasing majority following memory layout - e.g. row first, column next.

◆ ChangeValueXY()

template<typename ColorType_t >
ColorType_t & Image_PixMap::ChangeValueXY ( size_t theX,
size_t theY )
inline

Access image pixel with specified color type. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in traditional X, Y order.

◆ ChangeValueXYZ()

template<typename ColorType_t >
ColorType_t & Image_PixMap::ChangeValueXYZ ( size_t theX,
size_t theY,
size_t theZ )
inline

Access image pixel with specified color type. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in traditional X, Y, Z order.

◆ Clear()

virtual void Image_PixMap::Clear ( )
virtual

Method correctly deallocate internal buffer.

Reimplemented in Image_AlienPixMap.

◆ ColorFromRawPixel()

static Quantity_ColorRGBA Image_PixMap::ColorFromRawPixel ( const uint8_t * theRawValue,
const Image_Format theFormat,
const bool theToLinearize = false )
static

Convert raw pixel value into Quantity_ColorRGBA. This function is relatively slow.

Parameters
[in]theRawValuepointer to pixel definition
[in]theFormatpixel format
[in]theToLinearizewhen TRUE, the color stored in non-linear color space (e.g. Image_Format_RGB) will be linearized
Returns
the pixel color

◆ ColorToRawPixel()

static void Image_PixMap::ColorToRawPixel ( uint8_t * theRawValue,
const Image_Format theFormat,
const Quantity_ColorRGBA & theColor,
const bool theToDeLinearize = false )
static

Set raw pixel value from Quantity_ColorRGBA. This function is relatively slow.

Parameters
[out]theRawValuepointer to pixel definition to modify
[in]theFormatpixel format
[in]theColorcolor value to convert from
[in]theToDeLinearizewhen TRUE, the gamma correction will be applied for storing in non-linear color space (e.g. Image_Format_RGB)

◆ ConvertFromHalfFloat()

static float Image_PixMap::ConvertFromHalfFloat ( const uint16_t theHalf)
inlinestatic

Convert 16-bit half-float value into 32-bit float (simple conversion).

◆ ConvertToHalfFloat()

static uint16_t Image_PixMap::ConvertToHalfFloat ( const float theFloat)
inlinestatic

Convert 32-bit float value into IEEE-754 16-bit floating-point format without infinity: 1-5-10, exp-15, +-131008.0, +-6.1035156E-5, +-5.9604645E-8, 3.311 digits.

◆ Data()

const uint8_t * Image_PixMap::Data ( ) const
inline

Return data pointer for low-level operations (copying entire buffer, parsing with extra tools etc.).

◆ DefaultAllocator()

static const occ::handle< NCollection_BaseAllocator > & Image_PixMap::DefaultAllocator ( )
static

Return default image data allocator.

◆ Depth()

size_t Image_PixMap::Depth ( ) const
inline

Return image depth in pixels.

◆ FlipY()

static bool Image_PixMap::FlipY ( Image_PixMap & theImage)
static

Reverse line order as it draws it from bottom to top.

◆ Format()

Image_Format Image_PixMap::Format ( ) const
inline

Return pixel format.

◆ Height()

size_t Image_PixMap::Height ( ) const
inline

Return image height in pixels.

◆ ImageFormatToString() [1/2]

static const char * Image_PixMap::ImageFormatToString ( Image_CompressedFormat theFormat)
static

Return string representation of compressed pixel format.

◆ ImageFormatToString() [2/2]

static const char * Image_PixMap::ImageFormatToString ( Image_Format theFormat)
static

Return string representation of pixel format.

◆ InitCopy()

virtual bool Image_PixMap::InitCopy ( const Image_PixMap & theCopy)
virtual

Initialize by copying data. If you want to copy alien data you should create wrapper using InitWrapper() before.

Reimplemented in Image_AlienPixMap.

◆ InitTrash()

virtual bool Image_PixMap::InitTrash ( Image_Format thePixelFormat,
const size_t theSizeX,
const size_t theSizeY,
const size_t theSizeRowBytes = 0 )
virtual

Initialize image plane with required dimensions. Memory will be left uninitialized (performance trick).

Reimplemented in Image_AlienPixMap.

◆ InitTrash3D()

virtual bool Image_PixMap::InitTrash3D ( Image_Format thePixelFormat,
const NCollection_Vec3< size_t > & theSizeXYZ,
const size_t theSizeRowBytes = 0 )
virtual

Initialize 2D/3D image with required dimensions. Memory will be left uninitialized (performance trick).

◆ InitWrapper()

virtual bool Image_PixMap::InitWrapper ( Image_Format thePixelFormat,
uint8_t * theDataPtr,
const size_t theSizeX,
const size_t theSizeY,
const size_t theSizeRowBytes = 0 )
virtual

Initialize image plane as wrapper over alien data. Data will not be copied! Notice that caller should ensure that data pointer will not be released during this wrapper lifetime. You may call InitCopy() to perform data copying.

◆ InitWrapper3D()

virtual bool Image_PixMap::InitWrapper3D ( Image_Format thePixelFormat,
uint8_t * theDataPtr,
const NCollection_Vec3< size_t > & theSizeXYZ,
const size_t theSizeRowBytes = 0 )
virtual

Initialize 2D/3D image as wrapper over alien data. Data will not be copied! Notice that caller should ensure that data pointer will not be released during this wrapper lifetime. You may call InitCopy() to perform data copying.

◆ InitZero()

bool Image_PixMap::InitZero ( Image_Format thePixelFormat,
const size_t theSizeX,
const size_t theSizeY,
const size_t theSizeRowBytes = 0,
const uint8_t theValue = 0 )
inline

Initialize image plane with required dimensions. Buffer will be zeroed (black color for most formats).

◆ InitZero3D()

bool Image_PixMap::InitZero3D ( Image_Format thePixelFormat,
const NCollection_Vec3< size_t > & theSizeXYZ,
const size_t theSizeRowBytes = 0,
const uint8_t theValue = 0 )

Initialize 2D/3D image with required dimensions. Buffer will be zeroed (black color for most formats).

◆ IsBigEndianHost()

static bool Image_PixMap::IsBigEndianHost ( )
inlinestatic

Determine Big-Endian at runtime.

◆ IsEmpty()

bool Image_PixMap::IsEmpty ( ) const
inline

Return true if data is NULL.

◆ IsTopDown()

bool Image_PixMap::IsTopDown ( ) const
inline

data buffer

◆ MaxRowAligmentBytes()

size_t Image_PixMap::MaxRowAligmentBytes ( ) const
inline

Compute the maximal row alignment for current row size.

Returns
maximal row alignment in bytes (up to 16 bytes).

◆ PixelColor()

Quantity_ColorRGBA Image_PixMap::PixelColor ( int theX,
int theY,
bool theToLinearize = false ) const
inline

Returns the pixel color. This function is relatively slow. Beware that this method takes coordinates in opposite order in contrast to Value() and ChangeValue().

Parameters
[in]theXcolumn index from left, starting from 0
[in]theYrow index from top, starting from 0
[in]theToLinearizewhen TRUE, the color stored in non-linear color space (e.g. Image_Format_RGB) will be linearized
Returns
the pixel color

◆ Ratio()

double Image_PixMap::Ratio ( ) const
inline

Return width / height.

◆ RawValue()

const uint8_t * Image_PixMap::RawValue ( size_t theRow,
size_t theCol ) const
inline

Access image pixel as raw data pointer. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in the decreasing majority following memory layout - e.g. row first, column next.

◆ RawValueXY()

const uint8_t * Image_PixMap::RawValueXY ( size_t theX,
size_t theY ) const
inline

Access image pixel as raw data pointer. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in traditional X, Y order.

◆ RawValueXYZ()

const uint8_t * Image_PixMap::RawValueXYZ ( size_t theX,
size_t theY,
size_t theZ ) const
inline

Access image pixel as raw data pointer. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in traditional X, Y, Z order.

◆ Row()

const uint8_t * Image_PixMap::Row ( size_t theRow) const
inline

Return data pointer to requested row (first column). Indexation starts from 0.

◆ RowExtraBytes()

size_t Image_PixMap::RowExtraBytes ( ) const
inline

Return the extra bytes in the row.

◆ SetFormat()

void Image_PixMap::SetFormat ( const Image_Format thePixelFormat)

Override pixel format specified by InitXXX() methods. Will throw exception if pixel size of new format is not equal to currently initialized format. Intended to switch formats indicating different interpretation of the same data (e.g. ImgGray and ImgAlpha).

◆ SetPixelColor() [1/2]

void Image_PixMap::SetPixelColor ( const int theX,
const int theY,
const Quantity_Color & theColor,
const bool theToDeLinearize = false )
inline

Sets the pixel color. This function is relatively slow. Beware that this method takes coordinates in opposite order in contrast to Value() and ChangeValue().

Parameters
[in]theXcolumn index from left
[in]theYrow index from top
[in]theColorcolor to store
[in]theToDeLinearizewhen TRUE, the gamma correction will be applied for storing in non-linear color space (e.g. Image_Format_RGB)

◆ SetPixelColor() [2/2]

void Image_PixMap::SetPixelColor ( const int theX,
const int theY,
const Quantity_ColorRGBA & theColor,
const bool theToDeLinearize = false )
inline

Sets the pixel color. This function is relatively slow. Beware that this method takes coordinates in opposite order in contrast to Value() and ChangeValue().

Parameters
[in]theXcolumn index from left
[in]theYrow index from top
[in]theColorcolor to store
[in]theToDeLinearizewhen TRUE, the gamma correction will be applied for storing in non-linear color space (e.g. Image_Format_RGB)

◆ SetTopDown()

void Image_PixMap::SetTopDown ( const bool theIsTopDown)
inline

Setup scanlines order in memory - top-down or bottom-up. Drawers should explicitly specify this value if current state IsTopDown() was ignored!

Parameters
theIsTopDowntop-down flag

◆ SizeBytes()

size_t Image_PixMap::SizeBytes ( ) const
inline

Return buffer size.

◆ SizePixelBytes() [1/2]

size_t Image_PixMap::SizePixelBytes ( ) const
inline

Return bytes reserved for one pixel (may include extra bytes for alignment).

◆ SizePixelBytes() [2/2]

static size_t Image_PixMap::SizePixelBytes ( const Image_Format thePixelFormat)
static

Return bytes reserved for one pixel (may include extra bytes for alignment).

◆ SizeRowBytes()

size_t Image_PixMap::SizeRowBytes ( ) const
inline

Return bytes reserved per row. Could be larger than needed to store packed row (extra bytes for alignment etc.).

◆ SizeSliceBytes()

size_t Image_PixMap::SizeSliceBytes ( ) const
inline

Return number of bytes per 2D slice.

◆ SizeX()

size_t Image_PixMap::SizeX ( ) const
inline

Return image width in pixels.

◆ SizeXYZ()

NCollection_Vec3< size_t > Image_PixMap::SizeXYZ ( ) const
inline

Return image width x height x depth in pixels.

◆ SizeY()

size_t Image_PixMap::SizeY ( ) const
inline

Return image height in pixels.

◆ SizeZ()

size_t Image_PixMap::SizeZ ( ) const
inline

Return image depth in pixels.

◆ Slice()

const uint8_t * Image_PixMap::Slice ( size_t theSlice) const
inline

Return data pointer to requested 2D slice. Indexation starts from 0.

◆ SliceRow()

const uint8_t * Image_PixMap::SliceRow ( size_t theSlice,
size_t theRow ) const
inline

Return data pointer to requested row (first column). Indexation starts from 0.

◆ SwapRgbaBgra()

static bool Image_PixMap::SwapRgbaBgra ( Image_PixMap & theImage)
static

Auxiliary method for swapping bytes between RGB and BGR formats. This method modifies the image data but does not change pixel format! Method will fail if pixel format is not one of the following:

  • Image_Format_RGB32 / Image_Format_BGR32
  • Image_Format_RGBA / Image_Format_BGRA
  • Image_Format_RGB / Image_Format_BGR
  • Image_Format_RGBF / Image_Format_BGRF
  • Image_Format_RGBAF / Image_Format_BGRAF

◆ ToBlackWhite()

static void Image_PixMap::ToBlackWhite ( Image_PixMap & theImage)
static

Convert image to Black/White.

◆ TopDownInc()

size_t Image_PixMap::TopDownInc ( ) const
inline

Returns +1 if scanlines ordered in Top->Down order in memory and -1 otherwise.

Returns
scanline increment for Top->Down iteration

◆ Value()

template<typename ColorType_t >
const ColorType_t & Image_PixMap::Value ( size_t theRow,
size_t theCol ) const
inline

Access image pixel with specified color type. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in the decreasing majority following memory layout - e.g. row first, column next.

◆ ValueXY()

template<typename ColorType_t >
const ColorType_t & Image_PixMap::ValueXY ( size_t theX,
size_t theY ) const
inline

Access image pixel with specified color type. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in traditional X, Y order.

◆ ValueXYZ()

template<typename ColorType_t >
const ColorType_t & Image_PixMap::ValueXYZ ( size_t theX,
size_t theY,
size_t theZ ) const
inline

Access image pixel with specified color type. Indexation starts from 0. This method does not perform any type checks - use on own risk (check Format() before)! WARNING: Input parameters are defined in traditional X, Y, Z order.

◆ Width()

size_t Image_PixMap::Width ( ) const
inline

Return image width in pixels.

Field Documentation

◆ myData

Image_PixMapData Image_PixMap::myData
protected

data buffer

◆ myImgFormat

Image_Format Image_PixMap::myImgFormat
protected

pixel format


The documentation for this class was generated from the following file: