Gamp v0.0.8
Gamp: Graphics, Audio, Multimedia and Processing
Loading...
Searching...
No Matches
gamp::wt::Capabilities Class Reference

Specifies a set of capabilities that a window's rendering context must support, such as color depth per channel. More...

#include <Capabilities.hpp>

Inheritance diagram for gamp::wt::Capabilities:
Collaboration diagram for gamp::wt::Capabilities:

Public Member Functions

constexpr Capabilities () noexcept=default
 Creates a Capabilities object.
 
constexpr Capabilities (Capabilities &&) noexcept=default
 
constexpr Capabilities (const Capabilities &) noexcept=default
 
virtual ~Capabilities () noexcept=default
 
constexpr int alphaBits () const noexcept
 Returns the number of bits for the color buffer's alpha component.
 
constexpr int & alphaBits () noexcept
 Returns the reference to the number of bits for the color buffer's blue component.
 
constexpr int blueBits () const noexcept
 Returns the number of bits for the color buffer's blue component.
 
constexpr int & blueBits () noexcept
 Returns the reference to the number of bits for the color buffer's blue component.
 
virtual CapabilitiesPtr clone () const noexcept
 
virtual int compare (const Capabilities &rhs) const noexcept
 Comparing RGBA values only.
 
constexpr int greenBits () const noexcept
 Returns the number of bits for the color buffer's green component.
 
constexpr int & greenBits () noexcept
 Returns the reference to the number of bits for the color buffer's green component.
 
virtual std::size_t hash_code () const noexcept
 
constexpr bool isBackgroundOpaque () const noexcept
 Returns whether an opaque or translucent surface is requested, supported or chosen.
 
constexpr bool isBitmap () const noexcept
 Returns whether bitmap offscreen mode is requested, available or chosen.
 
constexpr bool isOnscreen () const noexcept
 Returns whether an on- or offscreen surface is requested, available or chosen.
 
std::strong_ordering operator<=> (const Capabilities &rhs) const noexcept
 
Capabilitiesoperator= (const Capabilities &) noexcept=default
 
virtual bool operator== (const Capabilities &rhs) const noexcept
 
constexpr int redBits () const noexcept
 Returns the number of bits for the color buffer's red component.
 
constexpr int & redBits () noexcept
 Returns the reference to the number of bits for the color buffer's red component.
 
constexpr void setBackgroundOpaque (bool opaque) noexcept
 Sets whether the surface shall be opaque or translucent.
 
constexpr void setBitmap (bool enable) noexcept
 Requesting offscreen bitmap mode.
 
constexpr void setOnscreen (bool v) noexcept
 Sets whether the surface shall be on- or offscreen.
 
virtual const jau::type_infosignature () const noexcept
 
virtual std::string toString () const
 Returns a textual representation of this Capabilities object.
 
constexpr int transparentAlphaValue () const noexcept
 Gets the transparent alpha value for the frame buffer configuration.
 
constexpr int & transparentAlphaValue () noexcept
 Allows setting the transparent alpha value for the frame buffer configuration, ranging from 0 to the maximum frame buffer value for alpha.
 
constexpr int transparentBlueValue () const noexcept
 Gets the transparent blue value for the frame buffer configuration.
 
constexpr int & transparentBlueValue () noexcept
 Allows setting the transparent blue value for the frame buffer configuration, ranging from 0 to the maximum frame buffer value for blue.
 
constexpr int transparentGreenValue () const noexcept
 Gets the transparent green value for the frame buffer configuration.
 
constexpr int & transparentGreenValue () noexcept
 Allows setting the transparent green value for the frame buffer configuration, ranging from 0 to the maximum frame buffer value for green.
 
constexpr int transparentRedValue () const noexcept
 Gets the transparent red value for the frame buffer configuration.
 
constexpr int & transparentRedValue () noexcept
 Allows setting the transparent red value for the frame buffer configuration, ranging from 0 to the maximum frame buffer value for red.
 
constexpr int visualID () const noexcept
 
constexpr int & visualID () noexcept
 

Protected Member Functions

void toString (std::string &sink, bool withOnOffScreen) const
 

Static Protected Attributes

static constexpr std::string_view CSEP = ", "
 Component separator.
 
static constexpr std::string_view ESEP = "/"
 Element separator.
 
static constexpr std::string_view na_str = "----"
 

Detailed Description

Specifies a set of capabilities that a window's rendering context must support, such as color depth per channel.

It currently contains the minimal number of routines which allow configuration on all supported window systems.

Default (bit-sizes):

  • bit sizes
    • red 8
    • green 8
    • blue 8
    • alpha 8
    • transparent off (zero)
  • flags
    • onscreen true
    • bitmap false

Definition at line 46 of file Capabilities.hpp.

Constructor & Destructor Documentation

◆ Capabilities() [1/3]

gamp::wt::Capabilities::Capabilities ( )
constexprdefaultnoexcept

Creates a Capabilities object.

All attributes are in a default state.

Here is the caller graph for this function:

◆ ~Capabilities()

virtual gamp::wt::Capabilities::~Capabilities ( )
virtualdefaultnoexcept

◆ Capabilities() [2/3]

gamp::wt::Capabilities::Capabilities ( const Capabilities & )
constexprdefaultnoexcept

◆ Capabilities() [3/3]

gamp::wt::Capabilities::Capabilities ( Capabilities && )
constexprdefaultnoexcept

Member Function Documentation

◆ operator=()

Capabilities & gamp::wt::Capabilities::operator= ( const Capabilities & )
defaultnoexcept

◆ signature()

virtual const jau::type_info & gamp::wt::Capabilities::signature ( ) const
inlinevirtualnoexcept

Reimplemented in gamp::render::gl::GLCapabilities.

Definition at line 82 of file Capabilities.hpp.

Here is the caller graph for this function:

◆ clone()

virtual CapabilitiesPtr gamp::wt::Capabilities::clone ( ) const
inlinevirtualnoexcept

Reimplemented in gamp::render::gl::GLCapabilities.

Definition at line 84 of file Capabilities.hpp.

◆ hash_code()

virtual std::size_t gamp::wt::Capabilities::hash_code ( ) const
inlinevirtualnoexcept

Reimplemented in gamp::render::gl::GLCapabilities.

Definition at line 86 of file Capabilities.hpp.

Here is the caller graph for this function:

◆ operator==()

virtual bool gamp::wt::Capabilities::operator== ( const Capabilities & rhs) const
inlinevirtualnoexcept

Reimplemented in gamp::render::gl::GLCapabilities.

Definition at line 102 of file Capabilities.hpp.

Here is the caller graph for this function:

◆ compare()

virtual int gamp::wt::Capabilities::compare ( const Capabilities & rhs) const
inlinevirtualnoexcept

Comparing RGBA values only.

Returns

  • -1 if this < other
  • 0 if this == other
  • 1 if this > other

Reimplemented in gamp::render::gl::GLCapabilities.

Definition at line 142 of file Capabilities.hpp.

Here is the caller graph for this function:

◆ operator<=>()

std::strong_ordering gamp::wt::Capabilities::operator<=> ( const Capabilities & rhs) const
inlinenoexcept

Definition at line 159 of file Capabilities.hpp.

◆ visualID() [1/2]

int gamp::wt::Capabilities::visualID ( ) const
inlineconstexprnoexcept

Definition at line 164 of file Capabilities.hpp.

Here is the caller graph for this function:

◆ redBits() [1/2]

int gamp::wt::Capabilities::redBits ( ) const
inlineconstexprnoexcept

Returns the number of bits for the color buffer's red component.

Definition at line 166 of file Capabilities.hpp.

◆ greenBits() [1/2]

int gamp::wt::Capabilities::greenBits ( ) const
inlineconstexprnoexcept

Returns the number of bits for the color buffer's green component.

Definition at line 168 of file Capabilities.hpp.

◆ blueBits() [1/2]

int gamp::wt::Capabilities::blueBits ( ) const
inlineconstexprnoexcept

Returns the number of bits for the color buffer's blue component.

Definition at line 170 of file Capabilities.hpp.

◆ alphaBits() [1/2]

int gamp::wt::Capabilities::alphaBits ( ) const
inlineconstexprnoexcept

Returns the number of bits for the color buffer's alpha component.

Definition at line 172 of file Capabilities.hpp.

Here is the caller graph for this function:

◆ visualID() [2/2]

int & gamp::wt::Capabilities::visualID ( )
inlineconstexprnoexcept

Definition at line 174 of file Capabilities.hpp.

◆ redBits() [2/2]

int & gamp::wt::Capabilities::redBits ( )
inlineconstexprnoexcept

Returns the reference to the number of bits for the color buffer's red component.

Definition at line 177 of file Capabilities.hpp.

◆ greenBits() [2/2]

int & gamp::wt::Capabilities::greenBits ( )
inlineconstexprnoexcept

Returns the reference to the number of bits for the color buffer's green component.

Definition at line 180 of file Capabilities.hpp.

◆ blueBits() [2/2]

int & gamp::wt::Capabilities::blueBits ( )
inlineconstexprnoexcept

Returns the reference to the number of bits for the color buffer's blue component.

Definition at line 183 of file Capabilities.hpp.

◆ alphaBits() [2/2]

int & gamp::wt::Capabilities::alphaBits ( )
inlineconstexprnoexcept

Returns the reference to the number of bits for the color buffer's blue component.

Note: If alpha bits are zero, they are set to one by setBackgroundOpaque(boolean) and it's OpenGL specialization GLCapabilities::setSampleBuffers(boolean).
Ensure to call this method after the above to ensure a zero value. The above automated settings takes into account, that the user calls this method to request alpha bits, not to reflect a current state. Nevertheless if this is the case - call it at last.

Definition at line 194 of file Capabilities.hpp.

◆ setBackgroundOpaque()

void gamp::wt::Capabilities::setBackgroundOpaque ( bool opaque)
inlineconstexprnoexcept

Sets whether the surface shall be opaque or translucent.

Platform implementations may need an alpha component in the surface (eg. Windows), or expect pre-multiplied alpha values (eg. X11/XRender).
To unify the experience, this method also invokes setAlphaBits(1) if getAlphaBits() == 0.
Please note that in case alpha is required on the platform the clear color shall have an alpha lower than 1.0 to allow anything shining through.

Mind that translucency may cause a performance penalty due to the composite work required by the window manager.

Definition at line 211 of file Capabilities.hpp.

◆ isBackgroundOpaque()

bool gamp::wt::Capabilities::isBackgroundOpaque ( ) const
inlineconstexprnoexcept

Returns whether an opaque or translucent surface is requested, supported or chosen.

Default is true, i.e. opaque.

Definition at line 224 of file Capabilities.hpp.

◆ setOnscreen()

void gamp::wt::Capabilities::setOnscreen ( bool v)
inlineconstexprnoexcept

Sets whether the surface shall be on- or offscreen.

Defaults to true.

If requesting an offscreen surface without further selection of it's mode, e.g. FBO, Pbuffer or bitmap, the implementation will choose the best available offscreen mode.

Parameters
onscreen

Definition at line 238 of file Capabilities.hpp.

Here is the caller graph for this function:

◆ isOnscreen()

bool gamp::wt::Capabilities::isOnscreen ( ) const
inlineconstexprnoexcept

Returns whether an on- or offscreen surface is requested, available or chosen.

Default is true, i.e. onscreen.

Mind that an capabilities intance w/ available semantics may show onscreen, but also the offscreen modes FBO or bitmap. This is valid, since one native configuration maybe used for either functionality.

Definition at line 251 of file Capabilities.hpp.

Here is the caller graph for this function:

◆ setBitmap()

void gamp::wt::Capabilities::setBitmap ( bool enable)
inlineconstexprnoexcept

Requesting offscreen bitmap mode.

If enabled this method also invokes setOnscreen(false).

Defaults to false.

Requesting offscreen bitmap mode disables the offscreen auto selection.

Definition at line 265 of file Capabilities.hpp.

◆ isBitmap()

bool gamp::wt::Capabilities::isBitmap ( ) const
inlineconstexprnoexcept

Returns whether bitmap offscreen mode is requested, available or chosen.

Default is false.

For chosen capabilities, only the selected offscreen surface is set to true.

Definition at line 281 of file Capabilities.hpp.

Here is the caller graph for this function:

◆ transparentRedValue() [1/2]

int gamp::wt::Capabilities::transparentRedValue ( ) const
inlineconstexprnoexcept

Gets the transparent red value for the frame buffer configuration.

This value is undefined if; equals true.

Definition at line 287 of file Capabilities.hpp.

◆ transparentGreenValue() [1/2]

int gamp::wt::Capabilities::transparentGreenValue ( ) const
inlineconstexprnoexcept

Gets the transparent green value for the frame buffer configuration.

This value is undefined if; equals true.

Definition at line 292 of file Capabilities.hpp.

◆ transparentBlueValue() [1/2]

int gamp::wt::Capabilities::transparentBlueValue ( ) const
inlineconstexprnoexcept

Gets the transparent blue value for the frame buffer configuration.

This value is undefined if; equals true.

Definition at line 297 of file Capabilities.hpp.

◆ transparentAlphaValue() [1/2]

int gamp::wt::Capabilities::transparentAlphaValue ( ) const
inlineconstexprnoexcept

Gets the transparent alpha value for the frame buffer configuration.

This value is undefined if; equals true.

Definition at line 302 of file Capabilities.hpp.

◆ transparentRedValue() [2/2]

int & gamp::wt::Capabilities::transparentRedValue ( )
inlineconstexprnoexcept

Allows setting the transparent red value for the frame buffer configuration, ranging from 0 to the maximum frame buffer value for red.

This value is ignored if isBackgroundOpaque() equals true.
It defaults to half of the frambuffer value for red.
A value of -1 is interpreted as any value.

Definition at line 309 of file Capabilities.hpp.

◆ transparentGreenValue() [2/2]

int & gamp::wt::Capabilities::transparentGreenValue ( )
inlineconstexprnoexcept

Allows setting the transparent green value for the frame buffer configuration, ranging from 0 to the maximum frame buffer value for green.

This value is ignored if isBackgroundOpaque() equals true.
It defaults to half of the frambuffer value for green.
A value of -1 is interpreted as any value.

Definition at line 316 of file Capabilities.hpp.

◆ transparentBlueValue() [2/2]

int & gamp::wt::Capabilities::transparentBlueValue ( )
inlineconstexprnoexcept

Allows setting the transparent blue value for the frame buffer configuration, ranging from 0 to the maximum frame buffer value for blue.

This value is ignored if isBackgroundOpaque() equals true.
It defaults to half of the frambuffer value for blue.
A value of -1 is interpreted as any value.

Definition at line 323 of file Capabilities.hpp.

◆ transparentAlphaValue() [2/2]

int & gamp::wt::Capabilities::transparentAlphaValue ( )
inlineconstexprnoexcept

Allows setting the transparent alpha value for the frame buffer configuration, ranging from 0 to the maximum frame buffer value for alpha.

This value is ignored if isBackgroundOpaque() equals true.
It defaults to half of the frambuffer value for alpha.
A value of -1 is interpreted as any value.

Definition at line 330 of file Capabilities.hpp.

◆ toString() [1/2]

virtual std::string gamp::wt::Capabilities::toString ( ) const
inlinevirtual

Returns a textual representation of this Capabilities object.

Reimplemented in gamp::render::gl::GLCapabilities.

Definition at line 334 of file Capabilities.hpp.

Here is the caller graph for this function:

◆ toString() [2/2]

void gamp::wt::Capabilities::toString ( std::string & sink,
bool withOnOffScreen ) const
inlineprotected

Definition at line 346 of file Capabilities.hpp.

Member Data Documentation

◆ na_str

std::string_view gamp::wt::Capabilities::na_str = "----"
staticconstexprprotected

Definition at line 48 of file Capabilities.hpp.

◆ ESEP

std::string_view gamp::wt::Capabilities::ESEP = "/"
staticconstexprprotected

Element separator.

Definition at line 342 of file Capabilities.hpp.

◆ CSEP

std::string_view gamp::wt::Capabilities::CSEP = ", "
staticconstexprprotected

Component separator.

Definition at line 344 of file Capabilities.hpp.


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