Ream v0.1.0-1
C++ graphics library for Linux
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
RDRMFormat Class Reference

A DRM Four Character Code format along with a set of supported modifiers. More...

#include <RDRMFormat.h>

Public Member Functions

 RDRMFormat (RFormat format, std::initializer_list< RModifier > modifiers) noexcept
 Constructs a new RDRMFormat with the specified format and modifiers.
 
RFormat format () const noexcept
 Returns the DRM format.
 
void setFormat (RFormat format) noexcept
 Sets a new DRM format.
 
const boost::container::flat_set< RModifier > & modifiers () const noexcept
 Returns the set of modifiers associated with this format.
 
bool addModifier (RModifier modifier) noexcept
 Adds a modifier to the set.
 
bool removeModifier (RModifier modifier) noexcept
 Removes a modifier from the set.
 

Static Public Member Functions

static std::string_view ModifierName (RModifier modifier) noexcept
 Returns the human-readable name of a DRM modifier, or "Unknown" if not found.
 
static const RFormatInfoGetInfo (RFormat format) noexcept
 Retrieves detailed information about a DRM format.
 
static RFormat GetAlphaSubstitute (RFormat format) noexcept
 Returns a substitute format with or without alpha, depending on the input.
 

Detailed Description

A DRM Four Character Code format along with a set of supported modifiers.

It can be passed to buffer allocators to let them choose an optimal modifier for the given format.

Constructor & Destructor Documentation

◆ RDRMFormat()

RDRMFormat ( RFormat  format,
std::initializer_list< RModifier >  modifiers 
)
inlinenoexcept

Constructs a new RDRMFormat with the specified format and modifiers.

Parameters
formatThe DRM format.
modifiersA list of supported modifiers for the format.

Member Function Documentation

◆ ModifierName()

static std::string_view ModifierName ( RModifier  modifier)
staticnoexcept

Returns the human-readable name of a DRM modifier, or "Unknown" if not found.

Parameters
modifierThe DRM modifier to query.
Returns
The modifier name, or "Unknown" if it is not recognized.

◆ GetInfo()

static const RFormatInfo * GetInfo ( RFormat  format)
staticnoexcept

Retrieves detailed information about a DRM format.

Parameters
formatThe DRM format to query.
Returns
A pointer to an RFormatInfo struct if the format is supported, or nullptr otherwise.

◆ GetAlphaSubstitute()

static RFormat GetAlphaSubstitute ( RFormat  format)
staticnoexcept

Returns a substitute format with or without alpha, depending on the input.

For example, this can convert ARGB8888 to XRGB8888 and vice versa. If no suitable substitute exists, the original format is returned.

Parameters
formatThe input DRM format.
Returns
A substitute format with modified alpha presence, or the original format.

◆ format()

RFormat format ( ) const
inlinenoexcept

Returns the DRM format.

◆ setFormat()

void setFormat ( RFormat  format)
inlinenoexcept

Sets a new DRM format.

◆ modifiers()

const boost::container::flat_set< RModifier > & modifiers ( ) const
inlinenoexcept

Returns the set of modifiers associated with this format.

◆ addModifier()

bool addModifier ( RModifier  modifier)
inlinenoexcept

Adds a modifier to the set.

Parameters
modifierThe modifier to add.
Returns
true if the modifier was newly added, false if it was already present.

◆ removeModifier()

bool removeModifier ( RModifier  modifier)
inlinenoexcept

Removes a modifier from the set.

Parameters
modifierThe modifier to remove.
Returns
true if the modifier was removed, false if it was not found.