Louvre
v2.12.0-1
C++ library for Wayland compositors
|
View for displaying textures. More...
Public Member Functions | |
LTextureView (LTexture *texture=nullptr, LView *parent=nullptr) noexcept | |
Construct an LTextureView with an optional LTexture and parent LView. More... | |
~LTextureView () noexcept | |
Destructor for the LTextureView. More... | |
void | setPos (Int32 x, Int32 y) noexcept |
Set the position of the LTextureView. More... | |
void | setPos (const LPoint &pos) noexcept |
Set the position of the LTextureView using an LPoint object. More... | |
virtual void | setInputRegion (const LRegion *region) |
Set the input region of the LTextureView. More... | |
virtual void | setTranslucentRegion (const LRegion *region) |
Set the translucent region of the LTextureView. More... | |
void | setBufferScale (Float32 scale) noexcept |
Set the buffer scale of the LTextureView. More... | |
void | setTexture (LTexture *texture) noexcept |
Set the LTexture for the LTextureView. More... | |
LTexture * | texture () const noexcept |
Gets the current LTexture used by the LTextureView. More... | |
void | enableDstSize (bool enabled) noexcept |
Enable or disable the custom destination size for the LTextureView. More... | |
bool | dstSizeEnabled () const noexcept |
Check if the custom destination size is enabled for the LTextureView. More... | |
void | setDstSize (Int32 w, Int32 h) noexcept |
Set the custom destination size of the LTextureView. More... | |
void | setDstSize (const LSize &dstSize) noexcept |
Set the custom destination size of the LTextureView using an LSize object. More... | |
void | enableCustomColor (bool enabled) noexcept |
Enable or disable custom coloring for texture rendering. More... | |
bool | customColorEnabled () const noexcept |
Check if custom coloring for texture rendering is enabled. More... | |
void | setCustomColor (const LRGBF &color) noexcept |
Set a custom color for texture rendering using an LRGBF object. More... | |
const LRGBF & | customColor () const noexcept |
Gets the current custom color used for texture rendering. More... | |
void | enableSrcRect (bool enabled) noexcept |
Enables or disables the use of a custom source rect. More... | |
bool | srcRectEnabled () const noexcept |
Checks if the use of the source rect (srcRect()) is enabled. More... | |
void | setSrcRect (const LRectF &srcRect) noexcept |
Sets the source rect of the texture to use. More... | |
const LRectF & | srcRect () const noexcept |
Gets the source rect set with setSrcRect(). More... | |
void | setTransform (LTransform transform) noexcept |
Sets the transform of the texture. More... | |
LTransform | transform () const noexcept |
Gets the transform set with setTransform(). More... | |
virtual bool | nativeMapped () const noexcept override |
Tells whether the view should be rendered. More... | |
virtual const LPoint & | nativePos () const noexcept override |
Gets the position of the view without any transformations applied. More... | |
virtual const LSize & | nativeSize () const noexcept override |
Gets the size of the view without any transformations applied. More... | |
virtual Float32 | bufferScale () const noexcept override |
Gets the scale of the view buffer content. More... | |
virtual void | enteredOutput (LOutput *output) noexcept override |
Notifies that portion of the view is visible on the given output. More... | |
virtual void | leftOutput (LOutput *output) noexcept override |
Notifies that the view is no longer visible on the given output. More... | |
virtual const std::vector< LOutput * > & | outputs () const noexcept override |
Gets a vector of output pointers on which the view is currently visible. More... | |
virtual void | requestNextFrame (LOutput *output) noexcept override |
Notifies that the view has been rendered on the given output. More... | |
virtual const LRegion * | damage () const noexcept override |
Gets the region within the view rect that needs to be repainted. More... | |
virtual const LRegion * | translucentRegion () const noexcept override |
Gets the current translucent region. More... | |
virtual const LRegion * | opaqueRegion () const noexcept override |
Gets the current opaque region. More... | |
virtual const LRegion * | inputRegion () const noexcept override |
Gets the current input region. More... | |
virtual void | paintEvent (const PaintEventParams ¶ms) noexcept override |
Requests to paint a region of the view to the current framebuffer. More... | |
Public Member Functions inherited from LView | |
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... | |
LScene * | scene () 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... | |
LSceneView * | parentSceneView () 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... | |
LView * | parent () 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 LPoint & | pos () const noexcept |
Gets the current position of the view with applied transformations. More... | |
const LSize & | size () 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 LRect & | clippingRect () 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 LSizeF & | scalingVector (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 LBlendFunc & | blendFunc () 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 LRGBAF & | colorFactor () 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 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... | |
LObject & | operator= (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 | |
Public Types inherited from LView | |
enum | Type : UInt8 |
Types of views included with Louvre. More... | |
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... | |
View for displaying textures.
The LTextureView class enables you to use an LTexture as a view within a scene.
You can set the view's texture using setTexture(), and passing nullptr
unsets the texture, effectively unmapping the view.
Multiple views can share the same LTexture, and if the texture is destroyed, their texture() property is automatically set to nullptr
.
Texture views can also have a custom destination size, which may differ from their buffer size. In such cases, regions for damage, input, translucent, and opaque must be defined based on the destination size.
To enable a custom destination size, use the enableDstSize() and setDstSize() methods.
When destination size is disabled, the view size is by default equal to the texture size divided by its buffer scale if no other transformations are applied.
As of Louvre version 1.2.0, you can define a source rect with applied transformations, adhering to the behavior outlined in the Viewporter protocol.
For additional methods and properties available, please refer to the documentation of the LView
class.
|
inlinenoexcept |
Construct an LTextureView with an optional LTexture and parent LView.
texture | The LTexture to be used as the view's texture. Default is nullptr. |
parent | The parent LView of the LTextureView. Default is nullptr. |
|
inlinenoexcept |
Destructor for the LTextureView.
Set the position of the LTextureView.
x | The x-coordinate of the position. |
y | The y-coordinate of the position. |
|
inlinenoexcept |
Set the position of the LTextureView using an LPoint object.
pos | The position as an LPoint object. |
|
virtual |
Set the input region of the LTextureView.
region | The input region as an LRegion object. |
|
virtual |
Set the translucent region of the LTextureView.
Passing nullptr
as the region means that the entire view is considered translucent, which is the default value. Passing an empty LRegion (not nullptr
), on the other hand, means the entire view is opaque.
region | The translucent region as an LRegion object. |
|
inlinenoexcept |
Set the buffer scale of the LTextureView.
scale | The buffer scale factor. |
|
noexcept |
Set the LTexture for the LTextureView.
nullptr
.texture | The LTexture to be used as the view's texture. |
|
inlinenoexcept |
Gets the current LTexture used by the LTextureView.
|
inlinenoexcept |
Enable or disable the custom destination size for the LTextureView.
enabled | True to enable custom destination size, false to disable. |
|
inlinenoexcept |
Check if the custom destination size is enabled for the LTextureView.
Set the custom destination size of the LTextureView.
w | The width of the custom destination size. |
h | The height of the custom destination size. |
|
inlinenoexcept |
Set the custom destination size of the LTextureView using an LSize object.
dstSize | The custom destination size as an LSize object. |
|
inlinenoexcept |
Enable or disable custom coloring for texture rendering.
This method enables or disables custom coloring for the texture rendering process. When custom coloring is enabled, the texture color is replaced by a custom color while preserving the texture's alpha channel.
enabled | A boolean value indicating whether custom coloring should be enabled (true) or disabled (false). |
|
inlinenoexcept |
Check if custom coloring for texture rendering is enabled.
This method returns a boolean value indicating whether custom coloring is currently enabled for the texture rendering process.
true
if custom coloring is enabled, false
otherwise.
|
inlinenoexcept |
|
inlinenoexcept |
Gets the current custom color used for texture rendering.
This method retrieves the current custom color that is being used for the texture rendering process. The custom color replaces the original texture color while keeping the texture's alpha channel intact.
|
inlinenoexcept |
Enables or disables the use of a custom source rect.
Enabling this feature allows you to specify a custom source rectangle using setSrcRect().
enabled | If true , the custom source rectangle is enabled; if false , the entire texture is used as the source. |
|
inlinenoexcept |
Checks if the use of the source rect (srcRect()) is enabled.
Disabled by default.
true
if enabled, false
otherwise.
|
inlinenoexcept |
Sets the source rect of the texture to use.
The source rect must be specified in surface coordinates, taking into account the space generated after the inverse transform() (from transform() to LTransform::Normal) is applied.
true
.srcRect | The source rect in surface coordinates. |
|
inlinenoexcept |
Gets the source rect set with setSrcRect().
false
the rect covers the entire texture.
|
inlinenoexcept |
Sets the transform of the texture.
Use this method to tell the scene the transformation that the texture's content ALREADY HAS and not the transformation you want to apply.
For example, pass LTransform::Rotated90 if the texture's content is rotated 90 degrees counter-clockwise, and the scene (if the current LOutput has a normal transform) will apply a 90-degree clockwise rotation to display it normally.
Changing the transform affects how the source rectangle is defined and may also swap the original width and height of the view when using transforms with 90 or 270 degrees rotation.
transform | The transform to be applied for proper display. |
|
inlinenoexcept |
Gets the transform set with setTransform().
The default value is LTransform::Normal.
|
overridevirtualnoexcept |
|
overridevirtualnoexcept |
Gets the position of the view without any transformations applied.
Must return the position of the view in compositor-global coordinates.
Implements LView.
|
overridevirtualnoexcept |
Gets the size of the view without any transformations applied.
Must return the size of the view in surface coordinates.
Implements LView.
|
overridevirtualnoexcept |
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.
Implements LView.
|
overridevirtualnoexcept |
|
overridevirtualnoexcept |
|
overridevirtualnoexcept |
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.
Implements LView.
|
overridevirtualnoexcept |
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.
output | The LOutput on which the view is rendered. |
Implements LView.
|
overridevirtualnoexcept |
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
).
nullptr
if the entire view rect is damaged. Implements LView.
|
overridevirtualnoexcept |
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.
Implements LView.
|
overridevirtualnoexcept |
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.
Implements LView.
|
overridevirtualnoexcept |
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.
Implements LView.
|
overridevirtualnoexcept |
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.
Implements LView.