Need some help with Windows bitmaps...

BlitzPlus Forums/BlitzPlus Programming/Need some help with Windows bitmaps...

"I have coded a lot with Windows GDI, but I am not sure I understand what your question really is."


I am trying to put a image on the screen which I can scale using GDI commands.

Here's what I need to do:

First, I need to make a DIB which is visible in my window. It needs to be clipped by a panel.

Second, I need to know how to create a DIB in memory. I need to know how to write pixels to it, and how to copy the device context of a canvas to it.

Third, I need to know how to make a second smaller DIB in memory which I can scaleblt the first to to make a smaller copy of the image I want to display.

And finally, I need to know how to bitblt the smaller DIB to the DIB on the screen.

I guess I also need to know how to change the size of the DIB on the screen, or at least, how to free it and create a new one.


This is why I need to do this:

I am making a program that displays a texture. I want the user to be able to zoom in and out of this texture.

But on top of this zoomed texture, I want to draw a polygon, and I don't want the polygon to also be scaled.

So, what I need to do in simple terms is load an image, make a copy of it, scale the copy down, draw a polygon on top of the scaled copy, then copy the scaled copy to the screen.


I can't do this with Blitz commands because it is too slow, even with a custom image scaling function I wrote that only scales images in multiples of the original size.

But I found that I can scale a canvas with GDI commands and the image scales instantly. So I'm guessing that if I use the GDI commands to do the scaling, it will use hardware acceleration to do it and be very fast.