2025-09-23 21:57:08 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
#include "imaging/IPixelariumImage.hpp"
|
2025-09-26 21:09:51 +02:00
|
|
|
#include "imgui.h"
|
2025-09-23 21:57:08 +02:00
|
|
|
|
2026-01-23 23:00:35 +00:00
|
|
|
namespace pixelarium::application
|
2025-09-23 21:57:08 +02:00
|
|
|
{
|
2025-09-26 21:09:51 +02:00
|
|
|
/// @brief An interface defining the contract on views to dedicated implementations of IPixelariumImage
|
2025-09-23 21:57:08 +02:00
|
|
|
class IPixelariumImageView
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
virtual ~IPixelariumImageView() = default;
|
|
|
|
|
virtual void ShowImage() = 0;
|
|
|
|
|
|
|
|
|
|
// default implemented
|
|
|
|
|
public:
|
|
|
|
|
virtual const bool* GetStatus() const noexcept { return &this->open_p; }
|
|
|
|
|
virtual void ForceUpdate() noexcept { this->is_dirty_ = true; }
|
2026-01-23 23:00:35 +00:00
|
|
|
|
|
|
|
|
// this must be called immediately before a "ImGui::Begin" context
|
|
|
|
|
// as it will affect the next window and result in undeterministic effects
|
|
|
|
|
// when called "out of sync"
|
2025-09-26 21:09:51 +02:00
|
|
|
virtual void SetInitialSize(float width = 700.0f, float height = 700.0f)
|
|
|
|
|
{
|
|
|
|
|
ImGui::SetNextWindowSize({width, height});
|
|
|
|
|
}
|
2025-09-23 21:57:08 +02:00
|
|
|
|
|
|
|
|
protected:
|
2026-01-23 23:00:35 +00:00
|
|
|
virtual void ImageViewMenuBar();
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
std::shared_ptr<imaging::IPixelariumImageCvMat> img_{};
|
|
|
|
|
cv::Mat cached_image_{};
|
2025-09-23 21:57:08 +02:00
|
|
|
bool open_p{true};
|
|
|
|
|
bool is_dirty_{true};
|
2026-01-23 23:00:35 +00:00
|
|
|
bool first_render_{true};
|
2025-09-23 21:57:08 +02:00
|
|
|
};
|
2026-01-23 23:00:35 +00:00
|
|
|
} // namespace pixelarium::application
|