Kanzi  3.9.6
Kanzi Engine API
kanzi::emscripten::DefaultEmscriptenGraphicsOutput Class Reference

Class representing a default Emscripten graphics output. More...

#include <kanzi/core.ui/platform/graphics_output/emscripten/default_emscripten_graphics_output.hpp>

Inheritance diagram for kanzi::emscripten::DefaultEmscriptenGraphicsOutput:
[legend]

Public Member Functions

KZ_NO_DISCARD optional< void * > createImage (int target, void *data, int *attributes) noexcept override
 Function for creating native image object, which can be shared between client APIs. More...
 
 DefaultEmscriptenGraphicsOutput (const DefaultEGLGraphicsOutputProperties &properties)
 Constructor. More...
 
bool destroyImage (void *image) noexcept override
 Destroys an EGL image. More...
 
void gatherEvents (EventQueue &queue) override
 Amends the given event queue with events received so far. More...
 
KZ_NO_DISCARD optional< SurfaceColorSpacegetColorSpace () const noexcept override
 Gets the color space used by the associated graphics context. More...
 
KZ_NO_DISCARD optional< GraphicsContextAPIgetGraphicsContextAPI () const noexcept override
 Gets the API used by the associated graphics context. More...
 
KZ_NO_DISCARD optional< void * > getNativeContextHandle () const noexcept override
 Gets associated native GL context handle. More...
 
KZ_NO_DISCARD optional< void * > getNativeDisplayHandle () const noexcept override
 Gets associated native GL display handle. More...
 
KZ_NO_DISCARD optional< NativeEventHandlegetNativeEventHandle () const noexcept override
 Returns a waitable event handle for this event source, if available. More...
 
KZ_NO_DISCARD optional< void * > getNativeSurfaceHandle () const noexcept override
 Gets associated native GL surface handle. More...
 
KZ_NO_DISCARD GLProcPointer getProcAddress (string_view functionName) override
 Retrieves pointer to GL function. More...
 
KZ_NO_DISCARD optional< SurfaceClientAPIgetSurfaceClientAPI () const noexcept override
 Gets the type of the associated graphics surface. More...
 
KZ_NO_DISCARD Matrix4x4 getTargetTransformation () const noexcept override
 Returns the target transformation. More...
 
KZ_NO_DISCARD optional< unsigned int > getWindowHeight () const noexcept
 Returns the active window height. More...
 
KZ_NO_DISCARD optional< unsigned int > getWindowWidth () const noexcept
 Returns the active window width. More...
 
void logWindowSize () const noexcept
 Prints the active window size to log. More...
 
bool makeCurrent () noexcept override
 Make the current EGL thread active. More...
 
bool releaseCurrent () noexcept override
 Makes the currently active graphics output inactive for the current thread. More...
 
bool swapBuffers () override
 Posts rendering results. More...
 
bool swapInterval (int interval) override
 Sets minimum number of displayed video frames before a buffer swap. More...
 
- Public Member Functions inherited from kanzi::GraphicsOutput
KZ_NO_DISCARD Vector2 getDpi () const noexcept
 Returns the resolution of the target coordinate system in dots per inch. More...
 
KZ_NO_DISCARD unsigned int getHeight () const noexcept
 Returns the height of layout area in the target coordinate system. More...
 
KZ_NO_DISCARD unsigned int getWidth () const noexcept
 Returns the width of layout area in the target coordinate system. More...
 
virtual ~GraphicsOutput ()=default
 Destructor. More...
 
- Public Member Functions inherited from kanzi::EventSource
virtual ~EventSource ()=default
 Destructor. More...
 
- Public Member Functions inherited from kanzi::GLGraphicsOutput
virtual ~GLGraphicsOutput ()=default
 Destructor. More...
 

Protected Member Functions

void setTargetTransformation (Matrix4x4 targetTransformation) noexcept
 Sets the target transformation. More...
 
bool updateCachedValues (unsigned int width, unsigned int height) noexcept
 Updates all cached values from given layout size. More...
 
- Protected Member Functions inherited from kanzi::GraphicsOutput
void updateDpi (Vector2 dpi)
 Updates the target layout area resolution. More...
 
void updateSize (unsigned int width, unsigned int height)
 Updates the target layout area size. More...
 

Additional Inherited Members

- Public Types inherited from kanzi::GLGraphicsOutput
using GLProcPointer = void(*)()
 Pointer to GL function. More...
 

Detailed Description

Class representing a default Emscripten graphics output.

Constructor & Destructor Documentation

◆ DefaultEmscriptenGraphicsOutput()

kanzi::emscripten::DefaultEmscriptenGraphicsOutput::DefaultEmscriptenGraphicsOutput ( const DefaultEGLGraphicsOutputProperties properties)
explicit

Constructor.

Parameters
propertiesSpecifies properties to request for the graphics output.

Member Function Documentation

◆ logWindowSize()

void kanzi::emscripten::DefaultEmscriptenGraphicsOutput::logWindowSize ( ) const
noexcept

Prints the active window size to log.

◆ gatherEvents()

void kanzi::emscripten::DefaultEmscriptenGraphicsOutput::gatherEvents ( EventQueue queue)
overridevirtual

Amends the given event queue with events received so far.

Parameters
queueEvent queue to be amended. Do not clear nor assume to be empty.

Implements kanzi::EventSource.

◆ getNativeEventHandle()

KZ_NO_DISCARD optional<NativeEventHandle> kanzi::emscripten::DefaultEmscriptenGraphicsOutput::getNativeEventHandle ( ) const
overridevirtualnoexcept

Returns a waitable event handle for this event source, if available.

Return values
nulloptGetting the event handle failed.
Returns
The native event handle.

Implements kanzi::EventSource.

◆ getProcAddress()

KZ_NO_DISCARD GLProcPointer kanzi::emscripten::DefaultEmscriptenGraphicsOutput::getProcAddress ( string_view  functionName)
overridevirtual

Retrieves pointer to GL function.

Parameters
functionNameName of the function.
Returns
Pointer to the function, or null if not found.

Implements kanzi::GLGraphicsOutput.

◆ makeCurrent()

bool kanzi::emscripten::DefaultEmscriptenGraphicsOutput::makeCurrent ( )
overridevirtualnoexcept

Make the current EGL thread active.

Returns
True on success, false on failure.

Implements kanzi::GLGraphicsOutput.

◆ releaseCurrent()

bool kanzi::emscripten::DefaultEmscriptenGraphicsOutput::releaseCurrent ( )
overridevirtualnoexcept

Makes the currently active graphics output inactive for the current thread.

Returns
True, on success.

Implements kanzi::GLGraphicsOutput.

◆ swapBuffers()

bool kanzi::emscripten::DefaultEmscriptenGraphicsOutput::swapBuffers ( )
overridevirtual

Posts rendering results.

Implicitly flushes the rendering pipeline and executes all received rendering commands before posting.

Returns
True on success, false on failure.

Implements kanzi::GLGraphicsOutput.

◆ swapInterval()

bool kanzi::emscripten::DefaultEmscriptenGraphicsOutput::swapInterval ( int  interval)
overridevirtual

Sets minimum number of displayed video frames before a buffer swap.

Parameters
intervalMinimum number of video frames to wait before buffer swap.
Returns
True on success, false on failure.

Implements kanzi::GLGraphicsOutput.

◆ getTargetTransformation()

KZ_NO_DISCARD Matrix4x4 kanzi::emscripten::DefaultEmscriptenGraphicsOutput::getTargetTransformation ( ) const
overridevirtualnoexcept

Returns the target transformation.

Returns
Target transformation matrix.

Implements kanzi::GLGraphicsOutput.

◆ getGraphicsContextAPI()

KZ_NO_DISCARD optional<GraphicsContextAPI> kanzi::emscripten::DefaultEmscriptenGraphicsOutput::getGraphicsContextAPI ( ) const
overridevirtualnoexcept

Gets the API used by the associated graphics context.

Return values
nulloptGetting the graphics context failed.
Returns
Graphics context API.

Implements kanzi::GLGraphicsOutput.

◆ getSurfaceClientAPI()

KZ_NO_DISCARD optional<SurfaceClientAPI> kanzi::emscripten::DefaultEmscriptenGraphicsOutput::getSurfaceClientAPI ( ) const
overridevirtualnoexcept

Gets the type of the associated graphics surface.

Return values
nulloptGetting the graphics surface failed.
Returns
Surface type.

Implements kanzi::GLGraphicsOutput.

◆ getColorSpace()

KZ_NO_DISCARD optional<SurfaceColorSpace> kanzi::emscripten::DefaultEmscriptenGraphicsOutput::getColorSpace ( ) const
overridevirtualnoexcept

Gets the color space used by the associated graphics context.

Return values
nulloptGetting the color space failed.
Returns
Color Space.

Implements kanzi::GLGraphicsOutput.

◆ getNativeDisplayHandle()

KZ_NO_DISCARD optional<void*> kanzi::emscripten::DefaultEmscriptenGraphicsOutput::getNativeDisplayHandle ( ) const
overridevirtualnoexcept

Gets associated native GL display handle.

Return values
nulloptGetting GL display failed.
Returns
The handle of associated display object.

Implements kanzi::GLGraphicsOutput.

◆ getNativeContextHandle()

KZ_NO_DISCARD optional<void*> kanzi::emscripten::DefaultEmscriptenGraphicsOutput::getNativeContextHandle ( ) const
overridevirtualnoexcept

Gets associated native GL context handle.

Return values
nulloptGetting GL context failed.
Returns
The handle of associated graphics context object.

Implements kanzi::GLGraphicsOutput.

◆ getNativeSurfaceHandle()

KZ_NO_DISCARD optional<void*> kanzi::emscripten::DefaultEmscriptenGraphicsOutput::getNativeSurfaceHandle ( ) const
overridevirtualnoexcept

Gets associated native GL surface handle.

Return values
nulloptGetting GL surface failed.
Returns
The handle of associated surface object.

Implements kanzi::GLGraphicsOutput.

◆ createImage()

KZ_NO_DISCARD optional<void*> kanzi::emscripten::DefaultEmscriptenGraphicsOutput::createImage ( int  target,
void *  data,
int *  attributes 
)
overridevirtualnoexcept

Function for creating native image object, which can be shared between client APIs.

The returned image must be destroyed using destroyImage().

Parameters
targetContext-specific target specifier.
dataData to use as image contents.
attributesContext-specific attributes list.
Returns
Returns created image, or null on error.
See also
destroyImage().

Implements kanzi::GLGraphicsOutput.

◆ destroyImage()

bool kanzi::emscripten::DefaultEmscriptenGraphicsOutput::destroyImage ( void *  image)
overridevirtualnoexcept

Destroys an EGL image.

Parameters
imageEGL image to destroy.
Returns
True on success, false on failure.

Implements kanzi::GLGraphicsOutput.

◆ getWindowWidth()

KZ_NO_DISCARD optional<unsigned int> kanzi::emscripten::DefaultEmscriptenGraphicsOutput::getWindowWidth ( ) const
noexcept

Returns the active window width.

Return values
nulloptGetting the width failed.
Returns
Window width in implementation defined units.

◆ getWindowHeight()

KZ_NO_DISCARD optional<unsigned int> kanzi::emscripten::DefaultEmscriptenGraphicsOutput::getWindowHeight ( ) const
noexcept

Returns the active window height.

Return values
nulloptGetting the height failed.
Returns
Window height in implementation defined units.

◆ setTargetTransformation()

void kanzi::emscripten::DefaultEmscriptenGraphicsOutput::setTargetTransformation ( Matrix4x4  targetTransformation)
inlineprotectednoexcept

Sets the target transformation.

Parameters
targetTransformationThe target transformation matrix.

◆ updateCachedValues()

bool kanzi::emscripten::DefaultEmscriptenGraphicsOutput::updateCachedValues ( unsigned int  width,
unsigned int  height 
)
protectednoexcept

Updates all cached values from given layout size.

Parameters
widthLayout area width in pixels.
heightLayout area height in pixels.
Returns
True, if the given values were new.

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