The small3d framework
Image.hpp
Go to the documentation of this file.
1 
10 #pragma once
11 
12 #include <string>
13 #include <memory>
14 #include <vector>
15 #include "Logger.hpp"
16 #include <png.h>
17 #include <glm/vec4.hpp>
18 
19 namespace small3d {
20 
29  class Image {
30  private:
31 
32  unsigned long width, height;
33  std::vector<float> imageData;
34  unsigned long imageDataSize;
35  void loadFromFile(const std::string fileLocation);
36 
37  public:
38 
44  Image(const std::string fileLocation = "");
45 
49  ~Image() = default;
50 
54  void toColour(glm::vec4 colour);
55 
60  unsigned long getWidth() const;
61 
66  unsigned long getHeight() const;
67 
72  unsigned long getByteSize() const;
73 
78  const float* getData() const;
79 
80  };
81 
82 }
unsigned long getByteSize() const
Get the size of the image, in bytes.
Definition: Image.cpp:213
void toColour(glm::vec4 colour)
Convert to a coloured 10 x 10 pixel image.
Definition: Image.cpp:40
An image, loaded from a png file, which can be used for generating textures.
Definition: Image.hpp:29
Image(const std::string fileLocation="")
Default constructor.
Definition: Image.cpp:23
unsigned long getWidth() const
Get the image width.
Definition: Image.cpp:205
Header of the Logger class.
const float * getData() const
Get the image data.
Definition: Image.cpp:217
~Image()=default
Destructor.
unsigned long getHeight() const
Get the image height.
Definition: Image.cpp:209