Repository navigation
fix(clipboard): 复制图片保留透明通道 - #69
Merged
Merged
Conversation
只写 24 位 CF_DIB 时 alpha 被整条丢掉:透明背景的 PNG 粘出来透明区是一片黑 (透明像素 RGB 通常是 0,转 RGB 只是把 alpha 扔掉)。浏览器旧的复制路径本来就 同时提供 PNG 与 DIB,所以这属于 #67 引入的功能退化。 - 剪贴板同时写两种格式:CF_DIB(24 位,给微信/画图/老软件)+ 注册格式 PNG (源是 PNG 用原字节、其它转 PNG,alpha 完整,给 Photoshop/Office/浏览器) - DIB 的透明像素改为合成到白底(不再是丢弃后留原 RGB 的黑块) - 单测:透明合成白底、PNG 载荷原字节直传且 alpha 完好、非 PNG 源转 PNG 实测(写剪贴板后回读):格式含 PNG;PNG 透明区 alpha=0、不透明区 255; DIB 透明区为白。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
是的,之前会丢——只写 24 位
CF_DIB,透明背景的 PNG 粘出来透明区是一片黑(透明像素 RGB 通常是 0,转 RGB 等于把 alpha 扔掉)。浏览器旧路径本来就给 PNG + DIB 两种格式,所以这是 #67 引入的功能退化。修复:剪贴板现在同时写两种格式 ——
CF_DIB(24 位,微信/画图/老软件读)+ 注册格式PNG(源是 PNG 用原字节、其它转 PNG,alpha 完整,Photoshop/Office/浏览器读);DIB 的透明像素改为合成到白底。实测(写入后回读):格式含
PNG;PNG 透明区 alpha=0、不透明区 255;DIB 透明区为白。后端 485 用例全过(+3:透明合成白底 / PNG 载荷保 alpha / 非 PNG 转 PNG);ruff、
check_docs.py通过。