News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Reversing rectangles

Started by zemtex, January 19, 2011, 05:13:01 PM

Previous topic - Next topic

zemtex

Howdy.

I create a pen multiple times to draw a gradient color in one part of the window and I create pens for doing the same in another part of the window, but it has the opposite direction as the first. My wish is to just draw the upper layer with a pen and then just copy that section in a rectangle, then reverse-draw that rectangle on the other side, I assume that is faster than creating pens and drawing with those pens twice.

My question is, what GDI function can I use to effectively reverse-draw a rectangle of graphics?

You cant reverse x2 and x1 or y2 and y1 when using BitBlt, because it doesnt support x1-x2, it only supports upper left corners, so BitBlt cant be used for that.
I have been puzzling with lego bricks all my life. I know how to do this. When Peter, at age 6 is competing with me, I find it extremely neccessary to show him that I can puzzle bricks better than him, because he is so damn talented that all that is called rational has gone haywire.

dedndave

look into CreateCompatibleDC
you can "pre-draw" everything in that DC, then use BitBlt to put it on the screen

zemtex

I am already buffering it, thats not the problem. It's already finished, I just want to optimize the other half of the gradient.

256 calls to a pen function is much slower than 1 single call to a copy routine if you get me.
I have been puzzling with lego bricks all my life. I know how to do this. When Peter, at age 6 is competing with me, I find it extremely neccessary to show him that I can puzzle bricks better than him, because he is so damn talented that all that is called rational has gone haywire.

qWord

FPU in a trice: SmplMath
It's that simple!