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-2024 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 <memory>
8#include <string>
9
10namespace jngl {
11
13class ImageData {
14public:
21 static std::unique_ptr<ImageData> load(const std::string& filename, double scaleHint = 1.);
22
23 virtual ~ImageData() = default;
24
26 virtual int getWidth() const = 0;
27
29 virtual int getHeight() const = 0;
30
32 virtual int getImageWidth() const = 0;
34 virtual int getImageHeight() const = 0;
35
54 virtual const uint8_t* pixels() const = 0;
55};
56
57} // namespace jngl
Containing the pixel data of an image file.
Definition ImageData.hpp:13
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.