Faster GrabPixmap , GrabToPixmap()

BlitzMax Forums/BlitzMax Programming/Faster GrabPixmap , GrabToPixmap()

grable(Posted February) [#1]
An attempt at an optimized GrabPixmap, GrabToPixmap. Which doesnt allocate a new pixmap every time, and tries to minimize copying.

!! They arent really any faster, except for GrabToPixmap_D3D9 on Windows 7.

Note that it does NOT check for out of bounds! So make sure to stay within the screen
And its made for 32-bit frame buffers, dont try it on anything else ;)


D3D9 Example:

GL Example:



grable(Posted February) [#2]
Hmm, maybe i should have tested this before posting. But on Windows 10 i dont notice any difference between GrabPixmap and GrabToPixmap...

EDIT: Made GrabToPixmap_D3D9 use an offscreen surface, makes it faster than GrabPixmap on windows 7.


gpete(Posted February) [#3]
Grable ,

what is this for? what I am looking for is a method to read the red value of an image file to generate a color map for a blitz3d terrain. I have someone else's example of a terrain colorer. Is that what you are working on?


grable(Posted February) [#4]
Its a GrabPixmap replacement. I thought it would be faster by not allocating anything, but i guess i was wrong :p
Still, one nice thing about it is that it copies into an already existing pixmap, for what thats worth.

read the red value of an image file
You can do that with TPixmap.


grable(Posted February) [#5]
Fixed bug in GrabToPixmap_D3D9 not respecting x,y coords.