如何控制玩家的绘画 [英] How to control the painting of the player

查看:84
本文介绍了如何控制玩家的绘画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在实时视频上画些东西.我认为最好的方法是处理WM_PIANT事件.

I am trying to draw something on a live video. The best way to do that in my opinion is to handle the WM_PIANT event.

我的目的是使玩家先绘画然后再绘画.这样,我就可以在视频上绘画了. 这意味着我想在每次需要在窗口上绘制新框架然后处理事件之前得到通知.

My purpose is to make the player draw first and after that the application. That way I will be able to draw on the video. It means that I want to be notified each time before we need to paint a new frame on the window and then handle the event.

我使用DirectshowNet,所以我用C#编程(我具有c ++ API的所有接口 已).我了解图形管理器会将某些窗口消息转发到视频渲染器,例如WM_PAINT.

I use DirectshowNet so I am programming in C# (I have all the interfaces the c++'s API has). I understand that the graph manager forward certain window messages to the Video Renderer such as the WM_PAINT.

如何使播放器在应用程序之前而不是之后画框?

How can I cause the player to draw a frame before the application and not after?

推荐答案

WM_PAINT不是最好的方法,而且是错误的方法.

WM_PAINT is not the best way, moreover it is the wrong way.

从DirectShow.NET库中检出DxText示例.它的描述是:

Check out DxText sample from DirectShow.NET library. Its description is:

一个示例应用程序,显示了如何在文本框上叠加文本字符串 数据流.流是从avi文件读取的.

A sample application showing how to superimpose text strings on a datastream. The stream is read from an avi file.

这与您要达到的目标非常接近.另一示例BitmapMixer中显示了一种替代方法:

This is so close to what you are trying to reach. An alternate approach is shown in another sample there, BitmapMixer:

BitmapMixer是如何使用视频在视频上绘制内容的示例 VMR9.

BitmapMixer is an example of how to draw things over a video using VMR9.

此示例主要围绕IVMRMixerBitmap9接口构建. 此接口接受位图作为GDI设备上下文或Direct3D 表面. Direct3D Surface的主要优点是它 启用真正的Alpha透明度. GDI DC不支持 通过使用颜色键控可以实现alpha位图和透明度.

This sample is mainly built around the IVMRMixerBitmap9 interface. This interface accept bitmaps as a GDI Device Context or as a Direct3D Surface. The main advantage of the Direct3D Surface is that it enables the use of true alpha transparency. GDI DC don't support alpha bitmap and transparency is accomplished by using color keying.

此示例使用GDI +动态生成位图.

This sample dynamically generates bitmaps using GDI+.

这篇关于如何控制玩家的绘画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆