Code: Select all
GDIFUNCTION GetPixel( nHDC, x, y)
GDIFUNCTION SetPixel( nHDC, x, y, n )
DLLFUNCTION GetWindowDC( hwnd ) USING STDCALL FROM USER32.DLL
Code: Select all
GDIFUNCTION GetPixel( nHDC, x, y)
GDIFUNCTION SetPixel( nHDC, x, y, n )
DLLFUNCTION GetWindowDC( hwnd ) USING STDCALL FROM USER32.DLL
I am going to look into the possibility of using a Memory DC instead of a Screen DC. As of now, I don't know how to do that.I understand that you're currently using the GetPixel() API directly in your code via DLLCall()? If so, which device context are you using with this API - a screen DC or a memory DC? Could you give us a quick run-down of your current approach?
Unfortunately, there's no internal interface that I can think of. Especially because your API call directly accesses the corresponding OS resource. I don't think anything we could provide could beat that when doing pixel-wise access, even if the OS subsystem being used is faster.
Xbase++ is for Database and not for "Games" which need "Pixel".Eugene Lutsenko wrote:And of course such a function should be in a standard set of graphics functions of the programming language.
AFAIK ... there is no such Function in GDI32.DLLEugene Lutsenko wrote:In their response, I realized that they do not have such a function in the language. Although they do not directly told. This leaves the impression that maybe they still have such a function. But they say that if it was, then it would hardly worked faster than the OS functions.
since Vista we have DWM ( Desktop Windows Manager ) which is "painting" your WindowsEugene Lutsenko wrote: But then why XP is working properly, and W7 is very slow? It turns out the problem is the OS?
Code: Select all
Scan 0
Scan 1
.
.
.
Scan n-2
Scan n-1
Code: Select all
FUNCTION LoadArray2( hDC1, aPixel )
LOCAL hMemoryDC
LOCAL i, j, oScrn, nXSize := Len(aPixel), nYSize := Len(aPixel[1])
LOCAL nSeconds := Seconds()
hMemoryDC := CreateMemoryDC( hDC1, nXSize, nYSize)
FOR i := 1 TO nXSize
FOR j := 1 TO nYSize
aPixel[i,j] := GetPixel(hMemoryDC,i-1,j-1)
NEXT
NEXT
MsgBox(Alltrim(Str(Seconds()-nSeconds)) + ' Seconds to load Array')
DC_ClearEvents()
RETURN aPixel
* ------------
FUNCTION CreateMemoryDC( hDC, nXSize, nYSize )
LOCAL hMemoryDC, hBMP
hMemoryDC := CreateCompatibleDC(hDC) // create compatible memory DC
hBMP := CreateCompatibleBitmap(hDC,nXSize,nYSize) // create DDB
SelectObject(hMemoryDC,hBMP) // put hBMP into memory DC
BitBlt( hMemoryDC,0,0,nXSize,nYSize,hDC,0,0,SRCCOPY ) // copy desktop DC into memory DC
RETURN hMemoryDC
* --------------
DLLFUNCTION CreateCompatibleDC( nHDC ) USING STDCALL FROM GDI32.DLL
DLLFUNCTION CreateCompatibleBitmap( nHDC, dw, dh ) USING STDCALL FROM GDI32.DLL
DLLFUNCTION SelectObject(hMemoryDC,hBMP) USING STDCALL FROM GDI32.DLL
DLLFUNCTION BitBlt( hDC,nXDest,nYDest,nXSize,nYSize,hDCSrc,nXSrc,nYSrc,dwROP ) ;
USING STDCALL FROM GDI32.DLL