JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
ImageData.hpp
Go to the documentation of this file.
1// Copyright 2021-2026 Jan Niklas Hasse <jhasse@bixense.com>
2// For conditions of distribution and use, see copyright notice in LICENSE.txt
5#pragma once
6
7#include <cstdint>
8#include <memory>
9#include <string>
10
11namespace jngl {
12
14class ImageData {
15public:
22 static std::unique_ptr<ImageData> load(const std::string& filename, double scaleHint = 1.);
23
24 virtual ~ImageData() = default;
25
27 virtual int getWidth() const = 0;
28
30 virtual int getHeight() const = 0;
31
33 virtual int getImageWidth() const = 0;
35 virtual int getImageHeight() const = 0;
36
55 virtual const uint8_t* pixels() const = 0;
56};
57
58} // namespace jngl
Containing the pixel data of an image file.
Definition ImageData.hpp:14
static std::unique_ptr< ImageData > load(const std::string &filename, double scaleHint=1.)
Passing a filename will load the specified filename.
virtual const uint8_t * pixels() const =0
RGBA values ordered row-major.
virtual int getWidth() const =0
Returns the width of the image in pixels.
virtual int getImageHeight() const =0
If the image has been scaled by getScaleFactor() this will return the original image height.
virtual int getHeight() const =0
Returns the height of the image in pixels.
virtual int getImageWidth() const =0
If the image has been scaled by getScaleFactor() this will return the original image width.
JNGL's main namespace.