libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
ImageDesc Class Reference

Describes the format and layout of a single image. More...

#include <imagedesc.h>

Public Types

using Ptr = SharedPtr< ImageDesc >
 Shared pointer type for ImageDesc.
 

Public Member Functions

 ImageDesc ()
 Constructs an invalid (default) image description with no pixel format.
 
 ImageDesc (const Size2Du32 &sz, int pixfmt)
 Constructs an image description from a size and pixel format ID.
 
 ImageDesc (size_t w, size_t h, int pixfmt)
 Constructs an image description from width, height, and pixel format ID.
 
int pixelFormatID () const
 Returns the pixel format identifier.
 
bool isValid () const
 Returns true if this image description has valid dimensions and pixel format.
 
const Size2Du32size () const
 Returns the image dimensions.
 
size_t width () const
 Returns the image width in pixels.
 
size_t height () const
 Returns the image height in pixels.
 
void setSize (const Size2Du32 &val)
 Sets the image dimensions.
 
void setSize (int width, int height)
 Sets the image dimensions from width and height values.
 
size_t linePad () const
 Returns the number of padding bytes appended to each scanline.
 
void setLinePad (size_t val)
 Sets the number of padding bytes appended to each scanline.
 
size_t lineAlign () const
 Returns the scanline alignment requirement in bytes.
 
void setLineAlign (size_t val)
 Sets the scanline alignment requirement.
 
bool interlaced () const
 Returns true if the image is interlaced.
 
void setInterlaced (bool val)
 Sets whether the image is interlaced.
 
const PixelFormatpixelFormat () const
 Returns a pointer to the PixelFormat descriptor for this image.
 
void setPixelFormat (int pixfmt)
 Sets the pixel format by ID.
 
const Metadatametadata () const
 Returns a const reference to the metadata.
 
Metadatametadata ()
 Returns a mutable reference to the metadata.
 
int planeCount () const
 Returns the number of image planes defined by the pixel format.
 
String toString () const
 Returns a human-readable string representation of this image description.
 
 operator String () const
 Implicit conversion to String via toString().
 

Detailed Description

Describes the format and layout of a single image.

ImageDesc encapsulates image dimensions (Size2Du32), pixel format, line padding and alignment, interlace mode, and associated metadata. It is used by Image

Example
ImageDesc desc(1920, 1080, PixelFormat::RGBA8);
size_t bytes = desc.imageSize(); // total bytes for all planes
int planes = desc.planeCount();
Describes the format and layout of a single image.
Definition imagedesc.h:33
@ RGBA8
8-bit RGBA (32 bits per pixel).
Definition pixelformat.h:48
and VideoDesc to define the properties of image data.

Constructor & Destructor Documentation

◆ ImageDesc() [1/2]

ImageDesc::ImageDesc ( const Size2Du32 sz,
int  pixfmt 
)
inline

Constructs an image description from a size and pixel format ID.

Parameters
szThe image dimensions.
pixfmtThe pixel format identifier (PixelFormat enum value).

◆ ImageDesc() [2/2]

ImageDesc::ImageDesc ( size_t  w,
size_t  h,
int  pixfmt 
)
inline

Constructs an image description from width, height, and pixel format ID.

Parameters
wThe image width in pixels.
hThe image height in pixels.
pixfmtThe pixel format identifier (PixelFormat enum value).

Member Function Documentation

◆ height()

size_t ImageDesc::height ( ) const
inline

Returns the image height in pixels.

Returns
The height.

◆ interlaced()

bool ImageDesc::interlaced ( ) const
inline

Returns true if the image is interlaced.

Returns
true if interlaced, false if progressive.

◆ isValid()

bool ImageDesc::isValid ( ) const
inline

Returns true if this image description has valid dimensions and pixel format.

Returns
true if valid.

◆ lineAlign()

size_t ImageDesc::lineAlign ( ) const
inline

Returns the scanline alignment requirement in bytes.

Returns
The line alignment (e.g. 1 for no alignment, 16 for 16-byte alignment).

◆ linePad()

size_t ImageDesc::linePad ( ) const
inline

Returns the number of padding bytes appended to each scanline.

Returns
The line padding in bytes.

◆ pixelFormat()

const PixelFormat * ImageDesc::pixelFormat ( ) const
inline

Returns a pointer to the PixelFormat descriptor for this image.

Returns
The PixelFormat pointer.

◆ pixelFormatID()

int ImageDesc::pixelFormatID ( ) const
inline

Returns the pixel format identifier.

Returns
The PixelFormat enum value for this image.

◆ planeCount()

int ImageDesc::planeCount ( ) const
inline

Returns the number of image planes defined by the pixel format.

Returns
The plane count.

◆ setInterlaced()

void ImageDesc::setInterlaced ( bool  val)
inline

Sets whether the image is interlaced.

Parameters
valtrue for interlaced, false for progressive.

◆ setLineAlign()

void ImageDesc::setLineAlign ( size_t  val)
inline

Sets the scanline alignment requirement.

Parameters
valThe alignment in bytes.

◆ setLinePad()

void ImageDesc::setLinePad ( size_t  val)
inline

Sets the number of padding bytes appended to each scanline.

Parameters
valThe line padding in bytes.

◆ setPixelFormat()

void ImageDesc::setPixelFormat ( int  pixfmt)
inline

Sets the pixel format by ID.

Parameters
pixfmtThe pixel format identifier (PixelFormat enum value).

◆ setSize() [1/2]

void ImageDesc::setSize ( const Size2Du32 val)
inline

Sets the image dimensions.

Parameters
valThe new Size2Du32 dimensions.

◆ setSize() [2/2]

void ImageDesc::setSize ( int  width,
int  height 
)
inline

Sets the image dimensions from width and height values.

Parameters
widthThe new width in pixels.
heightThe new height in pixels.

◆ size()

const Size2Du32 & ImageDesc::size ( ) const
inline

Returns the image dimensions.

Returns
A const reference to the Size2Du32.

◆ toString()

String ImageDesc::toString ( ) const
inline

Returns a human-readable string representation of this image description.

Returns
A String containing the dimensions and pixel format name.

◆ width()

size_t ImageDesc::width ( ) const
inline

Returns the image width in pixels.

Returns
The width.

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