mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 15:45:38 +00:00
Added a setRawImage function to ImageComponent to load raw pixel data into textures
This commit is contained in:
parent
e7e3db7f6d
commit
177dd23b7c
|
@ -128,6 +128,15 @@ void ImageComponent::setImage(const std::shared_ptr<TextureResource>& texture, b
|
||||||
resize();
|
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)
|
void ImageComponent::setGameOverrideImage(const std::string& basename, const std::string& system)
|
||||||
{
|
{
|
||||||
if (mGameOverridePath == "")
|
if (mGameOverridePath == "")
|
||||||
|
|
|
@ -29,6 +29,8 @@ public:
|
||||||
void setImage(const char* data, size_t length, bool tile = false);
|
void setImage(const char* data, size_t length, bool tile = false);
|
||||||
// Use an already existing texture.
|
// Use an already existing texture.
|
||||||
void setImage(const std::shared_ptr<TextureResource>& texture, bool resizeTexture = true);
|
void setImage(const std::shared_ptr<TextureResource>& 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.
|
// Sets per-game overrides of static images using the game file basename.
|
||||||
void setGameOverrideImage(const std::string& basename, const std::string& system) override;
|
void setGameOverrideImage(const std::string& basename, const std::string& system) override;
|
||||||
|
|
Loading…
Reference in a new issue