How to surface-GetDc() success?

Started by
3 comments, last by lubiancao12 15 years, 9 months ago
hi, i use directdraw to play video. so i create primary surface and offscreen surface. The primary surface is not FULLSCREEN. the offscreen format is UYVY. all things are ok. NOw i want to write "text" on the video. so i hope to get the offscreen surface dc. but OffscreenSurface->getDc() is fail. i have a test ,OffscreenSurface->getDc() will be ok if the surface format is RGB. but you know ,i can't change the format . how can i do to getdc with the uyvy? thanks!
Advertisement
From the documentation for IDirect3DSurface9:

"GetDC is valid on the following formats only: D3DFMT_R5G6B5, D3DFMT_X1R5G5B5, D3DFMT_R8G8B8, and D3DFMT_X8R8G8B8."

It would appear you can't use UYVY.

The likely cause of the restriction is that GetDC uses GDI and GDI doesn't support non-RGB formats.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

ok,thanks
but i need to write "something" or paint "something" on the UYVY surface, how can i do? anybody have good idears ?
You can probably do a ::LockRect() if the resource is in the correct pool. You could then do a manual blit from a GDI-compatible RGB surface to your UYVY surface.

Alternatively, you can use regular D3D rendering to draw a semi-transparent primitive over the top of your video feed with the text on. Chances are this will be more performant as locking/modifying resource memory directly tends to be quite slow...

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

thank you
i made it.

This topic is closed to new replies.

Advertisement