|
1,
//create surface
result = d3ddev->CreateOffscreenPlainSurface(
info.Width, //width of the surface
info.Height, //height of the surface
D3DFMT_X8R8G8B8, //surface format
D3DPOOL_DEFAULT, //memory pool to use
&surTest2, //pointer to the surface
NULL); //reserved (always NULL)
if (result != D3D_OK) return NULL;
//load surface from file into newly created surface
result = D3DXLoadSurfaceFromFile(
image, //destination surface
NULL, //destination palette
NULL, //destination rectangle
filename.c_str(), //source filename
NULL, //source rectangle
D3DX_DEFAULT, //controls how image is filtered
D3DCOLOR_XRGB(0,0,0), //for transparency (0 for none)
NULL); //source image info (usually NULL)
2,使用
d3ddev->StretchRect(surTest2, NULL, backbuffer, &rc, D3DTEXF_LINEAR);
显示出来..
结果已经显示出来了。但是有两个问题。
a,原来的图片是1.png,这个png是有透明色的。结果透明色变成了黑色。
b , 图片边缘不对了。。。。。
|
|