Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy image to clipboard buffer #5424

Open
emilk opened this issue Dec 3, 2024 · 0 comments
Open

Copy image to clipboard buffer #5424

emilk opened this issue Dec 3, 2024 · 0 comments
Labels
help wanted Extra attention is needed rerun Desired for Rerun.io

Comments

@emilk
Copy link
Owner

emilk commented Dec 3, 2024

I would like to be able to get an epaint::ColorImage into the system clipboard, both on native and web, via egui and eframe.

Implementation

egui

Currently what is being copied is stored in PlatformOutput::copied_text.

The simple/hacky solution would be to simply add a copied_image: Option<ColorImage> to PlatformOutput.

A nicer solution is to deprecate copied_text and open_url and replace them with something like commands: Vec<OutputCommand> with

enum OutputCommand {
	CopyText(String),
	CopyImage(ColorImage),
	OpenUrl(OpenUrl)
}

eframe

On native we can use arboard::Clipboard.

On web we can use the Clipboard API:

const item = new ClipboardItem({ "image/png": png_blob });
await navigator.clipboard.write([item]);

Related

@emilk emilk added help wanted Extra attention is needed rerun Desired for Rerun.io labels Dec 3, 2024
@emilk emilk added this to egui Dec 3, 2024
@emilk emilk moved this to Backlog in egui Dec 3, 2024
@emilk emilk moved this from Backlog to Ready in egui Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed rerun Desired for Rerun.io
Projects
Status: Next up
Development

No branches or pull requests

1 participant