SFML community forums
Help => Graphics => Topic started by: troopson on June 14, 2011, 07:32:27 pm
-
I'm trying to make a Paint application.
How do i draw shapes/lines to a buffer like Image ? I can't paint everything directly to the window because when i resize/move etc the window it all dissapears. I wanted to do something like draw everything to an image and in main loop draw the image. How do i do that in sfml?
-
You can't draw to an image with SFML 1.6.
I can't paint everything directly to the window because when i resize/move etc the window it all dissapears.
???
Maybe we should try to solve this problem instead ;)
It looks like you're only painting things once, whereas they should be painted in an infinite loop that clears/draws/displays.
-
"It looks like you're only painting things once, whereas they should be painted in an infinite loop that clears/draws/displays."
well... u want me to draw 923592592 lines and remember it all ?Any other ideas?:P
-
well... u want me to draw 923592592 lines and remember it all ?Any other ideas?
How do you implement undo/redo ? ;)
Anyway, you should switch to SFML 2. Drawing to an image is the only other solution, and it is not available in SFML 1.
-
well... u want me to draw 923592592 lines and remember it all ?Any other ideas?
How do you implement undo/redo ? ;)
Anyway, you should switch to SFML 2. Drawing to an image is the only other solution, and it is not available in SFML 1.
What do you mean by drawing to an image?
You can make a pixel-sized image and create a dynamic array so you'll be able to undo/redo and save. If the pixels aren't limited to the FPS (maybe you can make it a triple digit number, I haven't tested this out), it should work out. You can also create a funky algorithm that creates a line made up of more pixels if there happens to be a gap between them
-
What do you mean by drawing to an image?
I mean this
sf::Image image;
sf::Sprite sprite;
image.Draw(sprite);
(it's not like this in SFML 2 but it's more obvious this way)
-
What do you mean by drawing to an image?
I mean this
sf::Image image;
sf::Sprite sprite;
image.Draw(sprite);
(it's not like this in SFML 2 but it's more obvious this way)
It kinda looks like you're drawing nothing because "sprite" does not have an image set
-
It kinda looks like you're drawing nothing because "sprite" does not have an image set
Did you actually read the previous messages before answering? :lol:
This piece of code was just an example to show what rendering to an image means. It's not supposed to do anything useful...
-
i dont want to write code which draws a line/circle/stuff (know its not so hard);p
-
i dont want to write code which draws a line/circle/stuff
But you want to write Paint?
What's wrong with the solutions given in this thread?