Allegro 4.2.1,去除bmp背景色
我一直在 allegro 4.2.1 中构建游戏,需要帮助删除特定颜色以使其不可见。背景颜色为(255,0,255)。我访问过以下网站,但它们对我帮助不大:
http://www.allegro.cc/forums/thread/599210" allegro.cc/forums/thread/599210, http://www.cpp-home.com/tutorials/258_1.htm
如果有人能为我提供一个例子,我将非常高兴。
I have been building a game in allegro 4.2.1 and need help to remove a specific color to make invisible. The background color is, (255, 0, 255). I have been at the following sites, but they have not helped me much:
http://www.allegro.cc/forums/thread/599210,
http://www.cpp-home.com/tutorials/258_1.htm
If someone could provide me with an example, I would be very glad.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要执行以下操作才能启用透明像素:
在调用
set_gfx_mode()
之前调用set_color_depth(32)
调用
set_gfx_mode()
后加载图像使用
masked_blit()
或draw_sprite()
绘制图像。如果执行上述操作,所有“幻粉色”像素(100% 红色、0% 绿色、100% 蓝色)都将被视为透明。
You need to do the following things to enable transparent pixels:
Call
set_color_depth(32)
before callingset_gfx_mode()
Load your images after calling
set_gfx_mode()
Use
masked_blit()
ordraw_sprite()
to draw the image.If you do the above, all "magic pink" pixels (100% red, 0% green, 100% blue) will be treated as transparent.