FifeGUI 0.3.0
A C++ GUI library designed for games.
image.hpp
1// SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
2// SPDX-FileCopyrightText: 2004 - 2008 Olof Naessén and Per Larsson
3// SPDX-FileCopyrightText: 2013 - 2026 Fifengine contributors
4
5#ifndef INCLUDE_FIFECHAN_IMAGE_HPP_
6#define INCLUDE_FIFECHAN_IMAGE_HPP_
7
8// Standard library includes
9#include <string>
10
11// Platform config include
12#include "fifechan/platform.hpp"
13
14namespace fcn
15{
16 class Color;
17 class ImageLoader;
18
33 class FIFEGUI_API Image
34 {
35 public:
36 Image();
37
38 virtual ~Image();
39
40 Image(Image const &) = delete;
41 Image& operator=(Image const &) = delete;
42 Image(Image&&) = delete;
43 Image& operator=(Image&&) = delete;
44
57 static Image* load(std::string const & filename, bool convertToDisplayFormat = true);
58
66
77 static void setImageLoader(ImageLoader* imageLoader);
78
85 static void resetImageLoader();
86
91 virtual void free() = 0;
92
99 virtual int getWidth() const = 0;
100
107 virtual int getHeight() const = 0;
108
120 virtual Color getPixel(int x, int y) = 0;
121
129 virtual void putPixel(int x, int y, Color const & color) = 0;
130
137 virtual void convertToDisplayFormat() = 0;
138
139 protected:
144 };
145} // namespace fcn
146
147#endif // INCLUDE_FIFECHAN_IMAGE_HPP_
Color.
Definition color.hpp:58
Abstract interface for loading image assets.
virtual int getHeight() const =0
Gets the height of the image.
virtual Color getPixel(int x, int y)=0
Gets the color of a pixel at coordinate (x, y) in the image.
static void resetImageLoader()
Resets the image loader used for loading images, detaching it from the Image class.
Definition image.cpp:39
static Image * load(std::string const &filename, bool convertToDisplayFormat=true)
Loads an image by using the class' image loader.
Definition image.cpp:44
virtual void putPixel(int x, int y, Color const &color)=0
Puts a pixel with a certain color at coordinate (x, y).
virtual void convertToDisplayFormat()=0
Converts the image, if possible, to display format.
static void setImageLoader(ImageLoader *imageLoader)
Sets the ImageLoader to be used for loading images.
Definition image.cpp:28
static ImageLoader * mImageLoader
Holds the image loader to be used when loading images.
Definition image.hpp:143
virtual void free()=0
Frees an image.
static ImageLoader * getImageLoader()
Gets the image loader used for loading images.
Definition image.cpp:34
virtual int getWidth() const =0
Gets the width of the image.
Used replacement tokens by configure_file():