• Advertisement
Sign in to follow this  

How to surface-GetDc() success?

This topic is 3512 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
ok,thanks
but i need to write "something" or paint "something" on the UYVY surface, how can i do? anybody have good idears ?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement