Skip to main content
GameDev.net gamedev.net
🔒 Locked

Load surface from file?

Started by Abob Feb 22, 2003 at 9:33 PM 0 replies 1.8k views
Original Post
Abob
Abob
I need a way to load an image file on to an ID3DSurface8. Looking in the DX Help I fond the function D3DXLoadSurfaceFromFile. The problem is that I do not understand how to use the function. I need to it to convert the format of the image from whatever format the file is in, to a specified format for the ID3DSurface8 (Like D3DXCreateTextureFromFile). Thanks for any help
Arrg!!
DarkPixel
DarkPixel
Here is the prototype function :

HRESULT D3DXLoadSurfaceFromFile(
LPDIRECT3DSURFACE8 pDestSurface,
CONST PALETTEENTRY* pDestPalette,
CONST RECT* pDestRect,
LPCTSTR pSrcFile,
CONST RECT* pSrcRect,
DWORD Filter,
D3DCOLOR ColorKey,
D3DXIMAGE_INFO* pSrcInfo
);

pDestSurface is just a pointer to a surface object
pDestPalette unless you are using 8-bit images, you should leave
this one to NULL
pDestRect size of the image. just set it to NULL
pSrcFile filename of the image
pSrcRect set it to NULL
Filter image filtering mode, set this to D3DX_DEFAULT
ColorKey if you don''t want colorkeys just set it to 0
pSrcInfo unless you want information on the image, you can
set this to zero


Here is a sample declaration :
D3DXLoadSurfaceFromFile( pSurf,
NULL,
NULL,
"your_image.bmp",
NULL,
D3DX_DEFAULT,
0, NULL );

Easy heuh !

There is no problem, only solutions...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.