CaptureMoment 0.1.0
Free and open-source non-destructive photo editor
Loading...
Searching...
No Matches
base_image_item.cpp
Go to the documentation of this file.
1
9#include <spdlog/spdlog.h>
10
12
13// Constructor: Initializes the base item.
15{
16 spdlog::debug("[BaseImageItem::BaseImageItem]: Created");
17}
18
19void BaseImageItem::setZoom(float zoom)
20{
21 if (!qFuzzyCompare(m_zoom, zoom) && zoom > 0.0f) {
22 m_zoom = zoom;
24 }
25}
26
27void BaseImageItem::setPan(const QPointF& pan)
28{
29 if (m_pan != pan) {
30 m_pan = pan;
32 }
33}
34
36{
37 QMutexLocker lock(&m_image_mutex);
38 return m_full_image && m_full_image->isValid();
39}
40
41// Gets the width of the image.
43{
44 QMutexLocker lock(&m_image_mutex);
45 return m_full_image ? static_cast<int>(m_full_image->width()) : 0;
46}
47
48// Gets the height of the image.
50{
51 QMutexLocker lock(&m_image_mutex);
52 return m_full_image ? static_cast<int>(m_full_image->height()) : 0;
53}
54
55} // namespace CaptureMoment::UI::Rendering
Base class for Qt Quick image display items managing common state (zoom, pan, dimensions)
bool isImageValid() const override
Checks if the full image data is loaded and valid. This method provides thread-safe access to check t...
virtual void onZoomChanged(float new_zoom)
QPointF pan() const override
Gets the current pan offset.
std::unique_ptr< Core::Common::ImageRegion > m_full_image
Unique pointer to the full image data displayed by this item.
virtual void onPanChanged(const QPointF &new_pan)
QMutex m_image_mutex
Mutex protecting access to m_full_image and related state. Ensures thread-safe updates to the image d...
int imageHeight() const override
Gets the height of the image. This method provides thread-safe access to m_image_height.
float zoom() const override
Gets the current zoom level.
QPointF m_pan
Current pan offset applied to the image.
float m_zoom
Current zoom level applied to the image.
int imageWidth() const override
Gets the width of the image. This method provides thread-safe access to m_image_width.
void setZoom(float zoom) override
Sets the zoom level.
void setPan(const QPointF &pan) override
Sets the pan offset.
Namespace containing Qt-specific UI components for CaptureMoment.
CaptureMoment — footer