关于DirectDraw创建表面
DDSURFACEDESC2 ddsd;
ZeroMemory(&ddsd, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN|DDSCAPS_VIDEOMEMORY;
ddsd.dwFlags = DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT;
ddsd.dwWidth = dwWidth;
ddsd.dwHeight = dwHeight;
ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC|DDPF_YUV;
ddsd.ddpfPixelFormat.dwYUVBitCount = 8;
ddsd.ddpfPixelFormat.dwFourCC = MAKEFOURCC('I','4','2','0');
hr = m_pDirectDraw->CreateSu易做图ce (&ddsd, &m_pSu易做图ceOffScreen, NULL);
为什么hr返回的不是DD_OK?我赋值不对吗?
如果为以下几种情况则返回的是DD_OK:
ddsd.ddpfPixelFormat.dwYUVBitCount = 8;
ddsd.ddpfPixelFormat.dwFourCC = MAKEFOURCC('Y','V','1','2');
ddsd.ddpfPixelFormat.dwYUVBitCount = 16;
ddsd.ddpfPixelFormat.dwFourCC = MAKEFOURCC('U','Y','V','Y');
ddsd.ddpfPixelFormat.dwYUVBitCount = 8;
ddsd.ddpfPixelFormat.dwFourCC = MAKEFOURCC('N','V','1','2');
这是为什么呢?(在显示之前创建m_pSu易做图ceOffScreen,所以和YUV数据类型没关系)。
补充:VB , 多媒体