micro improvements
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
build/
|
||||
out/
|
||||
.vs/
|
||||
.cache/
|
||||
*~
|
||||
@@ -1,15 +1,18 @@
|
||||
#include "Image.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
#include <format>
|
||||
#include <memory>
|
||||
#include <opencv2/imgcodecs.hpp>
|
||||
#include <stdexcept>
|
||||
#include <string_view>
|
||||
|
||||
pixelarium::imaging::Image::Image(const std::string& uri)
|
||||
{
|
||||
if (!std::filesystem::exists(uri))
|
||||
{
|
||||
throw std::runtime_error("File not found");
|
||||
throw std::runtime_error(std::format("File not {} found", uri));
|
||||
}
|
||||
|
||||
this->_img = cv::imread(uri);
|
||||
this->_img = std::make_unique<cv::Mat>(cv::imread(uri));
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include <memory>
|
||||
#include <opencv2/core/mat.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace pixelarium::imaging
|
||||
@@ -17,16 +14,18 @@ class Image
|
||||
|
||||
// get back the defaults
|
||||
Image() = default;
|
||||
Image(const Image& other) = default;
|
||||
// we cannot copy an Image since this conflicts with the _img field
|
||||
Image(const Image& other) = delete;
|
||||
Image(Image&& other) noexcept = default;
|
||||
Image& operator=(const Image& other) = default;
|
||||
// requires a copy ctor which we don't have
|
||||
Image& operator=(const Image& other) = delete;
|
||||
Image& operator=(Image&& other) noexcept = default;
|
||||
~Image() = default;
|
||||
|
||||
const cv::Mat& GetImage() const { return this->_img; }
|
||||
const cv::Mat& GetImage() const { return *this->_img.get(); }
|
||||
|
||||
private:
|
||||
cv::Mat _img;
|
||||
std::unique_ptr<cv::Mat> _img;
|
||||
};
|
||||
|
||||
} // namespace pixelarium::imaging
|
||||
@@ -7,15 +7,17 @@
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
#include "imaging/Image.hpp"
|
||||
#include <opencv2/imgproc.hpp>
|
||||
|
||||
using namespace pixelarium::imaging;
|
||||
|
||||
pixelarium::render::CvMatRender::CvMatRender(const std::shared_ptr<Image>& img)
|
||||
: _base(img), _texture(0)
|
||||
{
|
||||
this->_img = this->_base->GetImage().clone();
|
||||
// this->_img = this->_base->GetImage().clone();
|
||||
// // storing a copy of the to-be-rendered image with a "well-behaved"
|
||||
// cv::cvtColor(this->_img, this->_img, cv::COLOR_BGR2RGBA);
|
||||
this->_img = this->_base->GetImage().clone();
|
||||
}
|
||||
|
||||
/*static*/ void pixelarium::render::matToTexture(const cv::Mat& image,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
// windows. must come before GL/GL.h here.
|
||||
// windows.h must come before GL/GL.h here.
|
||||
// clang format would change this, effectively rendering the build broken.
|
||||
// clang-format off
|
||||
#include <memory>
|
||||
|
||||
+1
-1
@@ -221,7 +221,7 @@ void pixelarium::ui::AppGLFW::LoadImageProt()
|
||||
// __FUNCTION__);
|
||||
if (this->_logger)
|
||||
{
|
||||
this->_logger->Warn("Creating image");
|
||||
this->_logger->Warn(std::format("Creating image {}", p));
|
||||
}
|
||||
// this->_img = Image(p);
|
||||
this->_img = std::make_shared<Image>(p);
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@
|
||||
#include "AppGLFW.hpp"
|
||||
#include "utilities/ILog.hpp"
|
||||
#include "utilities/SpdLogger.hpp"
|
||||
#include "uiresources.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
@@ -16,7 +17,7 @@ int main(int argc, char** argv)
|
||||
auto app = pixelarium::ui::AppGLFW(logger);
|
||||
// auto app = pixelarium::ui::AppGLFW();
|
||||
|
||||
logger->Info("Starting Application");
|
||||
logger->Info(std::format("Starting Application {}", PIXELARIUM_TITLE));
|
||||
logger->Error("Starting Application");
|
||||
return app.Run();
|
||||
}
|
||||
Reference in New Issue
Block a user