cHoIcE lEe
2005-04-07 13:17:09 UTC
I have a Image called button.bmp with fomat RGB of 24bit. In the Image, a
button is surrounded by an area in color gray(RGB(125,125,125)).
I want to show the button in my app without the gray area so that firstly I
create a surface named pSurface with function CreateOffscreenPlainSurface()
and secondly I load the Image in with function D3DXLoadSurfaceFromFile().
Finaly, I copy the data in pSurface to BackBuffer with function
D3DXLoadSurfaceFromSurface(). I pass the para ColorKey with value
D3DCOLOR_ARGB(0xff, 125,125,125) .
But the function D3DXLoadSurfaceFromSurface() did not funtioned as I
expected. In my app, The area surround the button was still there which just
turn into BLACK!
I have try several values for para ColorKey in function
D3DXLoadSurfaceFromFile() and D3DXLoadSurfaceFromSurface(), for instance, 0,
D3DCOLOR_ARGB(0, 125,125,125), but it does not help. The area surround the
button is always there in case sometimes it is gray and sometime it is black.
I have read the DirectX9 document which says ColorKey is not directly
surport in DirectX9. Following the document, I have tried a lot of
SetRenderState()s. But it takes no effect.
I am going crazy about this. Who knows how to make the thing work?
button is surrounded by an area in color gray(RGB(125,125,125)).
I want to show the button in my app without the gray area so that firstly I
create a surface named pSurface with function CreateOffscreenPlainSurface()
and secondly I load the Image in with function D3DXLoadSurfaceFromFile().
Finaly, I copy the data in pSurface to BackBuffer with function
D3DXLoadSurfaceFromSurface(). I pass the para ColorKey with value
D3DCOLOR_ARGB(0xff, 125,125,125) .
But the function D3DXLoadSurfaceFromSurface() did not funtioned as I
expected. In my app, The area surround the button was still there which just
turn into BLACK!
I have try several values for para ColorKey in function
D3DXLoadSurfaceFromFile() and D3DXLoadSurfaceFromSurface(), for instance, 0,
D3DCOLOR_ARGB(0, 125,125,125), but it does not help. The area surround the
button is always there in case sometimes it is gray and sometime it is black.
I have read the DirectX9 document which says ColorKey is not directly
surport in DirectX9. Following the document, I have tried a lot of
SetRenderState()s. But it takes no effect.
I am going crazy about this. Who knows how to make the thing work?