game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
core::IImageService Class Referenceabstract

Abstract interface for image loading operations. More...

#include <image_service.h>

Inheritance diagram for core::IImageService:

Public Member Functions

virtual ~IImageService ()=default
virtual void clearCache ()=0
 Clear all cached images and free resources.
virtual bool getImageDimensions (const std::string &path, int *width, int *height) const =0
 Get dimensions of a loaded image.
virtual bool isImageLoaded (const std::string &path) const =0
 Check if an image is already loaded/cached.
virtual bool loadImage (const std::string &path, int *width=nullptr, int *height=nullptr)=0
 Load an image from disk.
virtual void unloadImage (const std::string &path)=0
 Unload a specific image and free resources.

Detailed Description

Abstract interface for image loading operations.

The Qt UI layer implements this interface using QPixmap for image loading. The business logic layer uses this interface without knowing about the underlying graphics API.

Definition at line 34 of file image_service.h.

Constructor & Destructor Documentation

◆ ~IImageService()

virtual core::IImageService::~IImageService ( )
virtualdefault

Member Function Documentation

◆ clearCache()

virtual void core::IImageService::clearCache ( )
pure virtual

Clear all cached images and free resources.

Implemented in core::NullImageService, and QtImageService.

◆ getImageDimensions()

virtual bool core::IImageService::getImageDimensions ( const std::string & path,
int * width,
int * height ) const
pure virtual

Get dimensions of a loaded image.

Parameters
pathPath to the image
widthOutput parameter for width
heightOutput parameter for height
Returns
true if image is loaded and dimensions retrieved

Implemented in core::NullImageService, and QtImageService.

◆ isImageLoaded()

virtual bool core::IImageService::isImageLoaded ( const std::string & path) const
pure virtual

Check if an image is already loaded/cached.

Parameters
pathPath to check
Returns
true if image is cached

Implemented in core::NullImageService, and QtImageService.

◆ loadImage()

virtual bool core::IImageService::loadImage ( const std::string & path,
int * width = nullptr,
int * height = nullptr )
pure virtual

Load an image from disk.

Parameters
pathPath to the image file
widthOutput parameter for image width (optional)
heightOutput parameter for image height (optional)
Returns
true if loading succeeded, false otherwise

Implementations should cache the loaded image for subsequent calls.

Implemented in core::NullImageService, and QtImageService.

◆ unloadImage()

virtual void core::IImageService::unloadImage ( const std::string & path)
pure virtual

Unload a specific image and free resources.

Parameters
pathPath of the image to unload

Implemented in core::NullImageService, and QtImageService.


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