I'm writing a mirror driver that is able to capture the display of the
screen, and send the images to the remote machine through network, and
then project them onto the remote screen. just like what netmeeting
does. most of display were projected onto the remote screen correctly.
But some images weren't. Especially, when I played a video, the clip
was projected onto the remote monitor, but colors were change. Let me
explain briefly what I have done here. for example, in DrvCopyBits
function, I grab the bitmap in the source surface, psoSrc, and send the
bitmap to remote machine. I create a DIB bitmap in remote machine, and
display it using BitBlt. Now I found that the reason why the color
looks changed in remote machine is RGB orders are different between
color format of device context of remote machine and that of the
bitmap.

I really got stuck here. Where can I find the color format of SURFOBJ
structure, such as RGB masks?

I hope what I wrote won't confuse you. Does any driver masters please
give me some suggestion?

Thanks in advance,

Re: Where can I find the color format of source surface in DrvCopyBits function? by Ivan

Ivan
Sat Oct 15 18:07:57 CDT 2005

From the description this looks the typical 16bpp vs 15bpp
color translation problem.
From the SURFOBJ itself, you cannot guess the encoding.
You should be able to get that from DEVMOD::dmBitsPerPel
in your DrvEnablePDEV.
Then, use BI_BITFIELDS specifying the proper mask when
you use CreateDIBSection.

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


"lee" <lander_gao@yahoo.com> wrote in message
news:1129414619.160629.270700@g47g2000cwa.googlegroups.com...
> I'm writing a mirror driver that is able to capture the display of the
> screen, and send the images to the remote machine through network, and
> then project them onto the remote screen. just like what netmeeting
> does. most of display were projected onto the remote screen correctly.
> But some images weren't. Especially, when I played a video, the clip
> was projected onto the remote monitor, but colors were change. Let me
> explain briefly what I have done here. for example, in DrvCopyBits
> function, I grab the bitmap in the source surface, psoSrc, and send the
> bitmap to remote machine. I create a DIB bitmap in remote machine, and
> display it using BitBlt. Now I found that the reason why the color
> looks changed in remote machine is RGB orders are different between
> color format of device context of remote machine and that of the
> bitmap.
>
> I really got stuck here. Where can I find the color format of SURFOBJ
> structure, such as RGB masks?
>
> I hope what I wrote won't confuse you. Does any driver masters please
> give me some suggestion?
>
> Thanks in advance,
>



Re: Where can I find the color format of source surface in DrvCopyBits function? by lee

lee
Sat Oct 15 20:33:47 CDT 2005

Ivan, Thank you so much for your reply. what made me confused is that
all the bitmaps I captured in source surface are STYPE_BITMAP, 32BPP.
When I got the bitmap in user mode from the mirror driver, for each
pixel, I switched the first two bytes, and then display it on the
screen by using BitBlt. The color turns to be correct. So I think that
I need to specify the proper mask when using CreateDIBSection, just as
what you said. But could you please explain more how to get the mask
information from the driver? From msdn documentation, I just knew that
dmBitsPerPel is DWORD type and specifies the color resolution, in bits
per pixel, of the display device; for example, 4 bits for 16 colors, 8
bits for 256 colors, or 16 bits for 65,536 colors. How can I get the
mask information from it?

Thanks so much for your help,


Re: Where can I find the color format of source surface in DrvCopyBits function? by Ivan

Ivan
Sun Oct 16 13:39:23 CDT 2005

Why do you care about the source ?
If NtGdi is doing something like
EngCopyBits(Dest = TemporarySurface, Source = DeviceSurface)
EngXXX(TemporarySurface)
DrvCopyBits(Dest = DeviceSurface,Source = TemporarySurface);
that is the typical pattern for non suppoted DrvXXX calls,
then, you would not care about the Source SURFOBJ, but just about
the destination SURFOBJ, that is all what your drivers care about.

For the BitFields masks, aren't you specifying them in DEVINFO::hpalDefault
when you call EngCreatePalette(PAL_BITFIELDS) ?

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

"lee" <lander_gao@yahoo.com> wrote in message
news:1129426427.035253.289220@g49g2000cwa.googlegroups.com...
> Ivan, Thank you so much for your reply. what made me confused is that
> all the bitmaps I captured in source surface are STYPE_BITMAP, 32BPP.
> When I got the bitmap in user mode from the mirror driver, for each
> pixel, I switched the first two bytes, and then display it on the
> screen by using BitBlt. The color turns to be correct. So I think that
> I need to specify the proper mask when using CreateDIBSection, just as
> what you said. But could you please explain more how to get the mask
> information from the driver? From msdn documentation, I just knew that
> dmBitsPerPel is DWORD type and specifies the color resolution, in bits
> per pixel, of the display device; for example, 4 bits for 16 colors, 8
> bits for 256 colors, or 16 bits for 65,536 colors. How can I get the
> mask information from it?
>
> Thanks so much for your help,
>



Re: Where can I find the color format of source surface in DrvCopy by mirrdrv

mirrdrv
Sat Nov 05 11:31:02 CST 2005

There is another way to get the bitmasks.
You receive XLATEOBJ* parameter in DrvCopyBits,
DrvBitBlt... - whenever source surface is present.
You may query XLATEOBJ with XLATEOBJ_cGetPalette
API.

--
Best regards,
Lev Kazarkin
http://www.demoforge.com



"lee" wrote:

> Ivan, Thank you so much for your reply. what made me confused is that
> all the bitmaps I captured in source surface are STYPE_BITMAP, 32BPP.
> When I got the bitmap in user mode from the mirror driver, for each
> pixel, I switched the first two bytes, and then display it on the
> screen by using BitBlt. The color turns to be correct. So I think that
> I need to specify the proper mask when using CreateDIBSection, just as
> what you said. But could you please explain more how to get the mask
> information from the driver? From msdn documentation, I just knew that
> dmBitsPerPel is DWORD type and specifies the color resolution, in bits
> per pixel, of the display device; for example, 4 bits for 16 colors, 8
> bits for 256 colors, or 16 bits for 65,536 colors. How can I get the
> mask information from it?
>
> Thanks so much for your help,
>
>