error C2065: 'dbGetImagePointer' : undeclared identifier
and indeed the only function with the word Pointer in its name in the image header is dbGetPointer() which does return a dx9 texture
So i guess this is just one of those weirdly named function thingys going on (im still using darksdk 1.0 here, collision kthx)
Well i have been talking with apex in the channel, we attempted to fix it but still to no avail. Its because the textures arnt being created with the D3DPOOL_DEFAULT flag (as far as we can tell). I tried to make my own textures specifying that flag using the dbMakeUsage() (me and apex are just GUESSING at what we can use these functions for, that doesnt help things) and then copying the image data from the src/dst into these new textures, performing the paste and copying the temp dest back to the original dest. It didnt work.
Still the same memory pool error in the output window, apprantly now my rects are invalid which is BS as i didnt change them oh and i get an assertion at the end now
joy!
for those that would care to see it, my second attempt at the function:
void PasteImageToImage(int Src, int Dest, int x, int y) {
IDirect3DSurface9 *SrcSurface;
IDirect3DSurface9 *DestSurface;
IDirect3DDevice9 *Dev;
LPSTR TempSrc, TempDest;
DWORD SrcSize, DestSize;
DWORD SrcW, SrcH, DestW, DestH, SrcBPP, DestBPP;
RECT SrcRect, DestRect;
Dev = dbGetDirect3DDevice();
SrcSize = dbGetWidthImage(Src) * dbGetHeightImage(Src) * 32;
DestSize = dbGetWidthImage(Dest) * dbGetHeightImage(Dest) * 32;
TempSrc = (LPSTR)malloc(SrcSize);
TempDest = (LPSTR)malloc(DestSize);
dbMakeUsage(TEMP_SRC, dbGetWidthImage(Src), dbGetHeightImage(Src), D3DPOOL_DEFAULT);
dbMakeUsage(TEMP_DEST, dbGetWidthImage(Dest), dbGetHeightImage(Dest), D3DPOOL_DEFAULT);
dbGetImageData(Src, &SrcW, &SrcH, &SrcBPP, &TempSrc, &SrcSize, false);
dbSetImageData(TEMP_SRC, SrcW, SrcH, SrcBPP, TempSrc, SrcSize);
dbGetImageData(Dest, &DestW, &DestH, &DestBPP, &TempDest, &DestSize, false);
dbSetImageData(TEMP_DEST, DestW, DestH, DestBPP, TempDest, DestSize);
SrcRect.left = 0;
SrcRect.top = 0;
SrcRect.right = dbGetWidthImage(Src);
SrcRect.bottom = dbGetHeightImage(Src);
DestRect.left = x;
DestRect.top = y;
DestRect.right = x + dbGetWidthImage(Src);
DestRect.bottom = y + dbGetHeightImage(Src);
dbGetPointer(TEMP_SRC)->GetSurfaceLevel(0, &SrcSurface);
dbGetPointer(TEMP_DEST)->GetSurfaceLevel(0, &DestSurface);
if (Dev->StretchRect(SrcSurface, &SrcRect, DestSurface, &DestRect, D3DTEXF_NONE) == D3DERR_INVALIDCALL)
MessageBox(NULL, "D3DERR_INVALIDCALL", "Error", MB_OK);
dbGetImageData(TEMP_DEST, &DestW, &DestH, &DestBPP, &TempDest, &DestSize, false);
dbSetImageData(Dest, DestW, DestH, DestBPP, TempDest, DestSize);
free(TempSrc);
free(TempDest);
//(ERROR) :D3DPOOL_DEFAULT must be set for surfaces passed to StretchRect and ColorFill
}
I dont know which of my two attempts was closer to reaching the goal or if both of them are miles off. This is just SO frustrating. Has no one ever wanted to create a texture on the fly fast enough to be used at runtime before? :/ I would give my right hand to see a ImageToImage function in dgsdk/dbp T_T
Im trying to avoid memblocks because although editing the data in them is fast as hell I find creating memblocks and then creating objects (like images) from them is not fast enough to do in any large amount during runtime.
What do people suggest I do? Give up? Any other ideas? I guess i could try and do the pixel pushing method you just mentioned Ian. Setting the Lock parameter of dbGetImageData() should allow me to manually access the data in the pointer right? That might be fast enough.
Right now im narrowing my eyes both at MS for making surface to surface copying such a darn pain and slightly narrowing at tgc for the lack of this functionality - though i sympathise and cant blame them, I can see first hand by doing this perhaps why we dont have this functionality --;
[07:16:59-pm] « Sephnroth » you were dreaming about lee...
[07:17:13-pm] « Mouse » stfu
[07:17:22-pm] « Mouse » he was hanging himself lol