Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Copy sf::Shape to sf::Image  (Read 1401 times)

0 Members and 2 Guests are viewing this topic.

diego997

  • Newbie
  • *
  • Posts: 21
    • View Profile
Copy sf::Shape to sf::Image
« on: December 16, 2012, 04:32:27 pm »
Is there a possibility in sfml to copy sf::Shape to sf::Image(I know there is sf::Shape::setTexture method, but I want to do it in opposite way).  I need this to save Image into file without creating sf::RenderWindow Object.

Somehow like that
Code: [Select]
sf::RectangleShape Shape;
Shape.setSize(sf::Vector2f(50,50));
Shape.setFillColor(sf::Color::Red);

sf::Image Image;
Image.getShape(Shape); //This is my imaginary method ;p

Image.saveToFile("Image.bmp");


Thank you in advance :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Copy sf::Shape to sf::Image
« Reply #1 on: December 16, 2012, 06:29:10 pm »
You must use sf::RenderTexture.
Laurent Gomila - SFML developer

 

anything