如何使用 Ruby 使用 Win32 的 BitBlt?
有谁知道如何使用 Ruby 使用 Win32 的 BitBlt() ?看起来您需要使用目标 DC(设备上下文),Ruby 如何处理这个问题?我使用 GetPixel() ,即使获取 100 个像素也非常慢(大约需要 10 秒)。谢谢。
Does anyone know how to use Win32's BitBlt() using Ruby? It seems like you need to use a destination DC (device context) and how can Ruby handle that? I use GetPixel() and it is really slow even to get 100 pixels (takes about 10 seconds). thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
第二个 Carl 的其他帖子:使用 win32 屏幕截图 http://github.com/jarmo/win32screenshot
Second Carl's other post: use win32 screenshot http://github.com/jarmo/win32screenshot
如何用 C++ 将所有图像处理代码编写为 Win32 可执行文件,并将其作为单独的进程启动,或者使用 Win32API 类?这样做是有意义的,而不是用 Ruby 编写一个永远不会表现良好的程序。
How about writing all of your image processing code in C++ as a Win32 executable and launching it as a separate process or calling into it from Ruby using the Win32API class? It makes sense to do it this way instead of writing a cludge in Ruby which will never perform as well.
我只想指出我也看到了类似的事情。 GetPixel 在 Vista 上非常慢。我确定当你使用 Aero 的时候就是这种情况。如果您将桌面主题设置为“经典”设置之一,速度又会很快。不管你信不信,OP 估计的大约 10 秒并没有错。确实是非常慢。
我也在寻找 Ruby 中的 BitBlt。我希望我需要弄清楚/写出来,但希望其他人已经发布了一个例子。
I'd just like to note that I'm seeing a similar thing. GetPixel is exceedingly slow on Vista. I've determined that this is the case when you're using that Aero thing. If you set desktop theme to one of the "Classic" settings, it's fast again. And the OP's estimate of ~10 seconds is not wrong, believe it or not. It's really exceedingly slow.
I, too, am looking for a BitBlt in Ruby. I expect I'll need to figure it out/write it, but was hoping someone else has already posted an example.
我不会像艾德那样走得太远。您很可能只想做一些普通 GUI 会做的相对简单和常见的事情。为此,此类库已经存在并且不需要编写。
一个例子是 wxRuby。
恐怕我不熟悉它,但也许它已经提供了一些屏幕抓取实用方法。
I wouldn't go quite as far as Ed; chances are you only want to do some relatively simple and commonplace things that a normal GUI would do. For this, such libraries already exist and don't need to be written.
One example would be wxRuby.
I'm afraid I'm not familiar with it, but maybe it already offers some screen-grabbing utility methods.