Code: Select all
UseJPEG2000ImageEncoder()
Procedure UpdateSnapshot()
Image = MXSnapshot_TakeSnapshot(320)
tempimage=CreateImage(#PB_Any,320,240)
StartDrawing(ImageOutput(tempimage))
DrawImage(image,0,0,320,240)
StopDrawing()
SaveImage(tempimage,GetTemporaryDirectory()+"test.jpg",#PB_ImagePlugin_JPEG,6)
FreeImage(tempimage)
SetGadgetState(0, Image)
MX_Release(Image)
EndProcedure
If OpenWindow(0, 0, 0, 320, 256, "Snapshot example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ImageGadget(0, 0, 0, 320, 256, 0)
UpdateSnapShot()
AddWindowTimer(0, 0, 500)
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Timer
UpdateSnapshot()
EndIf
Until Event = #PB_Event_CloseWindow
MXSnapshot_StopSession()
EndIf