It's a quick, dirty and ugly minimal wallpaper generator I made a few years ago.
Feel free to enhance it!
Code: Select all
ExamineDesktops() : UsePNGImageEncoder() : Global W=DesktopWidth(0) , H=DesktopHeight(0)
Global DefStatus$ = " Space to generate, S to save PNG" + Space(235) + "Made with PureBasic"
OpenWindow(0, 55, 55, 1010, 556, "Minimal Wallpaper Generator 1.0", #PB_Window_SystemMenu)
CreateImage(99, W, H) : ImageGadget(33,0,0,W,H,ImageID(99))
CreateStatusBar(0,WindowID(0)) : AddStatusBarField(#PB_Ignore ) : StatusBarText(0,0,DefStatus$)
Procedure gennew()
Repeat
StartDrawing(ImageOutput(99)) : Lines = 0 : Box(0,0,W,H, 42)
For i = 0 To H Step 60 : If Not Random(5) : Line(0, i, W+1, 1, 0) : Lines + 1 : EndIf : Next
For j = 0 To W Step 60 : If Not Random(5) : Line(j, 0, 1, H+1, 0) : Lines + 1 : EndIf : Next
For j = 5 To H*0.9 Step 55 :
For k = 5 To W*0.9 Step 35 :
If Point(k,j) = 42 : FillArea(k, j, -1, RGB(Random($33),Random($33),Random($33)) + $565656) : EndIf
Next : Next
StopDrawing()
Until Lines > 2
SetGadgetState(33,ImageID(99)) : StatusBarText(0,0,DefStatus$)
EndProcedure
Procedure save()
fname$ = Str(Date())+".png" : SaveImage(99,fname$, #PB_ImagePlugin_PNG) : StatusBarText(0,0,"Saved as " +fname$)
EndProcedure
gennew()
AddKeyboardShortcut(0, #PB_Shortcut_Space, 15) : BindEvent(#PB_Event_Menu, @gennew(), 0, 15)
AddKeyboardShortcut(0, #PB_Shortcut_S, 16) : BindEvent(#PB_Event_Menu, @save(), 0, 16)
Repeat : Until WaitWindowEvent() = 13116