1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 14:50:03 -04:00
Files
egui/crates
BernardDGS dadf573dde Add clipboard image paste support (Event::PasteImage) (#8472)
Adds `egui::Event::PasteImage`, emitted on Ctrl+V/Cmd+V when the
clipboard holds an
image with no usable text representation (mirrors
`OutputCommand::CopyImage` for
the opposite direction). `egui-winit::Clipboard` gains `get_image()`,
backed by
`arboard::Clipboard::get_image()` — the symmetric counterpart to the
`set_image()`
already used for copy. Wired in the winit keyboard-shortcut path and in
both the
glow and wgpu eframe backends' AccessKit-driven paste action.

Straight (unmultiplied) alpha from the OS clipboard is converted via the
existing
`ColorImage::from_rgba_unmultiplied` helper rather than reinterpreting
bytes
directly, since the two aren't bit-compatible for translucent pixels.

Not covered here: the web (wasm32) target — browser clipboard image
reads are
inherently async (`Blob::array_buffer` returns a Promise), while
`Event::PasteImage`
as designed here carries an already-decoded `ColorImage`. Bridging that
needs
either an async event payload or a deferred/queued event on `AppRunner`
— more of
a design decision than a small mirrored addition, flagging it rather
than guessing.

* Related: #2108 (not fixed: web)

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2026-09-01 17:00:43 +00:00
..
2026-08-26 06:09:32 +00:00