Louvre  v2.13.0-1
C++ library for Wayland compositors
Classes | Public Types | Public Member Functions | List of all members
LView Class Referenceabstract

Base class for LScene views. More...

+ Inheritance diagram for LView:

Classes

struct  PaintEventParams
 Parameters used within a paintEvent(). More...
 

Public Types

enum  Type : UInt8
 Types of views included with Louvre. More...
 

Public Member Functions

 LView (UInt32 type, bool renderable, LView *parent) noexcept
 Construct an LView object. More...
 
 ~LView () noexcept
 Destructor for the LView class. More...
 
void enablePointerEvents (bool enabled) noexcept
 Toggles pointer events. More...
 
bool pointerEventsEnabled () const noexcept
 Checks if pointer events are enabled. More...
 
bool pointerIsOver () const noexcept
 Checks if the view has pointer focus. More...
 
void enableBlockPointer (bool enabled) noexcept
 Toggles blocking pointer events to views behind the view's input region. More...
 
bool blockPointerEnabled () const noexcept
 Checks if blocking of pointer events is enabled. More...
 
void enableKeyboardEvents (bool enabled) noexcept
 Toggles keyboard events. More...
 
bool keyboardEventsEnabled () const noexcept
 Checks if keyboard events are enabled. More...
 
void enableTouchEvents (bool enabled) noexcept
 Toggles touch events. More...
 
bool touchEventsEnabled () const noexcept
 Checks if touch events are enabled. More...
 
void enableBlockTouch (bool enabled) noexcept
 Toggles blocking touch events to views behind the view's input region. More...
 
bool blockTouchEnabled () const noexcept
 Checks if blocking of touch events to views behind the view's input region is enabled. More...
 
void damageAll () noexcept
 Forces a complete repaint of the view in the next rendering frame. More...
 
LScenescene () const noexcept
 Gets the scene in which this view is currently embedded. More...
 
bool isLScene () const noexcept
 Checks if the view is an LScene::mainView(). More...
 
LSceneViewparentSceneView () const noexcept
 Gets the closest parent LSceneView. More...
 
UInt32 type () const noexcept
 Gets the identifier for the type of view. More...
 
bool isRenderable () const noexcept
 Checks if the view is renderable. More...
 
void repaint () const noexcept
 Schedules a repaint for all outputs where this view is currently visible. More...
 
LViewparent () const noexcept
 Gets the parent of the view. More...
 
void setParent (LView *view) noexcept
 Sets the new parent for the view and insert it at the end of its children list. More...
 
void insertAfter (LView *prev) noexcept
 Inserts the view after the specified 'prev' view. More...
 
const std::list< LView * > & children () const noexcept
 Children views. More...
 
void enableParentOffset (bool enabled) noexcept
 Toggles the parent position offset. More...
 
bool parentOffsetEnabled () const noexcept
 Checks if pos() includes the parent's position. More...
 
const LPointpos () const noexcept
 Gets the current position of the view with applied transformations. More...
 
const LSizesize () const noexcept
 Gets the current size of the view with applied transformations. More...
 
void enableClipping (bool enabled) noexcept
 Toggles the use of the clippingRect() property. More...
 
bool clippingEnabled () const noexcept
 Checks if the view is currently being clipped to the clippingRect() property. More...
 
void setClippingRect (const LRect &rect) noexcept
 Sets a custom clipping rect. More...
 
const LRectclippingRect () const noexcept
 Gets the clipping rect set with setClippingRect(). More...
 
void enableParentClipping (bool enabled) noexcept
 Toggles parent clipping. More...
 
bool parentClippingEnabled () const noexcept
 Checks if the view is clipped to the parent view rect. More...
 
void enableScaling (bool enabled) noexcept
 Toggles the use of the scalingVector(). More...
 
bool scalingEnabled () const noexcept
 Checks if the scalingVector() is enabled. More...
 
void setScalingVector (const LSizeF &scalingVector) noexcept
 Sets the scalingVector() property. More...
 
const LSizeFscalingVector (bool forceIgnoreParent=false) const noexcept
 Gets the scaling vector. More...
 
void enableParentScaling (bool enabled) noexcept
 Toggles the scaling of size and position by the parent's scaling vector. More...
 
bool parentScalingEnabled () const noexcept
 Checks if the size and position are scaled by the parent's scalingVector(). More...
 
void setVisible (bool visible) noexcept
 Toggles the view visibility. More...
 
bool visible () const noexcept
 Checks if the view is marked as visible. More...
 
bool mapped () const noexcept
 Checks if the view should be rendered, taking into consideration several conditions. More...
 
void setOpacity (Float32 opacity) noexcept
 Set the view opacity. More...
 
Float32 opacity (bool forceIgnoreParent=false) const noexcept
 Gets the view opacity. More...
 
void enableParentOpacity (bool enabled) noexcept
 Toggles the use of the parent's opacity. More...
 
bool parentOpacityEnabled () const noexcept
 Checks if the view's opacity is multiplied by its parent's opacity. More...
 
void enableForceRequestNextFrame (bool enabled) noexcept
 Toggles forcing triggering the requestNextFrame() event. More...
 
bool forceRequestNextFrameEnabled () const noexcept
 Checks if forcing requestNextFrame() is enabled. More...
 
void setBlendFunc (const LBlendFunc &blendFunc) noexcept
 Sets a custom alpha/color blending function for the view. More...
 
const LBlendFuncblendFunc () const noexcept
 Gets the blending function set with setBlendFunc(). More...
 
void enableAutoBlendFunc (bool enabled) noexcept
 Toggles the automatic blend function adjustment. More...
 
bool autoBlendFuncEnabled () const noexcept
 Checks whether the automatic blend function adjustment is enabled. More...
 
void setColorFactor (const LRGBAF &colorFactor) noexcept
 Set the color factor. More...
 
const LRGBAFcolorFactor () const noexcept
 Gets the color factor. More...
 
LBox boundingBox () const noexcept
 Gets the bounding box of the view and all its mapped children. More...
 
virtual bool nativeMapped () const noexcept=0
 Tells whether the view should be rendered. More...
 
virtual const LPointnativePos () const noexcept=0
 Gets the position of the view without any transformations applied. More...
 
virtual const LSizenativeSize () const noexcept=0
 Gets the size of the view without any transformations applied. More...
 
virtual Float32 bufferScale () const noexcept=0
 Gets the scale of the view buffer content. More...
 
virtual void enteredOutput (LOutput *output) noexcept=0
 Notifies that portion of the view is visible on the given output. More...
 
virtual void leftOutput (LOutput *output) noexcept=0
 Notifies that the view is no longer visible on the given output. More...
 
virtual const std::vector< LOutput * > & outputs () const noexcept=0
 Gets a vector of output pointers on which the view is currently visible. More...
 
virtual void requestNextFrame (LOutput *output) noexcept=0
 Notifies that the view has been rendered on the given output. More...
 
virtual const LRegiondamage () const noexcept=0
 Gets the region within the view rect that needs to be repainted. More...
 
virtual const LRegiontranslucentRegion () const noexcept=0
 Gets the current translucent region. More...
 
virtual const LRegionopaqueRegion () const noexcept=0
 Gets the current opaque region. More...
 
virtual const LRegioninputRegion () const noexcept=0
 Gets the current input region. More...
 
virtual void paintEvent (const PaintEventParams &params) noexcept=0
 Requests to paint a region of the view to the current framebuffer. More...
 
virtual void pointerEnterEvent (const LPointerEnterEvent &event)
 Handles a pointer enter event within the view. More...
 
virtual void pointerMoveEvent (const LPointerMoveEvent &event)
 Handle a pointer move event within the view. More...
 
virtual void pointerLeaveEvent (const LPointerLeaveEvent &event)
 Handle a pointer leave event within the view. More...
 
virtual void pointerButtonEvent (const LPointerButtonEvent &event)
 Handle a pointer button event within the view. More...
 
virtual void pointerScrollEvent (const LPointerScrollEvent &event)
 Handle a pointer scroll event within the view. More...
 
virtual void pointerSwipeBeginEvent (const LPointerSwipeBeginEvent &event)
 Handle a pointer swipe begin event within the view. More...
 
virtual void pointerSwipeUpdateEvent (const LPointerSwipeUpdateEvent &event)
 Handle a pointer swipe update event within the view. More...
 
virtual void pointerSwipeEndEvent (const LPointerSwipeEndEvent &event)
 Handle a pointer swipe end event within the view. More...
 
virtual void pointerPinchBeginEvent (const LPointerPinchBeginEvent &event)
 Handle a pointer pinch begin event within the view. More...
 
virtual void pointerPinchUpdateEvent (const LPointerPinchUpdateEvent &event)
 Handle a pointer pinch update event within the view. More...
 
virtual void pointerPinchEndEvent (const LPointerPinchEndEvent &event)
 Handle a pointer pinch end event within the view. More...
 
virtual void pointerHoldBeginEvent (const LPointerHoldBeginEvent &event)
 Handle a pointer hold begin event within the view. More...
 
virtual void pointerHoldEndEvent (const LPointerHoldEndEvent &event)
 Handle a pointer hold end event within the view. More...
 
virtual void keyEvent (const LKeyboardKeyEvent &event)
 Handle the key event within the view. More...
 
virtual void touchDownEvent (const LTouchDownEvent &event)
 Handle a touch down event within the view. More...
 
virtual void touchMoveEvent (const LTouchMoveEvent &event)
 Handle a touch move event within the view. More...
 
virtual void touchUpEvent (const LTouchUpEvent &event)
 Handle a touch up event within the view. More...
 
virtual void touchFrameEvent (const LTouchFrameEvent &event)
 Handle a touch frame event within the view. More...
 
virtual void touchCancelEvent (const LTouchCancelEvent &event)
 Handle a touch cancel event within the view. More...
 
- Public Member Functions inherited from LObject
 LObject (const LObject &) noexcept
 Copy constructor. More...
 
LObjectoperator= (const LObject &) noexcept
 Assignment operator (each object has its own individual LWeak reference count). More...
 
void setUserData (UIntPtr data) const noexcept
 Store an unsigned integer value/pointer. More...
 
UIntPtr userData () const noexcept
 Retrieves the stored unsigned integer value/pointer. More...
 

Additional Inherited Members

- Protected Member Functions inherited from LObject
 LObject () noexcept=default
 Constructor of the LObject class. More...
 
virtual ~LObject () noexcept
 Destructor of the LObject class. More...
 
void notifyDestruction () noexcept
 Notifies the object destruction. More...
 

Detailed Description

Base class for LScene views.

The LView class provides a base interface for creating views that can be shown in an LScene.
This class should be used for creating custom views that are different from those shipped with Louvre.
Louvre provides a pre-made set of views for most common purposes:

Stacking

Each view can have a parent and multiple children. This hierarchy and the order given by their children views list determine the stacking order in which they are rendered.
Children views are always stacked on top of its parent, and the last view in a children list is the one stacked on top the rest.

Creating custom views

To create a custom view, you must implement several virtual methods. In summary, for an LScene or LSceneView to be able to render an LView, it must provide the following information:

Position

The position of the view in surface coordinates must be returned by the nativePos() virtual method.
This method is used by the pos() method, which returns the position equal to nativePos(), or transformed if parent offset or parent scaling is enabled.

Size

The size of the view in surface coordinates should be implemented in the nativeSize() virtual method. This size is then returned by the size() method if no transformation is applied, or may differ if scaling or parent scaling is enabled.

Mapping

To tell a scene if the view is visible, the nativeMapped() bool method must be implemented. This is then returned by the mapped() method, which may differ from nativeMapped() if the visible() property is different, or if the view has no parent, or if its parent is mapped. In summary, a view can only be mapped if nativeMapped() is true, the visible() property is true, it has a parent, and the parent is also mapped.

Renderable

If the view has content that can be rendered, for example, a texture, then the isRenderable() method must return true. On the other hand, if the view is simply a container for other views and is not renderable on its own, then it should return false.

Intersected Outputs

The outputs() virtual method must return a vector with the outputs where the view is currently visible. When the view changes, repaint() is called, and all those intersected outputs are scheduled for repainting. The scene informs which outputs a view is currently on based on its rect through the enteredOutput() and leftOutput() virtual methods. So, those methods must be used to update the intersected outputs vector.

Painting

If the view is renderable, the paintEvent() method must be implemented. This method is called by the scene to request the view to render itself into the current framebuffer. It provides an LPainter, the region of the view to be rendered in global compositor coordinates, and a boolean variable indicating whether blending is enabled. The paintEvent() method is called twice per frame: once for drawing only the opaque regions of the view (blending disabled), and a second pass for the translucent regions (blending enabled).

Note
If you're using custom tools for rendering that can't handle opaque and translucent regions separately, set the view's translucent region to nullptr (see the "Opaque and Translucent Regions" section). This way, only a single paintEvent() with blending enabled will be triggered.

Damage

To inform the scene about which rects within the view must be re-rendered (due to changes), the damage() virtual method must return an LRegion containing the damaged rects. If nullptr is returned, the entire view is considered damaged.
The scene automatically damages the entire view if its position, size, or stacking order changes from one frame to another, so it's not necessary to add damage in those cases. Usually, the damage should be cleared once the view has been rendered. To determine if a view was rendered on a specific output, the requestNextFrame() method is invoked by the scene. So within that method, the damage should be cleared.

Opaque and Translucent region

To prevent the scene view from rendering views occluded by opaque regions, the translucentRegion() and opaqueRegion() must be implemented. They must return an LRegion with the translucent and opaque regions, respectively, in surface coordinates.
If translucentRegion() returns nullptr, the entire view is considered translucent. On the other hand, if opaqueRegion is nullptr, the opaque region is considered the inverse of the translucentRegion(). So normally, it's only needed to specify the translucent region. The opaque region must be specified if it has been calculated before so that the scene can use that information and prevent re-calculating the inverse translucent region.

Input region

To define which parts of the view can receive pointer or touch events, the inputRegion() must be implemented.
If nullptr is returned, the entire view is considered capable of receiving events.

Input events

Scenes can trigger specific input events on views through the pointerEnterEvent(), pointerMoveEvent(), keyEvent(), and other related methods.
Implement these virtual methods to listen and respond to those events if needed.


Class Documentation

◆ Louvre::LView::PaintEventParams

struct Louvre::LView::PaintEventParams

Parameters used within a paintEvent().

Class Members
LPainter * painter LPainter object to perform the painting.
LRegion * region Region to draw in global compositor coordinates.
bool blending Indicates if the region to render is opaque (false) or translucent (true)

Member Enumeration Documentation

◆ Type

enum Type : UInt8

Types of views included with Louvre.

Enumerator
UndefinedType 

Undefined type.

LayerType 

LLayerView.

SurfaceType 

LSurfaceView.

TextureType 

LTextureView.

SolidColorType 

LSolidColorView.

SceneType 

LSceneView.

Constructor & Destructor Documentation

◆ LView()

LView ( UInt32  type,
bool  renderable,
LView parent 
)
noexcept

Construct an LView object.

Parameters
typeType ID of the view, such as those listed in LView::Type.
parentParent view.

◆ ~LView()

~LView ( )
noexcept

Destructor for the LView class.

Member Function Documentation

◆ enablePointerEvents()

void enablePointerEvents ( bool  enabled)
noexcept

Toggles pointer events.

Only views with this property enabled can appear on the LScene::pointerFocus() list after an LScene::handlePointerMoveEvent().

Disabled by default in all view types except for LSurfaceView.

Parameters
enabledIf true, the view will receive pointer events.

◆ pointerEventsEnabled()

bool pointerEventsEnabled ( ) const
inlinenoexcept

Checks if pointer events are enabled.

Returns
true if the view receives pointer and touch events, false otherwise.

◆ pointerIsOver()

bool pointerIsOver ( ) const
inlinenoexcept

Checks if the view has pointer focus.

Even if the scene pointer is over the input region it may return false if another view with block pointer enabled is in front.

Note
Requires pointerEventsEnabled() to be true.
Returns
true if the pointer/cursor is inside the input region; otherwise, false.

◆ enableBlockPointer()

void enableBlockPointer ( bool  enabled)
inlinenoexcept

Toggles blocking pointer events to views behind the view's input region.

Note
Requires pointerEventsEnabled() to be true.

Enabled by default.

Parameters
enabledtrue to enable blocking; false to disable.

◆ blockPointerEnabled()

bool blockPointerEnabled ( ) const
inlinenoexcept

Checks if blocking of pointer events is enabled.

Returns
true if blocking is enabled; otherwise, false.

◆ enableKeyboardEvents()

void enableKeyboardEvents ( bool  enabled)
noexcept

Toggles keyboard events.

When enabled, the view will receive keyboard events and will be added to its parent LScene::keyboardFocus() vector.
Unlike pointer or touch events, keyboard events for views do not have focus semantics, this means that when enabled, the view will always receive all keyboard events emitted by its parent scene.
Disabled by default in all view types.

Parameters
enabledtrue to enable keyboard events, false to disable.

◆ keyboardEventsEnabled()

bool keyboardEventsEnabled ( ) const
inlinenoexcept

Checks if keyboard events are enabled.

Returns
true if keyboard events are enabled, false otherwise. Keyboard events are disabled by default.

◆ enableTouchEvents()

void enableTouchEvents ( bool  enabled)
noexcept

Toggles touch events.

A view can be touched by multiple touch points simultaneously, see LScene::touchPoints() and LSceneTouchPoint::views()

Note
The inputRegion() property affects which part of the view can receive events.

Disabled by default in all view types except for LSurfaceView.

Parameters
enabledSet to true to enable touch events, false to disable them.

◆ touchEventsEnabled()

bool touchEventsEnabled ( ) const
inlinenoexcept

Checks if touch events are enabled.

Returns
true if touch events are enabled, false otherwise.

◆ enableBlockTouch()

void enableBlockTouch ( bool  enabled)
inlinenoexcept

Toggles blocking touch events to views behind the view's input region.

Note
Requires touchEventsEnabled() to be true.

Enabled by default.

Parameters
enabledtrue to enable blocking; false to disable.

◆ blockTouchEnabled()

bool blockTouchEnabled ( ) const
inlinenoexcept

Checks if blocking of touch events to views behind the view's input region is enabled.

Returns
true if blocking is enabled; otherwise, false.

◆ damageAll()

void damageAll ( )
inlinenoexcept

Forces a complete repaint of the view in the next rendering frame.

◆ scene()

LScene* scene ( ) const
inlinenoexcept

Gets the scene in which this view is currently embedded.

Returns
A pointer to the scene that contains this view, or nullptr if the view is not part of any scene.

◆ isLScene()

bool isLScene ( ) const
inlinenoexcept

Checks if the view is an LScene::mainView().

◆ parentSceneView()

LSceneView* parentSceneView ( ) const
inlinenoexcept

Gets the closest parent LSceneView.

Returns
A pointer to the closest LSceneView that contains this view, or nullptr if the view is not part of any LSceneView.

◆ type()

UInt32 type ( ) const
inlinenoexcept

Gets the identifier for the type of view.

See also
LView::Type.
Returns
The identifier representing the type of view.

◆ isRenderable()

bool isRenderable ( ) const
inlinenoexcept

Checks if the view is renderable.

This property indicates whether the view is capable of rendering content (check paintEvent()).
For example, all view types included in Louvre are renderable, except for LLayerView, which serves as a container for other views but does not produce any output by itself.

Returns
true if the view is renderable; otherwise, false.

◆ repaint()

void repaint ( ) const
noexcept

Schedules a repaint for all outputs where this view is currently visible.

This method triggers a repaint for all outputs where this view is currently visible.
Outputs are those returned by the LView::outputs() method.

◆ parent()

LView* parent ( ) const
inlinenoexcept

Gets the parent of the view.

Returns
A pointer to the parent view, or nullptr if the view has no parent.

◆ setParent()

void setParent ( LView view)
noexcept

Sets the new parent for the view and insert it at the end of its children list.

This method sets the new parent for the view and inserts it at the end of its parent's children list. If 'view' is set to nullptr, the parent is unset, and the view is unmapped.

Parameters
viewThe new parent view to be set.

◆ insertAfter()

void insertAfter ( LView prev)
noexcept

Inserts the view after the specified 'prev' view.

Note
This changes the view's parent if prev has another parent view.
Parameters
prevThe view after which this view will be inserted. If set to nullptr, the view will be inserted at the beginning of its current parent's children list.

◆ children()

const std::list<LView*>& children ( ) const
inlinenoexcept

Children views.

Returns
A reference to the list of child views.

◆ enableParentOffset()

void enableParentOffset ( bool  enabled)
inlinenoexcept

Toggles the parent position offset.

If enabled, the position returned by pos() will include the parent's position (parent()->pos()).

Enabled by default.

Parameters
enabledIf true, the parent's position will be applied to the view's position.

◆ parentOffsetEnabled()

bool parentOffsetEnabled ( ) const
inlinenoexcept

Checks if pos() includes the parent's position.

Returns
true if the parent's offset is applied to the view position, false otherwise.

◆ pos()

const LPoint& pos ( ) const
inlinenoexcept

Gets the current position of the view with applied transformations.

This method returns the current position of the view with any applied transformations.

See also
nativePos().
Returns
The position of the view.

◆ size()

const LSize& size ( ) const
inlinenoexcept

Gets the current size of the view with applied transformations.

This method returns the current size of the view with any applied transformations.

See also
nativeSize().
Returns
The size of the view in surface units.

◆ enableClipping()

void enableClipping ( bool  enabled)
inlinenoexcept

Toggles the use of the clippingRect() property.

If enabled, the view will be clipped to the clippingRect() property.

Disabled by default.

◆ clippingEnabled()

bool clippingEnabled ( ) const
inlinenoexcept

Checks if the view is currently being clipped to the clippingRect() property.

This method returns true if the view is currently being clipped to the clippingRect() property.

Returns
true if the view is being clipped to clippingRect(), false otherwise.

◆ setClippingRect()

void setClippingRect ( const LRect rect)
inlinenoexcept

Sets a custom clipping rect.

See also
The clippingRect() property.
Note
Requires clippingEnabled() to be true.
The rect is not local to the view's position, if you need to clip the view without having to update the rect position each time the view moves, use parent clipping instead.
Parameters
rectThe clipping rect in compositor-global coordinates.

◆ clippingRect()

const LRect& clippingRect ( ) const
inlinenoexcept

Gets the clipping rect set with setClippingRect().

◆ enableParentClipping()

void enableParentClipping ( bool  enabled)
inlinenoexcept

Toggles parent clipping.

If enabled, the view will be clipped to the current parent view rect.

Disabled by default.

Parameters
enabledIf true, the view will be clipped to the current parent view rect.

◆ parentClippingEnabled()

bool parentClippingEnabled ( ) const
inlinenoexcept

Checks if the view is clipped to the parent view rect.

See also
enableParentClipping().
Returns
true if the view is clipped to the current parent view rect, false otherwise.

◆ enableScaling()

void enableScaling ( bool  enabled)
inlinenoexcept

Toggles the use of the scalingVector().

If enabled, the view's size will be multiplied by the scalingVector().

Disabled by default.

Parameters
enabledIf true, the view's size will be scaled.

◆ scalingEnabled()

bool scalingEnabled ( ) const
inlinenoexcept

Checks if the scalingVector() is enabled.

◆ setScalingVector()

void setScalingVector ( const LSizeF scalingVector)
inlinenoexcept

Sets the scalingVector() property.

If scalingEnabled() is true, the view's size will be scaled using the provided scaling vector (nativeSize() * scalingVector()).

The default value is (1.f, 1.f).

Warning
Scaling should be used with moderation, preferably during animations, as damage tracking is disabled due to precision loss caused by scaling. This means the entire view is repainted if changes occur, which can be inefficient.

◆ scalingVector()

const LSizeF& scalingVector ( bool  forceIgnoreParent = false) const
inlinenoexcept

Gets the scaling vector.

See also
setScalingVector().
Parameters
forceIgnoreParentIf set to false, the vector is multiplied by the parent scaling vector.
Returns
The scaling vector for the view's size.

◆ enableParentScaling()

void enableParentScaling ( bool  enabled)
inlinenoexcept

Toggles the scaling of size and position by the parent's scaling vector.

If enabled, the view's size and position will be scaled by the parent's scalingVector().

Disabled by default.

Parameters
enabledIf true, the view's size and position will be scaled by the parent's scaling vector.

◆ parentScalingEnabled()

bool parentScalingEnabled ( ) const
inlinenoexcept

Checks if the size and position are scaled by the parent's scalingVector().

Disabled by default.

◆ setVisible()

void setVisible ( bool  visible)
inlinenoexcept

Toggles the view visibility.

Note
Enabling visibility does not guarantee that the view will be rendered, see mapped().

Enabled by default.

◆ visible()

bool visible ( ) const
inlinenoexcept

Checks if the view is marked as visible.

This method indicates whether the view is marked as visible. However, it does not directly indicate if the view will be rendered. To check if the view will be rendered, use the mapped() property instead.

Returns
true if the view is marked as visible, false otherwise.

◆ mapped()

bool mapped ( ) const
inlinenoexcept

Checks if the view should be rendered, taking into consideration several conditions.

This method indicates whether the view should be rendered, considering the nativeMapped() && visible() && parent() && parent()->mapped() condition.

Returns
true if the view should be rendered, false otherwise.

◆ setOpacity()

void setOpacity ( Float32  opacity)
inlinenoexcept

Set the view opacity.

This method sets the view's opacity.

The default value is 1.f.

Warning
Opacity values != 1.f should be used with moderation, for example, only during animations, as the opaqueRegion() is not ignored. This means that content behind the view is always repainted when the view changes.
Parameters
opacityThe opacity value in the range [0.f, 1.f].

◆ opacity()

Float32 opacity ( bool  forceIgnoreParent = false) const
inlinenoexcept

Gets the view opacity.

Parameters
forceIgnoreParentIf set to false, the result is multiplied by the parent's opacity.
Returns
The view's opacity value in the range [0.0, 1.0].

◆ enableParentOpacity()

void enableParentOpacity ( bool  enabled)
inlinenoexcept

Toggles the use of the parent's opacity.

If enabled, the view's opacity will be multiplied by its parent's opacity.

Enabled by default.

◆ parentOpacityEnabled()

bool parentOpacityEnabled ( ) const
inlinenoexcept

Checks if the view's opacity is multiplied by its parent's opacity.

◆ enableForceRequestNextFrame()

void enableForceRequestNextFrame ( bool  enabled)
inlinenoexcept

Toggles forcing triggering the requestNextFrame() event.

When enabled, requestNextFrame() will be called even if the view is occluded or not mapped.

Disabled by default.

◆ forceRequestNextFrameEnabled()

bool forceRequestNextFrameEnabled ( ) const
inlinenoexcept

Checks if forcing requestNextFrame() is enabled.

◆ setBlendFunc()

void setBlendFunc ( const LBlendFunc blendFunc)
inlinenoexcept

Sets a custom alpha/color blending function for the view.

Sets the OpenGL blend function for the view. Refer to the documentation of glBlendFuncSeparate() for more information.

Note
Requires autoBlendFuncEnabled() to be disabled.

◆ blendFunc()

const LBlendFunc& blendFunc ( ) const
inlinenoexcept

Gets the blending function set with setBlendFunc().

See also
enableAutoBlendFunc()

◆ enableAutoBlendFunc()

void enableAutoBlendFunc ( bool  enabled)
inlinenoexcept

Toggles the automatic blend function adjustment.

When enabled, the blend function dynamically adjusts based on whether the rendered content is premultiplied alpha or not.

Note
When enabled, the blend function set with setBlendFunc() is ignored.

Enabled by default.

◆ autoBlendFuncEnabled()

bool autoBlendFuncEnabled ( ) const
inlinenoexcept

Checks whether the automatic blend function adjustment is enabled.

◆ setColorFactor()

void setColorFactor ( const LRGBAF colorFactor)
inlinenoexcept

Set the color factor.

Multiplies the view's RGBA color components by the given values.
Set to (1.0, 1.0, 1.0, 1.0) by default, which has no effect on the colors.

◆ colorFactor()

const LRGBAF& colorFactor ( ) const
inlinenoexcept

Gets the color factor.

See setColorFactor().

◆ boundingBox()

LBox boundingBox ( ) const
inlinenoexcept

Gets the bounding box of the view and all its mapped children.

This method returns a box containing the view and all its mapped children, even if the children are outside or clipped by the view's rect.

Returns
The bounding box of the view and its mapped children.

◆ nativeMapped()

virtual bool nativeMapped ( ) const
pure virtualnoexcept

Tells whether the view should be rendered.

Returns
true if the view should be rendered without considering visible(), otherwise false.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ nativePos()

virtual const LPoint& nativePos ( ) const
pure virtualnoexcept

Gets the position of the view without any transformations applied.

Must return the position of the view in compositor-global coordinates.

Returns
The position of the view as an LPoint object.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ nativeSize()

virtual const LSize& nativeSize ( ) const
pure virtualnoexcept

Gets the size of the view without any transformations applied.

Must return the size of the view in surface coordinates.

Returns
The size of the view as an LSize object.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ bufferScale()

virtual Float32 bufferScale ( ) const
pure virtualnoexcept

Gets the scale of the view buffer content.

This property is primarily used by views that contain a buffer like for example the LSceneView, LSurfaceView and LTextureView types.

Returns
The buffer scale as an Int32 value.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ enteredOutput()

virtual void enteredOutput ( LOutput output)
pure virtualnoexcept

Notifies that portion of the view is visible on the given output.

This method is invoked by a LScene when the view's rect intersects an output.

Parameters
outputThe LOutput where the view is visible.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ leftOutput()

virtual void leftOutput ( LOutput output)
pure virtualnoexcept

Notifies that the view is no longer visible on the given output.

This method is invoked by a LScene when the view's rect no longer intersects an output.

Parameters
outputThe LOutput from which the view is no longer visible.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ outputs()

virtual const std::vector<LOutput*>& outputs ( ) const
pure virtualnoexcept

Gets a vector of output pointers on which the view is currently visible.

Must return a vector of output pointers where the view is currently visible.
Use the enteredOutput() and leftOutput() methods to update the vector.

Returns
A reference to a vector of LOutput pointers representing the outputs where the view is visible.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ requestNextFrame()

virtual void requestNextFrame ( LOutput output)
pure virtualnoexcept

Notifies that the view has been rendered on the given output.

This method is called by the closest parent scene view and should be used to clear the previous view damage or update its content.
If forceRequestNextFrameEnabled() is true, this method is always called.

Parameters
outputThe LOutput on which the view is rendered.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ damage()

virtual const LRegion* damage ( ) const
pure virtualnoexcept

Gets the region within the view rect that needs to be repainted.

The region rects are specified in surface coordinates within the view, without any scaling, clipping, or offset transformations applied.

It should be cleared after requestNextFrame() is called.

If nullptr is returned, the entire view rect will be considered damaged.

If the view has no damage, simply pass an empty LRegion (not nullptr).

Returns
A pointer to the LRegion specifying the damaged area within the view, or nullptr if the entire view rect is damaged.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ translucentRegion()

virtual const LRegion* translucentRegion ( ) const
pure virtualnoexcept

Gets the current translucent region.

The region must be specified in surface-local coordinates, without any scaling, clipping, or offset transformations applied.

If nullptr is returned, the entire view rect will be considered translucent.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ opaqueRegion()

virtual const LRegion* opaqueRegion ( ) const
pure virtualnoexcept

Gets the current opaque region.

The region must be specified in surface-local coordinates without any scaling, clipping, or offset transformations applied.

If nullptr is returned, the inverse of the translucent region will be considered opaque.

Note
You could only specify the translucent region.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ inputRegion()

virtual const LRegion* inputRegion ( ) const
pure virtualnoexcept

Gets the current input region.

Region within the view rect that can receive pointer and touch events.

The region must be specified in surface-local coordinates without any scaling, clipping, or offset transformations applied.

If nullptr is returned, the entire view will receive input.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ paintEvent()

virtual void paintEvent ( const PaintEventParams params)
pure virtualnoexcept

Requests to paint a region of the view to the current framebuffer.

This method is used by the closest parent LSceneView to request the view to paint a specified region on the current framebuffer. Painting can be performed using the provided LPainter object.

Note
Using LPainter is optional.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ pointerEnterEvent()

virtual void pointerEnterEvent ( const LPointerEnterEvent event)
inlinevirtual

Handles a pointer enter event within the view.

This event is only triggered if pointerEventsEnabled() is set to true.

◆ pointerMoveEvent()

virtual void pointerMoveEvent ( const LPointerMoveEvent event)
inlinevirtual

Handle a pointer move event within the view.

This event is only triggered if pointerEnterEvent() was called before, and therefore when hasPointerFocus() returns true.

◆ pointerLeaveEvent()

virtual void pointerLeaveEvent ( const LPointerLeaveEvent event)
inlinevirtual

Handle a pointer leave event within the view.

This event is only triggered if pointerEnterEvent() was called before, and therefore when hasPointerFocus() returns true.

◆ pointerButtonEvent()

virtual void pointerButtonEvent ( const LPointerButtonEvent event)
inlinevirtual

Handle a pointer button event within the view.

This event is only triggered if pointerEnterEvent() was called before, and therefore when hasPointerFocus() returns true.

◆ pointerScrollEvent()

virtual void pointerScrollEvent ( const LPointerScrollEvent event)
inlinevirtual

Handle a pointer scroll event within the view.

This event is only triggered if pointerEnterEvent() was called before, and therefore when hasPointerFocus() returns true.

◆ pointerSwipeBeginEvent()

virtual void pointerSwipeBeginEvent ( const LPointerSwipeBeginEvent event)
inlinevirtual

Handle a pointer swipe begin event within the view.

This event is only triggered if pointerEnterEvent() was called before, and therefore when hasPointerFocus() returns true.

◆ pointerSwipeUpdateEvent()

virtual void pointerSwipeUpdateEvent ( const LPointerSwipeUpdateEvent event)
inlinevirtual

Handle a pointer swipe update event within the view.

This event is only triggered if pointerSwipeBeginEvent() was called before.

◆ pointerSwipeEndEvent()

virtual void pointerSwipeEndEvent ( const LPointerSwipeEndEvent event)
inlinevirtual

Handle a pointer swipe end event within the view.

This event is only triggered if pointerSwipeBeginEvent() was called before.

◆ pointerPinchBeginEvent()

virtual void pointerPinchBeginEvent ( const LPointerPinchBeginEvent event)
inlinevirtual

Handle a pointer pinch begin event within the view.

This event is only triggered if pointerEnterEvent() was called before, and therefore when hasPointerFocus() returns true.

◆ pointerPinchUpdateEvent()

virtual void pointerPinchUpdateEvent ( const LPointerPinchUpdateEvent event)
inlinevirtual

Handle a pointer pinch update event within the view.

This event is only triggered if pointerPinchBeginEvent() was called before.

◆ pointerPinchEndEvent()

virtual void pointerPinchEndEvent ( const LPointerPinchEndEvent event)
inlinevirtual

Handle a pointer pinch end event within the view.

This event is only triggered if pointerPinchBeginEvent() was called before.

◆ pointerHoldBeginEvent()

virtual void pointerHoldBeginEvent ( const LPointerHoldBeginEvent event)
inlinevirtual

Handle a pointer hold begin event within the view.

This event is only triggered if pointerEnterEvent() was called before, and therefore when hasPointerFocus() returns true.

◆ pointerHoldEndEvent()

virtual void pointerHoldEndEvent ( const LPointerHoldEndEvent event)
inlinevirtual

Handle a pointer hold end event within the view.

This event is only triggered if pointerHoldBeginEvent() was called before.

◆ keyEvent()

virtual void keyEvent ( const LKeyboardKeyEvent event)
inlinevirtual

Handle the key event within the view.

Keyboard events are triggered only if keyboardEventsEnabled() is set to true.

◆ touchDownEvent()

virtual void touchDownEvent ( const LTouchDownEvent event)
inlinevirtual

Handle a touch down event within the view.

Touch events are triggered only if touchEventsEnabled() is set to true.

◆ touchMoveEvent()

virtual void touchMoveEvent ( const LTouchMoveEvent event)
inlinevirtual

Handle a touch move event within the view.

This event is only triggered if a touchDownEvent() was emitted before.

◆ touchUpEvent()

virtual void touchUpEvent ( const LTouchUpEvent event)
inlinevirtual

Handle a touch up event within the view.

This event is only triggered if a touchDownEvent() was emitted before.

◆ touchFrameEvent()

virtual void touchFrameEvent ( const LTouchFrameEvent event)
inlinevirtual

Handle a touch frame event within the view.

This event is only triggered if a touchDownEvent() was emitted before.

◆ touchCancelEvent()

virtual void touchCancelEvent ( const LTouchCancelEvent event)
inlinevirtual

Handle a touch cancel event within the view.

This event is only triggered if a touchDownEvent() was emitted before.