CaptureMoment 0.1.0
Free and open-source non-destructive photo editor
Loading...
Searching...
No Matches
sgs_image_item.h
Go to the documentation of this file.
1
8#pragma once
9
10#include <QQuickItem>
11#include <QMutex>
12#include <QSGNode>
13#include <QSGTexture>
14#include <QSizeF>
15#include <QPointF>
16
18
19namespace CaptureMoment::UI {
20
27namespace Rendering {
28
39class SGSImageItem : public QQuickItem, public BaseImageItem {
40 Q_OBJECT
41
42private:
49 bool m_image_dirty{false};
50
51public:
56 explicit SGSImageItem(QQuickItem* parent = nullptr);
57
61 ~SGSImageItem() override;
62
72 void setImage(std::unique_ptr<Core::Common::ImageRegion> image) override;
73
83 void updateTile(std::unique_ptr<Core::Common::ImageRegion> tile) override;
84
85signals:
90 void zoomChanged(float zoom);
91
96 void panChanged(const QPointF& pan);
97
102
103protected:
104 // QQuickItem overrides
116 QSGNode* updatePaintNode(QSGNode* node, UpdatePaintNodeData* data) override;
117
118 /*
119 * @brief Handlers for state changes (zoom, pan, image).
120 * These methods are called when the corresponding state changes (zoom, pan, image).
121 * They can be overridden to react to changes, but the base implementation does nothing.
122 */
123 void onZoomChanged(float new_zoom) override;
124
125 /*
126 * @brief Handler for pan changes.
127 * This method is called when the pan offset changes.
128 * The base implementation does nothing, but it can be overridden to react to pan changes.
129 */
130 void onPanChanged(const QPointF& new_pan) override;
131
132 /*
133 * @brief Handler for image changes.
134 * This method is called when the image data changes (setImage or updateTile).
135 * The base implementation does nothing, but it can be overridden to react to image changes.
136 */
137 void onImageChanged() override;
138};
139
140} // namespace Rendering
141
142} // namespace CaptureMoment::UI
Base class for Qt Quick image display items managing common state (zoom, pan, dimensions)
Base class for Qt Quick image display items managing common state dimensions.
QPointF pan() const override
Gets the current pan offset.
float zoom() const override
Gets the current zoom level.
QQuickItem that renders an image via QSGSimpleTextureNode.
void panChanged(const QPointF &pan)
Signal emitted when the pan offset changes.
void onZoomChanged(float new_zoom) override
void imageSizeChanged()
Signal emitted when the image dimensions change (width or height).
~SGSImageItem() override
Destroys the SGSImageItem and releases associated resources.
void updateTile(std::unique_ptr< Core::Common::ImageRegion > tile) override
Updates a specific tile of the displayed image.
void onPanChanged(const QPointF &new_pan) override
SGSImageItem(QQuickItem *parent=nullptr)
Constructs a new SGSImageItem.
void setImage(std::unique_ptr< Core::Common::ImageRegion > image) override
Sets the full image to be displayed.
void zoomChanged(float zoom)
Signal emitted when the zoom value changes.
QSGNode * updatePaintNode(QSGNode *node, UpdatePaintNodeData *data) override
Updates the scene graph node for this item.
CaptureMoment — footer