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

Author Topic: Resizing images?  (Read 10256 times)

0 Members and 1 Guest are viewing this topic.

RobotGymnast

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Resizing images?
« on: February 05, 2011, 08:29:51 pm »
Is it possible to resize an image, and store it as an Image, rather than a Sprite?

Oneiros

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Resizing images?
« Reply #1 on: February 05, 2011, 09:13:36 pm »
With sfml2 maybe something like this :
-create a Sprite with your image.
-resize the Sprite.
-make a renderImage with the resized Sprite.

Code: [Select]

sf::RenderImage resizeImage(sf::Image p_image,float p_width, float p_height)
{
 sf::Sprite spriteTmp(p_image)
 spriteTmp.Resize(p_width, p_height);
 sf::RenderImage image;
 image.Clear(sf::Color(0,0,0,255));
 image.Draw(spriteTmp);
 image.display();
 return image;
}


and

Code: [Select]

if (!sf::RenderImage::IsAvailable())
{
return EXIT_FAILURE;
}

sf::Image newImage( reziseImage(myBaseImage,newWidth,newHeight).GetImage());



in sfml1.6 i don't know.

RobotGymnast

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Resizing images?
« Reply #2 on: February 05, 2011, 09:30:45 pm »
SFML2's perfect, thanks!