SRCCOPY 从 BITBLITTED IMAGE 中删除透明度

发布于 2024-08-31 03:17:25 字数 370 浏览 7 评论 0原文

BitBlt(meteor.main, 0, 0, meteor.img_width, meteor.img_height, meteor.image,  meteor.mask_x, meteor.mask_y, SRCAND);
BitBlt(meteor.main, 0, 0, meteor.img_width, meteor.img_height, meteor.image,  meteor.img_x,  meteor.img_y,  SRCPAINT);
BitBlt(buffer, 0, 0, 800, 600, meteor.main, 0, 0, SRCCOPY);

我知道前两个 bitblt 可以实现透明度,但第三个将其删除!我在这里做错了什么?

BitBlt(meteor.main, 0, 0, meteor.img_width, meteor.img_height, meteor.image,  meteor.mask_x, meteor.mask_y, SRCAND);
BitBlt(meteor.main, 0, 0, meteor.img_width, meteor.img_height, meteor.image,  meteor.img_x,  meteor.img_y,  SRCPAINT);
BitBlt(buffer, 0, 0, 800, 600, meteor.main, 0, 0, SRCCOPY);

I know the first two bitblts make the transparancy, but the third removes it! What am I doing wrong here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

狠疯拽 2024-09-07 03:17:25

SrcCopy 只是平面复制从源到目标的所有内容。无论您的目的地中存在什么,现在都将包含来自您的来源的所有内容。

我通常这样做的方法是

1) BitBlt(dest.hdc, dest.x, dest.y, width, height, srcMask.hdc, srcMask.x, srcMask.y, MergePaint)

这将本质上是在目的地中以掩模的形式切出一个洞。

2) BitBlt(dest.hdc, dest.x, dest.y, width, height, src.hdc, src.x, src.y, SrcAnd)

这基本上将源代码覆盖在目的地。

如果您的源包含的图像多于您想要覆盖的图像,您可能首先需要使用 SrcPaint 剪掉源周围的所有图像(在步骤 2 之前),如下所示:

1b) BitBlt(src.hdc,src.x,src.y,宽度,高度,srcMask.hdc,srcMask.x,srcMask.y,SrcPaint)

SrcCopy just flat copies everything from source to destination. Whatever was in your destination will now contain everything form your source.

The way I usually do this is

1) BitBlt(dest.hdc, dest.x, dest.y, width, height, srcMask.hdc, srcMask.x, srcMask.y, MergePaint)

This will essentially cut a hole, in the form of the mask, into the destination.

2) BitBlt(dest.hdc, dest.x, dest.y, width, height, src.hdc, src.x, src.y, SrcAnd)

This basically overlays the source on top of the destination.

If your source contains more image than what you want to overlay, you may first want to cut out all that is around your source first (before step 2.) using SrcPaint like this:

1b) BitBlt(src.hdc, src.x, src.y, width, height, srcMask.hdc, srcMask.x, srcMask.y, SrcPaint)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文