It‘s the same with Particle Illusion Software when it saves the alpha and give a choice whether to remove BG color. Here's my code.
[source lang="cpp"]if(S_OK == pRenderSurface->LockRect(&rect,NULL,D3DLOCK_NO_DIRTY_UPDATE)) { DWORD* pColor = (DWORD*)rect.pBits; for( int y = 0 ; y < height ; y++ ) for(int x = 0 ; x < width ; x++ ) { D3DXCOLOR color = pColor[y*rect.Pitch/4+x]; if(color.a > 0) { color.r /= color.a; color.g /= color.a; color.b /= color.a; } pColor[y*rect.Pitch/4+x]=color; } pRenderSurface->UnlockRect(); } D3DXSaveSurfaceToFile(texPath1,D3DXIFF_TGA,pRenderSurface,NULL,NULL);[/source]
Now the problem is,the picture seems too light,and some details lost.I'm confused about the result.Did I do it in a wrong way?
What I want that Illusion Particle does
Edited by Tunisia hawker, 18 June 2012 - 09:37 PM.






