blob: d73e86e2f4e6b7a213bc0139e9be9ed3e001ed3a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#include "image.hpp"
#include "stb_image.h"
#include <csetjmp>
#include <format>
#include <fud_c_file.hpp>
#include <spdlog/spdlog.h>
namespace bookmouse {
#if 0
class JpegFile {
public:
~JpegFile();
void decompress(fud::CBinaryFile& inFile);
private:
};
#endif
ImageResult JpegImage::output() const
{
auto err = [](ImageError eid) { return ImageResult::error(eid); };
ImageOutput image{};
fud::CBinaryFile inFile{m_filename, fud::CFileMode::ReadOnly};
auto fileResult = inFile.open();
using fud::FudStatus;
if (fileResult == FudStatus::Failure) {
spdlog::error("can't open {}\n", m_filename.c_str());
return err(ImageError::FileError);
}
auto* filePtr = inFile.file();
if (filePtr == nullptr) {
return err(ImageError::FileError);
}
// stbi_load_from_file(filePtr,
// return ImageResult::okay(image);
return err(ImageError::FileError);
}
} // namespace bookmouse
|