Indeed! Thank you for your answer, texus!
Very soon after asking the question I managed to code a satisfactory solution myself.
I planned to publish the solution I found, and thus contribute to the community. But the life delayed me. I'm sorry. :-(
Anyway, it's not perfect, because I can't load the alpha channel of the PNG images. But I know that the problem has nothing to do with SFML or TGUI.
I paste the current code (for now):
m_imagen.load("recursos/imagen_png.png");
//m_imagen.load("recursos/imagenBN_jpg.jpg");
//m_imagen.load("recursos/imagen_jpg.jpg");
sf::Image imagen;
imagen.create(m_imagen.width(), m_imagen.height(), sf::Color::Black);
switch (m_imagen.spectrum())
{
case 0:
{
//The image is empty
}
break;
case 1: //Grayscale image
{
for (std::size_t i = 0; i < m_imagen.width(); ++i)
{
for (std::size_t j = 0; j < m_imagen.height(); ++j)
{
sf::Color color = sf::Color(m_imagen(i, j, 0, 0), m_imagen(i, j, 0, 0), m_imagen(i, j, 0, 0), 255);
imagen.setPixel(i, j, color);
}
}
}
break;
case 3: //The image is RGB
{
for (std::size_t i = 0; i < m_imagen.width(); ++i)
{
for (std::size_t j = 0; j < m_imagen.height(); ++j)
{
sf::Color color = sf::Color(m_imagen(i, j, 0, 0), m_imagen(i, j, 0, 1), m_imagen(i, j, 0, 2), 255);
imagen.setPixel(i, j, color);
}
}
}
break;
case 4: //The image is RGBA?
{
for (std::size_t i = 0; i < m_imagen.width(); ++i)
{
for (std::size_t j = 0; j < m_imagen.height(); ++j)
{
sf::Color color = sf::Color(m_imagen(i, j, 0, 0), m_imagen(i, j, 0, 1), m_imagen(i, j, 0, 2), m_imagen(i, j, 0, 3));
imagen.setPixel(i, j, color);
}
}
}
break;
default:
break;
}
sf::Texture textura;
textura.loadFromImage(imagen);
tgui::Picture::Ptr panoramica = m_gui_principal.get<tgui::Picture>("Picture1");
panoramica->getRenderer()->setTexture(textura);
DJuego
P.S: Thank you for your commitment to the forum.