NAP
Public Member Functions | Public Attributes | List of all members
SurfaceDescriptor Struct Reference

#include <surfacedescriptor.h>

Public Member Functions

 SurfaceDescriptor ()=default
 
virtual ~SurfaceDescriptor ()=default
 
 SurfaceDescriptor (uint32_t width, uint32_t height, ESurfaceDataType dataType, ESurfaceChannels channels)
 
 SurfaceDescriptor (uint32_t width, uint32_t height, ESurfaceDataType dataType, ESurfaceChannels channels, EColorSpace colorSpace)
 
int getWidth () const
 
int getHeight () const
 
int getPitch () const
 
int getNumChannels () const
 
int getChannelSize () const
 
int getBytesPerPixel () const
 
uint64_t getSizeInBytes () const
 
ESurfaceDataType getDataType () const
 
ESurfaceChannels getChannels () const
 
EColorSpace getColorSpace () const
 
bool isValid () const
 
bool operator== (const SurfaceDescriptor &other) const
 
bool operator!= (const SurfaceDescriptor &other) const
 

Public Attributes

uint32_t mWidth = 0
 Property: 'Width' specifies the width of the texture. More...
 
uint32_t mHeight = 0
 Property: 'Height' specifies the height of the texture. More...
 
ESurfaceDataType mDataType = nap::ESurfaceDataType::BYTE
 Property: 'DataType' specifies the amount of bytes in a single channel. More...
 
ESurfaceChannels mChannels = nap::ESurfaceChannels::BGRA
 Property: 'Channels' specifies the channels and their order. More...
 
EColorSpace mColorSpace = EColorSpace::Linear
 Property: 'ColorSpace' specifies linear or SRGB space. Only applicable to BYTE datatypes. More...
 

Description

Used to describe the data of all 2D surfaces, including 2DTextures and Bitmaps.

Constructor & Destructor Documentation

◆ SurfaceDescriptor() [1/3]

SurfaceDescriptor ( )
default

◆ ~SurfaceDescriptor()

virtual ~SurfaceDescriptor ( )
virtualdefault

◆ SurfaceDescriptor() [2/3]

SurfaceDescriptor ( uint32_t  width,
uint32_t  height,
ESurfaceDataType  dataType,
ESurfaceChannels  channels 
)

◆ SurfaceDescriptor() [3/3]

SurfaceDescriptor ( uint32_t  width,
uint32_t  height,
ESurfaceDataType  dataType,
ESurfaceChannels  channels,
EColorSpace  colorSpace 
)

Member Function Documentation

◆ getBytesPerPixel()

int getBytesPerPixel ( ) const
Returns
Total number of bytes for a single pixel

◆ getChannels()

ESurfaceChannels getChannels ( ) const
Returns
total number of channels, 3 for RGB, 4 for RGBA etc.

◆ getChannelSize()

int getChannelSize ( ) const
Returns
Size in bytes of a single channel: 1 for 8 bit, 2 for short and 4 for float.

◆ getColorSpace()

EColorSpace getColorSpace ( ) const
Returns
surface color space, defaults to Linear.

◆ getDataType()

ESurfaceDataType getDataType ( ) const
Returns
Type of surface: Byte, Short, Float etc.

◆ getHeight()

int getHeight ( ) const
Returns
height of the surface in pixels or texels.

◆ getNumChannels()

int getNumChannels ( ) const
Returns
number of color channels

◆ getPitch()

int getPitch ( ) const
Returns
The size in bytes of 1 row of pixels

◆ getSizeInBytes()

uint64_t getSizeInBytes ( ) const
Returns
total size in bytes for the entire surface

◆ getWidth()

int getWidth ( ) const
Returns
width of the surface in pixels or texels.

◆ isValid()

bool isValid ( ) const
Returns
if the surface is initialized and valid.

◆ operator!=()

bool operator!= ( const SurfaceDescriptor other) const

◆ operator==()

bool operator== ( const SurfaceDescriptor other) const

Member Data Documentation

◆ mChannels

Property: 'Channels' specifies the channels and their order.

◆ mColorSpace

Property: 'ColorSpace' specifies linear or SRGB space. Only applicable to BYTE datatypes.

◆ mDataType

Property: 'DataType' specifies the amount of bytes in a single channel.

◆ mHeight

uint32_t mHeight = 0

Property: 'Height' specifies the height of the texture.

◆ mWidth

uint32_t mWidth = 0

Property: 'Width' specifies the width of the texture.