如何获得透明的窗口对话框和绘图基元以保留在正在绘制流视频的窗口顶部?

发布于 2024-08-20 02:03:27 字数 687 浏览 9 评论 0原文

我有一个 ActiveX 控件,其中包含一个窗口,其中有流视频被绘制到其中。我在另一个窗口中创建了一个单独的对话框,我以各种方式将其设置为透明或半透明(即使用 SetLayeredWindowAttributes(...) 以及对话框的分层属性 [用于 alpha 混合] 或设置透明财产)。

此外,我尝试使用各种方法来尝试让对话框窗口始终在流视频窗口顶部绘制,但没有一个方法被证明对我有用。如果我在对话框上有一个按钮或使用 LineTo(...) 调用在透明表面上绘制,它们不会保留在视频顶部。我尝试使用 SetWindowPos 来影响两个窗口的 z 顺序,并尝试更改对话框窗口属性,例如“TopMost”,但没有效果。

有没有人尝试过对流视频上的重叠窗口执行类似的操作,并让 z 顺序始终在流视频之后绘制前窗?

更新:02/10/10 - 尝试使用 LWA_COLORKEY 将 WS_EX_LAYERED 属性与 SetLayeredWindowAttributes(...) 一起使用,并实现了我正在寻找的目标。由于分层属性不能与 WS_CHILD 样式一起使用,因此该解决方案带来了一些与视频窗口相关的覆盖窗口位置所需的管理。此外,我还试图消除其他一些奇怪的现象。例如,当带有视频的 ActiveX 控件窗口嵌入到 IE 选项卡中并且我切换到另一个选项卡时,覆盖窗口上的控件仍保留在新选项卡的顶部(当使用 WS_POPUP 样式时)。仍在研究是否有其他方法来处理此问题,然后确定开关并隐藏窗口可见性。

I have an activeX control that contains one window that has streaming video being drawn to it. I have a separate dialog that I create in another window that I have made transparent or semi-transparent in various ways (i.e. using the SetLayeredWindowAttributes(...) along with the Layered property [for alpha blending] of the dialog or setting the transparent property).

Additionally I've tried to use various methods to attempt to get the window for the dialog to always draw on top of the streaming video window but none have proved to work for me. If I have a button on the dialog or draw on the transparent surface with LineTo(...) calls they don't remain on top of the video. I have tried to use SetWindowPos to affect the z-order of the two windows and also tried to change the dialog window properties such as "TopMost" but with no avail.

Has anyone tried to do something like this for an overlaid window over streaming video and gotten the z-ordering to work at painting the front window always after the streaming video?

UPDATE: 02/10/10 - tried using WS_EX_LAYERED property with SetLayeredWindowAttributes(...) using LWA_COLORKEY and achieved what I was looking for. Since layered property cannot be used with WS_CHILD style this solution brings with it some required management of the overlay window position with respect to the window with video. Additionally there are some other oddities I am trying to eliminate. For instance, when activeX control window with video is embedded in an IE tab and I switch to another tab controls on the overlay window remain on top the new tab (when WS_POPUP style used). Still investigating if there will be alternative means of dealing with this other then determining the switch and hiding the window visability.

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

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

发布评论

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

评论(2

千纸鹤带着心事 2024-08-27 02:03:27

这可能是不可能的,许多视频输出代码都使用硬件覆盖层,因此如果您的窗口位于前面,则覆盖层要么不起作用,要么根本不会在像素所在的位置绘制。

硬件覆盖允许视频绘制代码以当前显示格式以外的格式呈现帧,这可以节省大量CPU和内存带宽。

根据我的经验,叠加层通常采用 YUV 格式而不是 RGB,因为许多视频压缩格式都是基于 YUV 的。因此,视频硬件从 YUV 图像而不是从屏幕缓冲区获取一些像素,因此除非您将自己插入到视频流的渲染代码路径中,否则您无法影响这些像素。

This may not be possible, a lot of video output code makes use of hardware overlays so if your window is in front, the overlay either won't work, or won't draw where your pixels are at all.

Hardware overlays allow the video drawing code to present frames in a format other than that of the current display format, which can save a lot of CPU and memory bandwidth.

In my experience, the overlay is usually in YUV format rather than RGB because many video compression formats are based on YUV. So the video hardware is getting some pixels from a YUV image and NOT from the screen buffer, so you can't affect these pixels unless you get yourself inserted into the rendering code path of the video stream.

独﹏钓一江月 2024-08-27 02:03:27

使用 LWA_COLORKEY 的 SetLayeredWindowAttributes(...) 的 WS_EX_LAYERED 属性将在使用 colorkey 的情况下实现透明度。透明覆盖层保留在视频前面,活动的流媒体视频保持实时状态。 WS_CHILD 样式不能与分层样式一起使用,因此如果使用 WS_POPUP,则窗口位置需要额外的管理。由于无法将覆盖层作为子窗口,可能会出现其他问题。 - 请参阅 Q 更新。

WS_EX_LAYERED property with SetLayeredWindowAttributes(...) using LWA_COLORKEY will achieve transparency where colorkey is used. Transpaerent overlay remains in front of video and active streaming video remains live. WS_CHILD style cannot be used with layered style and therefore window position requires additional management if WS_POPUP is used. Additional issues may arise from inability to have overlay as a child window. -see Q update.

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