How to surface-GetDc() success?
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!
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.
"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.
ok,thanks
but i need to write "something" or paint "something" on the UYVY surface, how can i do? anybody have good idears ?
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement