Open CASCADE Technology 6.6.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
Image_PixMap Class Reference

Class represents packed image plane.

#include <Image_PixMap.hxx>

Inheritance diagram for Image_PixMap:
Inheritance graph
[legend]

Public Types

enum  tagFormat {
  ImgUNKNOWN = 0, ImgGray = 1, ImgRGB, ImgBGR,
  ImgRGB32, ImgBGR32, ImgRGBA, ImgBGRA,
  ImgGrayF, ImgRGBF, ImgBGRF, ImgRGBAF,
  ImgBGRAF
}
 This enumeration define packed image plane formats. More...
typedef enum
Image_PixMap::tagFormat 
ImgFormat
 This enumeration define packed image plane formats.

Public Member Functions

ImgFormat Format () const
Standard_Size Width () const
Standard_Size Height () const
Standard_Size SizeX () const
Standard_Size SizeY () const
Standard_Real Ratio () const
bool IsEmpty () const
 Image_PixMap ()
 Empty constructor. Initialize the NULL image plane.
virtual ~Image_PixMap ()
 Destructor.
Quantity_Color PixelColor (const Standard_Integer theX, const Standard_Integer theY) const
 Returns the pixel color. This function is relatively slow.
Quantity_Color PixelColor (const Standard_Integer theX, const Standard_Integer theY, Quantity_Parameter &theAlpha) const
 Returns the pixel color. This function is relatively slow. theAlpha argument is set to color intensity (0 - transparent, 1 - opaque)
virtual bool InitWrapper (ImgFormat thePixelFormat, Standard_Byte *theDataPtr, const Standard_Size theSizeX, const Standard_Size theSizeY, const Standard_Size 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 (ImgFormat thePixelFormat, const Standard_Size theSizeX, const Standard_Size theSizeY, const Standard_Size 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 (ImgFormat thePixelFormat, const Standard_Size theSizeX, const Standard_Size theSizeY, const Standard_Size theSizeRowBytes=0, const Standard_Byte theValue=0)
 Initialize image plane with required dimensions. Buffer will be zeroed (black color for most formats).
virtual void Clear (ImgFormat thePixelFormat=ImgGray)
 Method correctly deallocate internal buffer.
bool IsTopDown () const
 Returns true if image data stored from Top to the Down (default). Some external APIs can return bottom-up data instead (topmost scanlines starts from the bottom in memory). 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.
void SetTopDown (bool theIsTopDown)
 Setup scanlines order in memory - top-down or bottom-up. Drawers should explicitly specify this value if current state IsTopDown() was ignored!
Standard_Size TopDownInc () const
 Returns +1 if scanlines ordered in Top->Down order in memory and -1 otherwise.
const Standard_ByteData () const
Standard_ByteChangeData ()
const Standard_ByteRow (const Standard_Size theRow) const
Standard_ByteChangeRow (const Standard_Size theRow)
Standard_Size SizePixelBytes () const
Standard_Size SizeRowBytes () const
Standard_Size RowExtraBytes () const
Standard_Size MaxRowAligmentBytes () const
 Compute the maximal row alignment for current row size.
Standard_Size SizeBytes () const
template<typename ColorType_t >
Image_PixMapData< ColorType_t > & EditData ()
 Access image buffer for write/read operations with specified color type.
template<typename ColorType_t >
const Image_PixMapData
< ColorType_t > & 
ReadData () const
 Access image buffer for read operations with specified color type.
template<typename ColorType_t >
const ColorType_t & Value (const Standard_Size theRow, const Standard_Size theCol) const
 Access image pixel with specified color type.

Static Public Member Functions

static bool IsBigEndianHost ()
 Determine Big-Endian at runtime.
static Standard_Size SizePixelBytes (const Image_PixMap::ImgFormat thePixelFormat)

Protected Member Functions

void setFormat (ImgFormat thePixelFormat)
 Setup pixel format.
void setTopDown ()
 Auxiliary method to setup myTopRowPtr.

Protected Attributes

Image_PixMapData< Standard_BytemyData
ImgFormat myImgFormat
 pixel format
bool myIsOwnPointer
 if data was allocated by this class - flag is true

Member Typedef Documentation


Member Enumeration Documentation

Enumerator:
ImgUNKNOWN 

unsupported or unknown format

ImgGray 

1 byte per pixel

ImgRGB 

3 bytes packed RGB image plane

ImgBGR 

same as RGB but with different components order

ImgRGB32 

4 bytes packed RGB image plane (1 extra byte for alignment, may have undefined value)

ImgBGR32 

same as RGB but with different components order

ImgRGBA 

4 bytes packed RGBA image plane

ImgBGRA 

same as RGBA but with different components order

ImgGrayF 

1 float (4-bytes) per pixel (1-component plane)

ImgRGBF 

3 floats (12-bytes) RGB image plane

ImgBGRF 

same as RGBF but with different components order

ImgRGBAF 

4 floats (16-bytes) RGBA image plane

ImgBGRAF 

same as RGBAF but with different components order


Constructor & Destructor Documentation

Image_PixMap::Image_PixMap ( )
virtual Image_PixMap::~Image_PixMap ( ) [virtual]

Member Function Documentation

Standard_Byte* Image_PixMap::ChangeData ( ) [inline]
Returns:
data pointer for low-level operations (copying entire buffer, parsing with extra tools etc.).
Standard_Byte* Image_PixMap::ChangeRow ( const Standard_Size  theRow) [inline]
Returns:
data pointer to requested row (first column).
virtual void Image_PixMap::Clear ( ImgFormat  thePixelFormat = ImgGray) [virtual]

Reimplemented in Image_AlienPixMap.

const Standard_Byte* Image_PixMap::Data ( ) const [inline]
Returns:
data pointer for low-level operations (copying entire buffer, parsing with extra tools etc.).
template<typename ColorType_t >
Image_PixMapData<ColorType_t>& Image_PixMap::EditData ( ) [inline]
ImgFormat Image_PixMap::Format ( ) const [inline]
Standard_Size Image_PixMap::Height ( ) const [inline]
Returns:
image height in pixels
virtual bool Image_PixMap::InitCopy ( const Image_PixMap theCopy) [virtual]

Reimplemented in Image_AlienPixMap.

virtual bool Image_PixMap::InitTrash ( ImgFormat  thePixelFormat,
const Standard_Size  theSizeX,
const Standard_Size  theSizeY,
const Standard_Size  theSizeRowBytes = 0 
) [virtual]

Reimplemented in Image_AlienPixMap.

virtual bool Image_PixMap::InitWrapper ( ImgFormat  thePixelFormat,
Standard_Byte theDataPtr,
const Standard_Size  theSizeX,
const Standard_Size  theSizeY,
const Standard_Size  theSizeRowBytes = 0 
) [virtual]
bool Image_PixMap::InitZero ( ImgFormat  thePixelFormat,
const Standard_Size  theSizeX,
const Standard_Size  theSizeY,
const Standard_Size  theSizeRowBytes = 0,
const Standard_Byte  theValue = 0 
)
static bool Image_PixMap::IsBigEndianHost ( ) [inline, static]
bool Image_PixMap::IsEmpty ( ) const [inline]
Returns:
true if data is NULL.
bool Image_PixMap::IsTopDown ( ) const [inline]
Returns:
true if image data is top-down.
Standard_Size Image_PixMap::MaxRowAligmentBytes ( ) const [inline]
Returns:
maximal row alignment in bytes (up to 16 bytes).
Quantity_Color Image_PixMap::PixelColor ( const Standard_Integer  theX,
const Standard_Integer  theY 
) const [inline]
Parameters:
theX- column index from left
theY- row index from top
Returns:
the pixel color
Quantity_Color Image_PixMap::PixelColor ( const Standard_Integer  theX,
const Standard_Integer  theY,
Quantity_Parameter theAlpha 
) const
Standard_Real Image_PixMap::Ratio ( ) const [inline]
Returns:
width / height.
template<typename ColorType_t >
const Image_PixMapData<ColorType_t>& Image_PixMap::ReadData ( ) const [inline]
const Standard_Byte* Image_PixMap::Row ( const Standard_Size  theRow) const [inline]
Returns:
data pointer to requested row (first column).
Standard_Size Image_PixMap::RowExtraBytes ( ) const [inline]
Returns:
the extra bytes in the row.
void Image_PixMap::setFormat ( ImgFormat  thePixelFormat) [protected]
void Image_PixMap::SetTopDown ( bool  theIsTopDown) [inline]
Parameters:
theIsTopDown- top-down flag.
void Image_PixMap::setTopDown ( ) [protected]
Standard_Size Image_PixMap::SizeBytes ( ) const [inline]
static Standard_Size Image_PixMap::SizePixelBytes ( const Image_PixMap::ImgFormat  thePixelFormat) [static]
Returns:
bytes reserved for one pixel (may include extra bytes for alignment).
Standard_Size Image_PixMap::SizePixelBytes ( ) const [inline]
Returns:
bytes reserved for one pixel (may include extra bytes for alignment).
Standard_Size Image_PixMap::SizeRowBytes ( ) const [inline]
Returns:
bytes reserved per row. Could be larger than needed to store packed row (extra bytes for alignment etc.).
Standard_Size Image_PixMap::SizeX ( ) const [inline]
Returns:
image width in pixels
Standard_Size Image_PixMap::SizeY ( ) const [inline]
Returns:
image height in pixels
Standard_Size Image_PixMap::TopDownInc ( ) const [inline]
Returns:
scanline increment for Top->Down iteration
template<typename ColorType_t >
const ColorType_t& Image_PixMap::Value ( const Standard_Size  theRow,
const Standard_Size  theCol 
) const [inline]
Standard_Size Image_PixMap::Width ( ) const [inline]
Returns:
image width in pixels

Field Documentation

bool Image_PixMap::myIsOwnPointer [protected]

The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines