Hello, all.
STARGÅTE, are you still here?
This is the first approximation. Hastily and dirty (not clean). But this example shows what I need. There is something wrong with my math. Could you take a look? I am attaching a
screenshot of the problem.
That's what it's about:
Code: Select all
#max_number_of_frames = 5
Global.i FrameSize, *mem
Procedure MakeDesktopScreenshot(ImageNr, x, y, Width, Height, SnapshotNr)
Protected hImage, hDC, hWnd, DeskDC
Protected *Buffer, *mem_ptr, Pitch
hImage = CreateImage(ImageNr, Width, Height)
If hImage
hDC = StartDrawing(ImageOutput(ImageNr))
If hDC
hWnd=GetDesktopWindow_()
DeskDC = GetDC_(hWnd)
BitBlt_(hDC, 0, 0, Width, Height, DeskDC, x, y, #SRCCOPY)
*Buffer = DrawingBuffer()
If SnapshotNr = 1
Pitch = DrawingBufferPitch()
FrameSize = Pitch * Height ;ImageHeight(ImageNr)
*mem = AllocateMemory(FrameSize * #max_number_of_frames)
EndIf
If *mem = 0
hImage = 0
Else
*mem_ptr = *mem + (FrameSize * (#max_number_of_frames - SnapshotNr))
CopyMemory(*Buffer, *mem_ptr, FrameSize)
EndIf
StopDrawing()
ReleaseDC_(hWnd, DeskDC)
Else
FreeImage(ImageNr)
hImage = 0
EndIf
EndIf
ProcedureReturn hImage
EndProcedure
Procedure CreateFinalizeSnapshot(ImageNr, Width, Height, SnapshotNr)
Protected *mem_ptr, hImage, hDC
hImage = CreateImage(ImageNr, Width, Height * SnapshotNr)
If hImage
hDC = StartDrawing(ImageOutput(ImageNr))
If hDC
*mem_ptr = *mem + (FrameSize * (#max_number_of_frames - SnapshotNr))
CopyMemory(*mem_ptr, DrawingBuffer(), FrameSize * SnapshotNr)
StopDrawing()
Else
FreeImage(ImageNr)
hImage = 0
EndIf
EndIf
ProcedureReturn hImage
EndProcedure
#const_x = 264
#const_y = 183
#const_w = 1322
#const_h = 655
UsePNGImageEncoder()
Sleep_(1500)
If MakeDesktopScreenshot(0, #const_x, #const_y, #const_w, #const_h, 1)
Beep_(2000, 400)
Sleep_(5000) ;time to change screen
If MakeDesktopScreenshot(0, #const_x, #const_y, #const_w, #const_h, 2)
If CreateFinalizeSnapshot(0, #const_w, #const_h, 2)
SaveImage(0, "c:\-\-\test.png", #PB_ImagePlugin_PNG)
EndIf
EndIf
EndIf
If *mem
FreeMemory(*mem)
EndIf
P.S. This is not my ultimate goal. This is just the first step. I need more time to think about how to take the next step. I understand what needs to be done, but I don't know how. But first I need to fix my math. Please, HELP!
Thank you in advance.
P.S.2. Lines 33 and 34 in the picture are the border where the two frames "meet". It does not depend on me. There was enough time to scroll through the text.