diff --git a/es-core/src/components/ImageComponent.cpp b/es-core/src/components/ImageComponent.cpp index 801d2b4ed..e3e88d70f 100644 --- a/es-core/src/components/ImageComponent.cpp +++ b/es-core/src/components/ImageComponent.cpp @@ -128,6 +128,15 @@ void ImageComponent::setImage(const std::shared_ptr& texture, b resize(); } +void ImageComponent::setRawImage(const unsigned char* data, float width, float height) +{ + mTexture.reset(); + mTexture = TextureResource::get(""); + mTexture->initFromPixels(data, width, height); + + resize(); +} + void ImageComponent::setGameOverrideImage(const std::string& basename, const std::string& system) { if (mGameOverridePath == "") diff --git a/es-core/src/components/ImageComponent.h b/es-core/src/components/ImageComponent.h index 152058af9..91774c7da 100644 --- a/es-core/src/components/ImageComponent.h +++ b/es-core/src/components/ImageComponent.h @@ -29,6 +29,8 @@ public: void setImage(const char* data, size_t length, bool tile = false); // Use an already existing texture. void setImage(const std::shared_ptr& texture, bool resizeTexture = true); + // Loads a texture using raw image pixel data. + void setRawImage(const unsigned char* data, float width, float height); // Sets per-game overrides of static images using the game file basename. void setGameOverrideImage(const std::string& basename, const std::string& system) override;