简体   繁体   English

在BMP中将特定颜色的所有像素转换为透明的最简单方法是什么?

[英]What is the easiest way to convert all the pixels of a specific color to transparent in a BMP?

Looking for the least painful way to grab a Bitmap and translate every pixel of a specific color to transparent. 寻找最轻松的方法来获取位图并将特定颜色的每个像素转换为透明。

In particular, I have set all the pixels I want to be transparent to 0xFF00FF, but I am not seeing any native method that do this. 特别是,我已经将所有想要透明的像素设置为0xFF00FF,但是我看不到任何执行此操作的本机方法。

Do I have to actually loop through all the pixels comparing values? 我是否真的必须遍历所有比较值的像素? And if so, can I change them in place or do I need to make a new bitmap array and create a new bitmap? 如果是这样,我可以在适当的位置更改它们还是需要制作一个新的位图数组并创建一个新的位图?

Bitmaps don't have alpha channels like PNG/GIF. 位图没有像PNG / GIF这样的Alpha通道。 It's up to the application to use a transparency mask. 应用程序要使用透明蒙版。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM