Copy image to clipboard #995
Labels
No labels
Blocked
Bug
Documentation
Duplicate
Enhancement
Good first issue
Help wanted
Idea
In progress
Invalid
Major feature set
Packaging
Question
Soon
UI/UX
Upstream
You're dreamin'
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nostr/gossip#995
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Images start as a URL.
The 'Fetcher' then handles it and moves it through these states: Starting, CheckingCache, LoadingFromCache, Queued, Fetching, Ready, Taken, Failed. These states are so that subsequent calls to the Fetcher don't start over and fetch it yet-again. This consults a local file cache and then gets it from the network.
Then the media handler hashes the data and compares it to any file metadata that was specified to see if the hash matches what was expected.
Then it scales the image and converts SVGs into images and makes this result available for the UI as an RgbaImage.
The UI then takes the image and turns it into a UI-friendly ColorImage which is loaded to the GPU, and the UI remembers just a TextureHandle.
The UI can now draw it with the TextureHandle as needed. When the UI draws it, it also draws the menu that lets you copy the URL (which it remembered).
In order to add "Copy Image to Clipboard" there will need to be sigificant refactoring because you'll want the original bytes before the media handler scaled and converted the data for rendering purposes back in step 3, which the UI never sees currently (it is part of the lib media handler, which I admit is wrong) and also the UI dropped the bytes itself as soon as it got a TextureHandle (it never needed to keep the bytes so far, and keeping all the images might hog CPU-side memory unnecessarily).
Copying an image to the clipboard isn't supported in egui 0.30, but luckily it is supported in 0.31. Something like this:
We just have to have a color_image somewhere.
Plan:
cut_paste_image: Option<Vec<u8>>