FifeGUI 0.2.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#include <string>
9
10#include "fifechan/platform.hpp"
11
12namespace fcn
13{
14 class Color;
15 class ImageLoader;
16
31 class FIFEGUI_API Image
32 {
33 public:
34 Image();
35
36 virtual ~Image();
37
38 Image(Image const &) = delete;
39 Image& operator=(Image const &) = delete;
40 Image(Image&&) = delete;
41 Image& operator=(Image&&) = delete;
42
55 static Image* load(std::string const & filename, bool convertToDisplayFormat = true);
56
64
74 static void setImageLoader(ImageLoader* imageLoader);
75
80 virtual void free() = 0;
81
88 virtual int getWidth() const = 0;
89
96 virtual int getHeight() const = 0;
97
109 virtual Color getPixel(int x, int y) = 0;
110
118 virtual void putPixel(int x, int y, Color const & color) = 0;
119
126 virtual void convertToDisplayFormat() = 0;
127
128 protected:
133 };
134} // namespace fcn
135
136#endif // INCLUDE_FIFECHAN_IMAGE_HPP_
Color.
Definition color.hpp:56
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 Image * load(std::string const &filename, bool convertToDisplayFormat=true)
Loads an image by using the class' image loader.
Definition image.cpp:31
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:21
static ImageLoader * mImageLoader
Holds the image loader to be used when loading images.
Definition image.hpp:132
virtual void free()=0
Frees an image.
static ImageLoader * getImageLoader()
Gets the image loader used for loading images.
Definition image.cpp:26
virtual int getWidth() const =0
Gets the width of the image.