GrabImage

BlitzMax Forums/BlitzMax Beginners Area/GrabImage

JBR(Posted 2015) [#1]
Hi, using these commands to copy a 64x64 image from the screen.

It appears to be incredibly slow. About 4ms each on my pc.

I've tried GrabPixmap but it's the same.

Any ideas for a faster solution?

Jim


Derron(Posted 2015) [#2]
Software creation of the image instead of grabbing it from the gpu.

So instead of

DrawImage(bla)
DrawImage(blubb)
GrabPixmap

You create a new image and loop over the images pixel data and copy the desired one to the new one.
For DrawOval etc you will have to use custom functions doing the same thing in "software" (bresenham algorithm for lines etc.).

Another option is "render to texture" - there might be some still working solutions flying around in the forums... but often only for OpenGL.


bye
Ron


zoqfotpik(Posted 2015) [#3]
This has to be one of the most discussed subjects here (usually I am the instigator.)

Derron's solution sounds really slow but it's actually not that bad. One handy thing you can do is virtual resolution-- draw to an array instead of a bitmap, then turn that array into an image and stretch it to fit your viewport. There are also all kinds of crazy cycling effects and other things you can do.


Derron(Posted 2015) [#4]
You can use a TPixmap similar to your array ... so this is imho the same.

Even with your array you will need to wirte your "DrawOval" and "DrawRect" functions to fill individual pixels / array entries.


bye
Ron


zoqfotpik(Posted 2015) [#5]
Does anybody actually use DrawOval?


Derron(Posted 2015) [#6]
Or DrawRect?

I use - to draw colored ovals below an "antenna" on a channel map.

But for drawing on images I just need multiple blend modes and "draw image on image" functionality.


bye
Ron


zoqfotpik(Posted 2015) [#7]
Do you find DrawOval to be slow? How does it compare to DrawRect?


Derron(Posted 2015) [#8]
I am talking about functions drawing on pixmaps/ filling arraydata.

bye
Ron