[SOLVED] Copy and paste a graphic patch??
Posted: Tue Mar 11, 2025 12:48 am
This block of code works fine until I un-comment that DrawImage line. Trying to copy a patch of the image using GrabImage and paste it using DrawImage. Maybe using the wrong commands.
What am I doing wrong? Anyone?
Code: Select all
#MainImage = 0
If OpenWindow(0, 0, 0, 200, 200, "2DDrawing Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If CreateImage(#MainImage, 200, 200) And StartDrawing(ImageOutput(#MainImage))
Box(0, 0, 200, 200, RGB(255, 255, 255))
For Width = 1 To 200 Step 5
Line(10, 10, Width, 180, RGB(Random(255), Random(255), Random(255)))
Next Width
For height = 1 To 200 Step 5
Line(10, 10, 200, height, RGB(Random(255), Random(255), Random(255)))
Next height
patch = GrabImage(#MainImage,1,10,10,100,35)
; DrawImage(1,100,10)
StopDrawing()
ImageGadget(0, 0, 0, 200, 200, ImageID(#MainImage))
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf