Chira Engine
A customizable MIT-licensed game engine.
chira::Image Class Reference
Inheritance diagram for chira::Image:
Collaboration diagram for chira::Image:

Public Member Functions

 Image (std::string identifier_, bool vFlip=true)
 
 Image (const Image &other)=delete
 
Imageoperator= (const Image &other)=delete
 
 Image (Image &&other) noexcept=default
 
Imageoperator= (Image &&other) noexcept=default
 
void compile (const byte buffer[], std::size_t bufferLen) override
 
byte * getData () const
 
int getWidth () const
 
int getHeight () const
 
int getBitDepth () const
 
bool isVerticallyFlipped () const
 
- Public Member Functions inherited from chira::Resource
 Resource (std::string identifier_)
 
std::string_view getIdentifier () const
 

Static Public Member Functions

static byte * getUncompressedImage (const byte buffer[], int bufferLen, int *width, int *height, int *fileChannels, int desiredChannels, bool vflip)
 
static byte * getUncompressedImage (const byte buffer[], int bufferLen, int desiredChannels, bool vflip)
 
static byte * getUncompressedImage (std::string_view filepath, int *width, int *height, int *fileChannels, int desiredChannels, bool vflip)
 
static byte * getUncompressedImage (std::string_view filepath, int desiredChannels, bool vflip)
 
static void deleteUncompressedImage (byte *image)
 
- Static Public Member Functions inherited from chira::Resource
static void addResourceProvider (IResourceProvider *provider)
 
static IResourceProvidergetLatestResourceProvider (const std::string &provider)
 
static IResourceProvidergetResourceProviderWithResource (const std::string &identifier)
 
template<typename ResourceType , typename... Params>
static SharedPointer< ResourceType > getResource (const std::string &identifier, Params... params)
 
template<typename ResourceType , typename... Params>
static void precacheResource (const std::string &identifier, Params... params)
 
template<typename ResourceType >
static SharedPointer< ResourceType > getCachedResource (const std::string &identifier)
 
template<typename ResourceType , typename... Params>
static SharedPointer< ResourceType > getUniqueResource (const std::string &identifier, Params... params)
 
template<typename ResourceType , typename... Params>
static SharedPointer< ResourceType > getUniqueUncachedResource (const std::string &identifier, Params... params)
 You might want to use this sparingly as it defeats the entire point of a cached, shared resource system.
 
template<typename ResourceType , typename... Params>
static std::unique_ptr< ResourceType > getUniqueUncachedPropertyResource (const std::string &identifier, const nlohmann::json &props, Params... params)
 The only way to make a PropertiesResource without a provider is to make it unique, and not to cache it. More...
 
static std::pair< std::string, std::string > splitResourceIdentifier (const std::string &identifier)
 
static const std::vector< std::unique_ptr< IResourceProvider > > & getResourceProviders (const std::string &providerName)
 
static bool hasResource (const std::string &identifier)
 
static void removeResource (const std::string &identifier)
 If resource is present in the cache and has a reference count less than or equal to 2, mark it for removal.
 
static void cleanup ()
 Delete all resources marked for removal.
 
static void discardAll ()
 Deletes ALL resources and providers. Should only ever be called once, when the program closes.
 
template<typename ResourceType >
static bool registerDefaultResource (const std::string &identifier)
 
template<typename ResourceType >
static bool hasDefaultResource ()
 
template<typename ResourceType >
static SharedPointer< ResourceType > getDefaultResource ()
 
static void createDefaultResources ()
 

Protected Attributes

byte * image = nullptr
 
int width = -1
 
int height = -1
 
int bitDepth = -1
 
bool verticalFlip = true
 
- Protected Attributes inherited from chira::Resource
std::string identifier
 

Additional Inherited Members

- Static Protected Member Functions inherited from chira::Resource
static auto getDefaultResourceConstructors () -> std::unordered_map< std::type_index, std::function< void()>> &
 
static void logResourceError (const std::string &identifier, const std::string &resourceName)
 We do a few predeclaration workarounds.
 
- Static Protected Attributes inherited from chira::Resource
static std::unordered_map< std::string, std::vector< std::unique_ptr< IResourceProvider > > > providers
 
static std::unordered_map< std::string, std::unordered_map< std::string, SharedPointer< Resource > > > resources
 
static std::unordered_map< std::type_index, SharedPointer< Resource > > defaultResources
 
static std::vector< std::string > garbageResources
 

Detailed Description

Definition at line 8 of file Image.h.


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