Go to the documentation of this file.
32 struct memoryDataAndPos_ {
33 std::vector<char> data;
35 template <
class Archive>
36 void serialize(Archive& archive) {
41 memoryDataAndPos_ memoryDataAndPos;
43 unsigned long width = 0, height = 0;
44 std::vector<uint8_t> imageData;
45 unsigned long imageDataSize = 0;
46 void load(
const std::string& fileLocation, std::vector<char>& data);
47 static void readDataFromMemory(png_structp png_ptr, png_bytep outBytes,
48 png_size_t byteCountToRead);
63 explicit Image(
const std::string& fileLocation =
"");
70 explicit Image(std::vector<char>& data);
105 const uint8_t*
getData()
const;
107 template <
class Archive>
108 void serialize(Archive& archive) {
109 archive(memoryDataAndPos, width, height, imageData, imageDataSize);
4 component vector
Definition: Math.hpp:56
Vectors, matrices and other math things.
unsigned long getByteSize() const
Get the size of the image, in bytes.
Definition: Image.cpp:283
Image(const std::string &fileLocation="")
File-reading constructor.
Definition: Image.cpp:18
static const std::string NOTRGBA
String saying that the colour encoding of the image being read is not RGB/RGBA.
Definition: Image.hpp:56
void toColour(Vec4 colour)
Convert to a coloured 10 x 10 pixel image.
Definition: Image.cpp:56
Definition: BinaryFile.hpp:15
unsigned long getWidth() const
Get the image width.
Definition: Image.cpp:275
An image, loaded from a .png file, which can be used for generating textures.
Definition: Image.hpp:29
const uint8_t * getData() const
Get the image data.
Definition: Image.cpp:287
~Image()=default
Destructor.
unsigned long getHeight() const
Get the image height.
Definition: Image.cpp:279