PDA

View Full Version : Still trying to create overlays



sekelsenmat
25-06-2007, 05:54 AM
Hello,

I am writing a screen magnification tool using overlays. To do this I opted to use DirectDraw (because it's the only way I found to do it). I have basically tryed everything, and nothing seams to work.

Here is what I tryed so far: So I create my overlay surface, but doing this will always fail on my computer (and many others I tested) unless I use YUV color mode. Any attempts to create a RGB overlay surface fail with $88760091 Invalid Pixel Format, regardless of using 16 bits 5-5-5, 5-6-5 or 32-bits.

But then trying to use GetDC on the overlay canvas will fail with 88760249 Can't create DC

So, I tryed to go around this, created a memory surface, use GetDC on it, draw to it, and tryed to use Blt to copy it's contents to the overlay, then I get: $887601AE Surface Busy

So I thougth, ok, I will try to use UpdateOverlay to copy the contents of the memory surface to my overlay. Now this works, or at least I see something on the screen. But this is a corrupted image! Nothing really distinguable, I can only see that this is partially working because it changes when it should.

So I thougth: Maybe this happens because my memory surface was created without pixel mode, let's create a memory surface with YUV pixel mode! That also fails, with $88760091 Invalid Pixel Format

Any ideas??? thanks a lot,

Here is my full code:

http://magnifier.cvs.sourceforge.net/magnifier/magnifierv3/libraries/pas_overlays/pas_overlays.dpr?revision=1.4&view=markup

PS: The demo on the other page I posted only draws a black square, and my problem is that I can't draw anything better then a rectangle to the overlays.

sekelsenmat
25-06-2007, 04:03 PM
I made it .... it was terribly hard, but I found a way to make the overlays work.

It looks insane, but you really need to manually convert between RGB and the different types of YUV.

For people very interrested here is the full source:

http://magnifier.cvs.sourceforge.net/magnifier/magnifierv3/libraries/pas_overlays/pas_overlays.dpr?revision=1.6&view=markup

I am thinking about documenting this on my just created blog too.

imcold
01-07-2007, 06:31 AM
Overlays are meant to store yuv data and perform yuv -> rgb conversion, so it's not really insane...