PDA

View Full Version : C++ fast itmap resizing/blitting algorithm



tiberiu11
05-01-2014, 07:40 AM
Hello,

I am not sure where to post this, so I apologize if it is posted in the wrong place.

I need the fastest blitter algorithm for C++, I have a bitmap stored as RGB data, which I need to resize, most of the time scale down. Can someone please help me?
I need to do this every frame, so I need the fastest possible solution.

Brokenmind
05-01-2014, 08:47 AM
1) Do you need to save the image in every frame, or do you simply need to display it?
2) How would you like to resize it, pixelated or interpolated?

tiberiu11
05-01-2014, 01:13 PM
Hello,

I save a different image each frame, think of what I am doing like FRAPS, but I need to resize the display each frame, the contents are different.

2) I would like it interpolated, not the best algorithm, but certainly not the worst. A compromise would be OK for me.
I currently use CreateDIBSection along with StretchDIBits, but performance is not as good as I need it to be.

Brokenmind
05-01-2014, 02:59 PM
The certainly fastest way would be drawing your texture via openGL onto another texture of a different size (renderToTexture) which you can then read from the graphics memory. Only disadvantage would be the restricted influence on the interpolation algorithm, i.e. interpolated or not (pixelated). A shader lets you define own algorithms that suit your needs. I guess this will be much better (in many ways) than using WinAPI :D