1

Ruby で Win32 の GetPixel() を使用してみましたが、Quad Core Intel マシンでも非常に遅いです。たとえば、100 x 10 ピクセル = 1000 ピクセルなどの非常に小さな領域を取得すると、完了するまでに 30 秒かかることがあります。一度にリージョンを取得するなど、より良い方法はありますか?

4

2 に答える 2

1

I think the function you want is BitBlt.

于 2009-12-04T22:36:23.243 に答える
1

I don't know much about Ruby, but isn't it interpreted? If it is and you are invoke a Win32 API call through presumable one of Rubys librarys and on top of that calling GetPixel, well then yes, it would be slow.

If you have access to the Win32 api's through Ruby then you should look into BitBlt. Bit-Block-Transfer which will return a buffer of values rather than individual values. This will be many times faster.

Of course, now you have to deal with Device Context's, Bitmap structures and raw memory, which are perhaps lower level constructs than Ruby provides for.

http://winprog.org/tutorial/bitmaps.html

于 2009-12-04T22:38:48.433 に答える