问题
Follow up from: Directdraw: Rotate video stream
I managed to preview the camera's video stream, but the image is rotated by 90° to landscape mode. I'm now searching for a way to rotate the camera image back to normal, but the problem is I don't even know where to start: Is this done in the VideoCaptureFilter, the VideoInfoHeader, in a DDSURFACEDESC structure? Can the rotation only be done by using an additional filter? Is it a filter setting?
回答1:
I found out that this is usually done with the BI_SRCPREROTATE flag:
A special flag was developed (BI_SRCPREROTATE) which tells GDI and the video renderer that the orientation of the image from the camera is in the correct orientation (don't rotate when rendering it). This is necessary because as you rotate the shell on the device you also physically rotate the device. When the display driver rotates bitmaps to render the shell and UI it needs to know that this particular bitmap shouldn't be rotated. The flag is or'd into the biCompression field in the BITMAPINFO structure.
From http://www.tech-archive.net/Archive/PocketPC/microsoft.public.pocketpc.developer/2005-12/msg00850.html
Sample code might look like this:
pVih->bmiHeader.biCompression &= ~BI_SRCPREROTATE;
From http://innovator.samsungmobile.com/bbs/discussion/view.do?parentCategoryId=4&messageId=45549&boardId=224&platformId=2
This method however is not working with the HTC HD2 I am using, but it might work with other devices, so I decided to add this to my question.
来源:https://stackoverflow.com/questions/2318390/windows-mobile-directdraw-rotate-video-stream