Shkyera Engine
Easy to use, game engine for Python
shkyera::Image Class Reference

A class for working with images and textures. More...

#include <Image.hpp>

Public Member Functions

 Image (size_t width, size_t height)
 Constructor for creating an image with the specified width and height. More...
 
 Image (std::filesystem::path path)
 Constructor for loading an image from a file. More...
 
void load (std::filesystem::path path)
 Load an image from a file. More...
 
void save (std::filesystem::path path) const
 Save the image to a file in PNG format. More...
 
void updateTextureId ()
 Update the OpenGL texture ID associated with the image. More...
 
uint64_t getTextureId () const
 Get the OpenGL texture ID associated with the image. More...
 

Static Public Attributes

static Image ICON_CONSOLE_TOTAL = Image("resources/icons/console/total.png")
 
static Image ICON_CONSOLE_ERROR = Image("resources/icons/console/error.png")
 
static Image ICON_CONSOLE_INFO = Image("resources/icons/console/info.png")
 
static Image ICON_CONSOLE_VERBOSE = Image("resources/icons/console/verbose.png")
 
static Image ICON_CONSOLE_SUCCESS = Image("resources/icons/console/success.png")
 
static Image ICON_COMPONENT_TRANSFORM = Image("resources/icons/components/transform.png")
 
static Image ICON_COMPONENT_SCRIPT = Image("resources/icons/components/script.png")
 
static Image ICON_COMPONENT_SHAPE = Image("resources/icons/components/shape.png")
 
static Image ICON_FILES_FOLDER = Image("resources/icons/files/folder.png")
 
static Image ICON_FILES_PYTHON = Image("resources/icons/files/python.png")
 
static Image ICON_FILES_IMAGE = Image("resources/icons/files/image.png")
 
static Image ICON_FILES_TEXT = Image("resources/icons/files/text.png")
 
static Image ICON_BUTTON_PLAY = Image("resources/icons/buttons/play.png")
 
static Image ICON_BUTTON_STOP = Image("resources/icons/buttons/stop.png")
 

Private Attributes

uint8_t * _data
 The image pixel data. More...
 
int _width
 The width of the image. More...
 
int _height
 The height of the image. More...
 
int _components
 The number of color components. More...
 
bool _wasAssignedTextureId
 Flag indicating if the texture ID has been assigned. More...
 
uint64_t _textureId
 The OpenGL texture ID. More...
 

Detailed Description

A class for working with images and textures.

Constructor & Destructor Documentation

◆ Image() [1/2]

shkyera::Image::Image ( size_t  width,
size_t  height 
)

Constructor for creating an image with the specified width and height.

Parameters
widthThe width of the image.
heightThe height of the image.

◆ Image() [2/2]

shkyera::Image::Image ( std::filesystem::path  path)

Constructor for loading an image from a file.

Parameters
pathThe path to the image file.

Member Function Documentation

◆ getTextureId()

uint64_t shkyera::Image::getTextureId ( ) const

Get the OpenGL texture ID associated with the image.

Returns
The OpenGL texture ID.

◆ load()

void shkyera::Image::load ( std::filesystem::path  path)

Load an image from a file.

Parameters
pathThe path to the image file.

◆ save()

void shkyera::Image::save ( std::filesystem::path  path) const

Save the image to a file in PNG format.

Parameters
pathThe path to the output file.

◆ updateTextureId()

void shkyera::Image::updateTextureId ( )

Update the OpenGL texture ID associated with the image.

Member Data Documentation

◆ _components

int shkyera::Image::_components
private

The number of color components.

◆ _data

uint8_t* shkyera::Image::_data
private

The image pixel data.

◆ _height

int shkyera::Image::_height
private

The height of the image.

◆ _textureId

uint64_t shkyera::Image::_textureId
private

The OpenGL texture ID.

◆ _wasAssignedTextureId

bool shkyera::Image::_wasAssignedTextureId
private

Flag indicating if the texture ID has been assigned.

◆ _width

int shkyera::Image::_width
private

The width of the image.

◆ ICON_BUTTON_PLAY

Image shkyera::Image::ICON_BUTTON_PLAY = Image("resources/icons/buttons/play.png")
static

◆ ICON_BUTTON_STOP

Image shkyera::Image::ICON_BUTTON_STOP = Image("resources/icons/buttons/stop.png")
static

◆ ICON_COMPONENT_SCRIPT

Image shkyera::Image::ICON_COMPONENT_SCRIPT = Image("resources/icons/components/script.png")
static

◆ ICON_COMPONENT_SHAPE

Image shkyera::Image::ICON_COMPONENT_SHAPE = Image("resources/icons/components/shape.png")
static

◆ ICON_COMPONENT_TRANSFORM

Image shkyera::Image::ICON_COMPONENT_TRANSFORM = Image("resources/icons/components/transform.png")
static

◆ ICON_CONSOLE_ERROR

Image shkyera::Image::ICON_CONSOLE_ERROR = Image("resources/icons/console/error.png")
static

◆ ICON_CONSOLE_INFO

Image shkyera::Image::ICON_CONSOLE_INFO = Image("resources/icons/console/info.png")
static

◆ ICON_CONSOLE_SUCCESS

Image shkyera::Image::ICON_CONSOLE_SUCCESS = Image("resources/icons/console/success.png")
static

◆ ICON_CONSOLE_TOTAL

Image shkyera::Image::ICON_CONSOLE_TOTAL = Image("resources/icons/console/total.png")
static

◆ ICON_CONSOLE_VERBOSE

Image shkyera::Image::ICON_CONSOLE_VERBOSE = Image("resources/icons/console/verbose.png")
static

◆ ICON_FILES_FOLDER

Image shkyera::Image::ICON_FILES_FOLDER = Image("resources/icons/files/folder.png")
static

◆ ICON_FILES_IMAGE

Image shkyera::Image::ICON_FILES_IMAGE = Image("resources/icons/files/image.png")
static

◆ ICON_FILES_PYTHON

Image shkyera::Image::ICON_FILES_PYTHON = Image("resources/icons/files/python.png")
static

◆ ICON_FILES_TEXT

Image shkyera::Image::ICON_FILES_TEXT = Image("resources/icons/files/text.png")
static

The documentation for this class was generated from the following files: