Simple GUI Library
image.h
Go to the documentation of this file.
1/**
2 * @author Nikita Mochalov (github.com/tralf-strues)
3 * @file image.h
4 * @date 2021-11-06
5 *
6 * @copyright Copyright (c) 2021
7 */
8
9#pragma once
10
11#include "sml/graphics_wrapper/texture.h"
12
13namespace Sgl
14{
15 enum class ImageFormat
16 {
17 INVALID,
18 BMP,
19 PNG
20 };
21
22 class Image
23 {
24 public:
25 Image(const char* filename, ImageFormat format);
26 Image(const Sml::Texture* texture);
27 ~Image() = default;
28
29 int32_t getWidth() const;
30 int32_t getHeight() const;
31 ImageFormat getFormat() const;
32 const Sml::Texture* getTexture() const;
33
34 private:
35 ImageFormat m_Format = ImageFormat::INVALID;
36 Sml::Texture* m_Texture = nullptr;
37 };
38
39 void renderImage(const Image* image, const Sml::Rectangle<int32_t>& targetRegion);
40 void renderImage(const Image* image, const Sml::Rectangle<int32_t>& targetRegion,
41 int32_t scaledWidth, int32_t scaledHeight);
42}