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

