Shkyera Engine
Easy to use, game engine for Python
Loading...
Searching...
No Matches
Image.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <filesystem>
4
5namespace shkyera {
6
11class Image {
12 public:
18 Image(const std::filesystem::path& path);
19
20 Image(const Image& other) = delete;
21 Image& operator=(const Image& other) = delete;
22
23 Image(Image&& other) noexcept;
24 Image& operator=(Image&& other) noexcept;
25
31 void load(const std::filesystem::path& path);
32
38 void save(const std::filesystem::path& path) const;
39
40 uint8_t const* getData() const;
41 int getWidth() const;
42 int getHeight() const;
43 int getChannels() const;
44
45 static std::filesystem::path ICON_CONSOLE_TOTAL;
46 static std::filesystem::path ICON_CONSOLE_ERROR;
47 static std::filesystem::path ICON_CONSOLE_INFO;
48 static std::filesystem::path ICON_CONSOLE_VERBOSE;
49 static std::filesystem::path ICON_CONSOLE_SUCCESS;
50
51 static std::filesystem::path ICON_COMPONENT_TRANSFORM;
52 static std::filesystem::path ICON_COMPONENT_SCRIPT;
53 static std::filesystem::path ICON_COMPONENT_SHAPE;
54
55 static std::filesystem::path ICON_FILES_FOLDER;
56 static std::filesystem::path ICON_FILES_PYTHON;
57 static std::filesystem::path ICON_FILES_IMAGE;
58 static std::filesystem::path ICON_FILES_TEXT;
59 static std::filesystem::path ICON_FILES_AUDIO;
60
61 static std::filesystem::path ICON_BUTTON_PLAY;
62 static std::filesystem::path ICON_BUTTON_STOP;
63
64 private:
65 uint8_t* _data;
66
67 int _width;
68 int _height;
70};
71
72} // namespace shkyera
A class for working with images and textures.
Definition Image.hpp:11
static std::filesystem::path ICON_CONSOLE_INFO
Definition Image.hpp:47
int getWidth() const
Definition Image.cpp:51
static std::filesystem::path ICON_FILES_FOLDER
Definition Image.hpp:55
uint8_t * _data
The image pixel data.
Definition Image.hpp:65
static std::filesystem::path ICON_BUTTON_STOP
Definition Image.hpp:62
void load(const std::filesystem::path &path)
Load an image from a file.
Definition Image.cpp:35
Image & operator=(const Image &other)=delete
static std::filesystem::path ICON_COMPONENT_SCRIPT
Definition Image.hpp:52
static std::filesystem::path ICON_COMPONENT_TRANSFORM
Definition Image.hpp:51
int _width
The width of the image.
Definition Image.hpp:67
static std::filesystem::path ICON_FILES_AUDIO
Definition Image.hpp:59
static std::filesystem::path ICON_CONSOLE_SUCCESS
Definition Image.hpp:49
void save(const std::filesystem::path &path) const
Save the image to a file in PNG format.
Definition Image.cpp:43
uint8_t const * getData() const
Definition Image.cpp:47
static std::filesystem::path ICON_CONSOLE_TOTAL
Definition Image.hpp:45
int _components
The number of color components.
Definition Image.hpp:69
int getChannels() const
Definition Image.cpp:57
static std::filesystem::path ICON_FILES_IMAGE
Definition Image.hpp:57
static std::filesystem::path ICON_CONSOLE_ERROR
Definition Image.hpp:46
static std::filesystem::path ICON_COMPONENT_SHAPE
Definition Image.hpp:53
Image(const Image &other)=delete
static std::filesystem::path ICON_CONSOLE_VERBOSE
Definition Image.hpp:48
static std::filesystem::path ICON_FILES_PYTHON
Definition Image.hpp:56
static std::filesystem::path ICON_FILES_TEXT
Definition Image.hpp:58
static std::filesystem::path ICON_BUTTON_PLAY
Definition Image.hpp:61
int _height
The height of the image.
Definition Image.hpp:68
int getHeight() const
Definition Image.cpp:54
Definition Asset.hpp:6