编写一个RDP客户端以转储屏幕像素 [英] Write an RDP client that dumps the pixels of the screen

查看:129
本文介绍了编写一个RDP客户端以转储屏幕像素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在C++中实现一个RDP客户端,该客户端能够获取屏幕上所有像素的颜色值并将其转储到文件中.我知道这在概念上与RDP的工作方式不同,但我的应用需要它.我正在尝试使用 freerdp ,但是我不确定如何有效地编写一个仅将所有像素转储到客户端的客户端.文件.

I would like to implement a RDP client in C++ that is able to get the color value of all pixels of the screen and dump them to a file. I know this is conceptually different from how RDP works but I need it for my application. I am trying to make use of freerdp but I am not sure how can I efficiently write a client that simply dumps all pixels in a file.

到目前为止,我最好的尝试是利用函数gdi_GetPixel_32bpp,但是,当然,依次为每个像素调用此函数的效率很低.

So far my best attempt is making use of the function gdi_GetPixel_32bpp but of course calling this function for each pixel in turn is far from efficient.

一个使用另一个库的解决方案也将不胜感激.

A solution that makes use of another library will also be greatly appreciated.

推荐答案

使用libfreerdp-gdi以非常有效的方式进行此操作应该相当容易. FreeRDP可以将所有内容渲染到软件缓冲区中,然后将其转储到文件中,并且您可以根据需要完全在内存中完成此操作,而无需使用X11环境.自从提到Linux以来,一种快速的入门方法是将xfreerdp与/gdi:sw选项一起使用以使用libfreerdp-gdi(默认为使用基于X11的实现),然后将像素作为更新转储.您可以将自己挂在xf_sw_end_paint中,在更新数组的末尾调用它.您可以访问无效区域和像素缓冲区(都在rdpGdi * gdi结构下).重要字段是gdi-> primary_buffer,gdi-> dstBpp,gdi-> bytesPerPixel,gdi-> width和gdi-> height.在大多数情况下,您将获得一个易于处理的XRGB32缓冲区.毫无疑问,请看一下gdi_init()来初始化内部缓冲区.

This should be fairly easy to do in a very efficient way using libfreerdp-gdi. FreeRDP can render everything to a software buffer which you can then dump to a file, and you can do this entirely in memory, without an X11 environment, if you wish. Since Linux is mentioned, one quick way to get started would be to use xfreerdp with the /gdi:sw option to make use of libfreerdp-gdi (the default is to use an X11-based implementation) and to then dump the pixels as updates come in. You can hook yourself in xf_sw_end_paint, which is called at the end of an array of updates. You have access to the invalid region and the pixel buffer (all under the rdpGdi* gdi structure). Important fields are gdi->primary_buffer, gdi->dstBpp, gdi->bytesPerPixel, gdi->width and gdi->height. In most cases you will get an XRGB32 buffer, which is easy to deal with. In doubt, take a look at gdi_init() for the initialization of the internal buffer.

这篇关于编写一个RDP客户端以转储屏幕像素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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