SGCT master (487fac4)
Simple Graphics Cluster Toolkit
Loading...
Searching...
No Matches
image.h
Go to the documentation of this file.
1/*****************************************************************************************
2 * SGCT *
3 * Simple Graphics Cluster Toolkit *
4 * *
5 * Copyright (c) 2012-2026 *
6 * For conditions of distribution and use, see copyright notice in LICENSE.md *
7 ****************************************************************************************/
8
9#ifndef __SGCT__IMAGE__H__
10#define __SGCT__IMAGE__H__
11
12#include <sgct/sgctexports.h>
13
14#include <sgct/math.h>
15#include <filesystem>
16
17namespace sgct {
18
19class SGCT_EXPORT Image {
20public:
21 Image() = default;
23
25 void load(const std::filesystem::path& filename);
26 void load(unsigned char* data, int length);
27
31 void save(const std::filesystem::path& filename);
32
33 unsigned char* data();
34 const unsigned char* data() const;
35 int channels() const;
36 int bytesPerChannel() const;
37 ivec2 size() const;
38
41 void setBytesPerChannel(int bpc);
42
43private:
44 int _nChannels = 0;
45 ivec2 _size = ivec2{ 0, 0 };
46 unsigned int _dataSize = 0;
47 int _bytesPerChannel = 1;
48 unsigned char* _data = nullptr;
49};
50
51} // namespace sgct
52
53#endif // __SGCT__IMAGE__H__
void setSize(ivec2 size)
int channels() const
void setBytesPerChannel(int bpc)
Image()=default
void allocateOrResizeData()
void setChannels(int channels)
int bytesPerChannel() const
void load(const std::filesystem::path &filename)
void load(unsigned char *data, int length)
ivec2 size() const
unsigned char * data()
void save(const std::filesystem::path &filename)
Save the buffer to file.
const unsigned char * data() const
Definition actions.h:16
Definition math.h:17