Yes of course. I tried as said above but I just got an empty surface. It did not crash, that was the good point.
The trick is to use one of the HWA texture which is created in the video memory. You blit the application surface to this temp surface and used it as base to blit on a DIB surface.
You can then call GetPixel.
My main concern is that this surface is slow writing according to comments, so it cannot really be used for what I thought.
COLORREF Extension::GetColor(int x, int y)
fprh rhPtr = rdPtr->rHo.hoAdRunHeader;
LPSURFACE ps = WinGetSurface((int)rhPtr->rhIdEditWin);
int w = ps->GetWidth();
int h = ps->GetHeight();
if(renderSurf != NULL)
renderSurf = NULL;
LPSURFACE pProto1 = NULL;
if (GetSurfacePrototype(&pProto1, ps->GetDepth(), ST_MEMORY, SD_DIB) )
renderSurf = new cSurface;
LPSURFACE pSrcSf = ps;
int nDrv = ps->GetDriver();
if ( nDrv == SD_D3D9 || nDrv == SD_D3D8 )
GetSurfacePrototype(&pProto, ps->GetDepth(), ST_HWA_ROUTEXTURE, nDrv);
ps->Blit(rttSf, 0, 0, 0, 0, ps->GetWidth(),ps->GetHeight(), BMODE_OPAQUE);
pSrcSf = &rttSf;
COLORREF color = renderSurf->GetPixelFast(x,y);
Indeed, Yves is a busy man. I really need to to talk with him at the next convention to understand the whole surface topic. I hope he should come and have more time to explain.
ST_HWA_ROUTEXTURE, // HWA texture created in video memory, unmanaged (lost when device is lost). Slow writing, should be treated read-only