Prerequisite Checklist
Describe your feature request here
With drag and drop support planned for SFML 3.2.0, adding the ability to copy/paste images to/from the clipboard would further improve the ease of use of SFML apps.
Use Cases
Similar to how drag and drop would make opening files quicker in some situations, copy pasting images from/to clipboard could be useful in also many situations (editors, image viewers, ...)
API Example
#include <SFML/Graphics.hpp>
int main()
{
sf::Image image;
...
sf::Clipboard::setImage(image.getSize(), image.getPixelsPtr());
sf::Vector2u size;
uint8_t* pixels = nullptr;
sf::Clipboard::getImage(size, pixels); //pixels stays nullptr if no image is in clipboard
//or something like
auto img = sf::Clipboard::getImage(); //img is a pair or optional or something similar
}
Design for setting the image would be something similar to sf::Window::setIcon as sf::Image is in SFML-Graphics and sf::Clipboard is in SFML-Window so we cannot just pass an sf::Image as an argument.
As for getting the image from the clipboard I'm not sure, maybe return a std::pair or set size and pixels as parameters which the function would then change...
I'd love to hear other suggestions.
Prerequisite Checklist
Describe your feature request here
With drag and drop support planned for SFML 3.2.0, adding the ability to copy/paste images to/from the clipboard would further improve the ease of use of SFML apps.
Use Cases
Similar to how drag and drop would make opening files quicker in some situations, copy pasting images from/to clipboard could be useful in also many situations (editors, image viewers, ...)
API Example
Design for setting the image would be something similar to
sf::Window::setIconassf::Imageis in SFML-Graphics andsf::Clipboardis in SFML-Window so we cannot just pass ansf::Imageas an argument.As for getting the image from the clipboard I'm not sure, maybe return a
std::pairor set size and pixels as parameters which the function would then change...I'd love to hear other suggestions.