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

Winapi: Image should use CF_BITMAP? #1

Closed
DoumanAsh opened this issue Sep 6, 2020 · 5 comments
Closed

Winapi: Image should use CF_BITMAP? #1

DoumanAsh opened this issue Sep 6, 2020 · 5 comments

Comments

@DoumanAsh
Copy link
Contributor

JFYI you can get image by using high level format type https://docs.rs/clipboard-win/4.0.2/clipboard_win/formats/struct.Bitmap.html
It is to be used within context of opened clipboard.

See Getter/Setter traits.
If you want you can add CF_DIB to code by making PR
There are also shortcut functions that open/close clipboard and get data to owned data structure if you don't need to efficiently re-use buffers https://docs.rs/clipboard-win/4.0.2/clipboard_win/fn.get_clipboard.html

@ArturKovacs
Copy link
Collaborator

I tried using the Bitmap format but it seems to me that it doesn't support alpha so I figured it's easier if I just re-implement that myself.

The reason for me separating the clipboard opening and the data transfer is to be able to tell if the error was because the clipboard is being used or if it's because the data cannot be transferred.

@DoumanAsh
Copy link
Contributor Author

Yes, that's correct CF_BITMAP doesn't allow you to store alpha channel.
But afaik most, programs, if not all, are not able to work with it properly also.

@ArturKovacs
Copy link
Collaborator

Emulsion is 😁

@DoumanAsh
Copy link
Contributor Author

Ah, I see.
As side note I suggest to take a look at how Firefox and other applications register PNG format and copy/paste in PNG format.
It might be even better option for image viewer

@ArturKovacs
Copy link
Collaborator

Thanks, should be useful for large image files. I opened #2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants