Verfasst: 07.09.2004 13:35
Lock Ok
UnLock Ok
UnLock Ok
Das deutsche PureBasic-Forum
https://www.purebasic.fr/german/
Code: Alles auswählen
;Test 1 (sollte bei dir funktionieren)
Procedure GetBackDDS()
!extrn _PB_DirectX_BackBuffer
!MOV Eax,[_PB_DirectX_BackBuffer]
ProcedureReturn
EndProcedure
InitSprite()
InitKeyboard()
OpenScreen(800,600,32,"Farbverlauf")
Repeat
*DDS.IDirectDrawSurface7=GetBackDDS()
DDSD2=AllocateMemory(124)
PokeL(DDSD2,124)
*DDS\Lock(0,DDSD2,0,0)
Pitch=PeekL(DDSD2+16)
Addr=PeekL(DDSD2+36)
For X=0 To 799
For Y=0 To 599
R=(X*255)/800
G=(Y*255)/600
B=255-((X*255)/800)
PokeL(Addr+X*4+Y*Pitch,RGB(B,G,R));BGR-Format
Next
Next
*DDS\UnLock(0)
FlipBuffers()
ExamineKeyboard()
Until KeyboardPushed(#PB_KEY_ESCAPE)
Code: Alles auswählen
;Test 2 (sollte bei dir nicht richtig funktionieren)
Procedure GetBackDDS()
!extrn _PB_DirectX_BackBuffer
!MOV Eax,[_PB_DirectX_BackBuffer]
ProcedureReturn
EndProcedure
InitSprite()
InitKeyboard()
OpenScreen(800,600,32,"Farbverlauf")
Repeat
*DDS.IDirectDrawSurface7=GetBackDDS()
DDSD2=AllocateMemory(124)
PokeL(DDSD2,124)
*DDS\Lock(0,DDSD2,0,0)
*DDS\GetDC(@DC)
Pitch=PeekL(DDSD2+16)
Addr=PeekL(DDSD2+36)
For X=0 To 799
For Y=0 To 599
R=(X*255)/800
G=(Y*255)/600
B=255-((X*255)/800)
PokeL(Addr+X*4+Y*Pitch,RGB(B,G,R));BGR-Format
Next
Next
*DDS\ReleaseDC(DC)
*DDS\UnLock(0)
FlipBuffers()
ExamineKeyboard()
Until KeyboardPushed(#PB_KEY_ESCAPE)
Code: Alles auswählen
;Test 1 (sollte bei dir funktionieren)
Procedure GetBackDDS()
!extrn _PB_DirectX_BackBuffer
!MOV Eax,[_PB_DirectX_BackBuffer]
ProcedureReturn
EndProcedure
Procedure GetDDBase()
!extrn _PB_DDrawBase
!MOV Eax,[_PB_DDrawBase]
ProcedureReturn
EndProcedure
InitSprite()
InitKeyboard()
*DD.IDirectDraw7=GetDDBase()
*DD\SetDisplayMode(800,600,32,0,0)
OpenWindow(1,0,0,320,200,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"Farbverlauf")
OpenWindowedScreen(WindowID(),0,0,320,200,0,0,0)
DDSD2=AllocateMemory(124)
PokeL(DDSD2,124)
Repeat
*DDS.IDirectDrawSurface7=GetBackDDS()
Result=*DDS\Lock(0,DDSD2,0,0)
If Result:Debug "Lock Err "+Str(Result):EndIf
Pitch=PeekL(DDSD2+16)
Addr=PeekL(DDSD2+36)
For X=0 To 319
For Y=0 To 199
R=(X*255)/320
G=(Y*255)/200
B=255-((X*255)/320)
PokeL(Addr+X*4+Y*Pitch,RGB(B,G,R));BGR-Format
Next
Next
Result=*DDS\UnLock(0)
If Result:Debug "UnLock Err "+Str(Result):EndIf
FlipBuffers()
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape) Or WindowEvent()=#PB_Event_CloseWindow
Code: Alles auswählen
;Test 2 (sollte bei dir nicht richtig funktionieren)
Procedure GetBackDDS()
!extrn _PB_DirectX_BackBuffer
!MOV Eax,[_PB_DirectX_BackBuffer]
ProcedureReturn
EndProcedure
Procedure GetDDBase()
!extrn _PB_DDrawBase
!MOV Eax,[_PB_DDrawBase]
ProcedureReturn
EndProcedure
InitSprite()
InitKeyboard()
*DD.IDirectDraw7=GetDDBase()
*DD\SetDisplayMode(800,600,32,0,0)
OpenWindow(1,0,0,320,200,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"Farbverlauf")
OpenWindowedScreen(WindowID(),0,0,320,200,0,0,0)
DDSD2=AllocateMemory(124)
PokeL(DDSD2,124)
Repeat
*DDS.IDirectDrawSurface7=GetBackDDS()
Result=*DDS\Lock(0,DDSD2,0,0)
If Result:Debug "Lock Err "+Str(Result):EndIf
Result=*DDS\GetDC(@DC)
If Result:Debug "GetDC Err "+Str(Result):EndIf
Pitch=PeekL(DDSD2+16)
Addr=PeekL(DDSD2+36)
For X=0 To 319
For Y=0 To 199
R=(X*255)/320
G=(Y*255)/200
B=255-((X*255)/320)
PokeL(Addr+X*4+Y*Pitch,RGB(B,G,R));BGR-Format
Next
Next
Result=*DDS\ReleaseDC(DC)
If Result:Debug "ReleaseDC Err "+Str(Result):EndIf
Result=*DDS\UnLock(0)
If Result:Debug "UnLock Err "+Str(Result):EndIf
FlipBuffers()
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape) Or WindowEvent()=#PB_Event_CloseWindow
Code: Alles auswählen
LockBuffer buffer
Parameters
buffer = any valid screen/image buffer (optional)
Description
After you use LockBuffer on a buffer, the only graphics commands you can use are the read/write pixel commands ReadPixel, WritePixel, ReadPixelFast, WritePixelFast, CopyPixelFast, and CopyPixel. You must UnlockBuffer before using other graphics commands or API calls, and you are advised to only keep the buffer locked for as long as it is needed.
The buffer parameter isn't required. If omitted, the default buffer set with SetBuffer will be used.
UnlockBuffer buffer
Parameters
buffer = any valid screen/image buffer (optional)
Description
After you use LockBuffer on a buffer, the only graphics commands you can use are the read/write pixel commands ReadPixel, WritePixel, ReadPixelFast, and WritePixelFast. You must use this command before using other graphics commands.
The buffer parameter isn't required. If omitted, the default buffer set with SetBuffer will be used.