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.
问题
像素颜色格式为 RGB 的图像,读取后透明通道为 0,这和 ege 中的 RGB 颜色 alpha = 0xFF 的颜色表示不符,导致 putimage_withalpha() 无法绘制出图像。
EGE 中的像素颜色格式为 ARGB, 对于不含透明通道的图像,加载后 Alpha 应以 0xFF 填充。
实现
ege 中非 PNG 图片使用 OleLoadPicture() 接口加载,然后从 IPicture 对象中解析出图像数据,但这个 IPicture 无法判断图像是否具有透明通道,因此非 PNG 图像改为使用 GDI+ Bitmap 实现图像读取。
PNG 格式:(由 libpng 读取)
0xFF
填充非 PNG 格式:
0xFF
)性能
本地测试读取速度有 4~10 倍提升,可能是原来的接口解析速度太慢。