; Griffin's paint GUI Global wScreen = 600 Graphics( wScreen, 600, 24 ) Global nColors = 7 bDraw = 0 bDirty = 0 ClsColor( 255, 255, 255 ) Dim screen( GraphicsWidth(), GraphicsHeight() ) Cls DrawTools() Color( 255, 0, 0 ) .mainloop While Not KeyHit(1) ; If bDraw = 1 And MouseY() < 590 And MouseDown(1) ; Then If MouseY() < 590 And MouseDown(1) ; Then Rect( MouseX(), MouseY(), 20, 20 ) ;Line( MouseX(), MouseY(),MouseX()+10, MouseY()+ 10 ) bDirty = 1 EndIf ; nRestore = bDraw ; Stop drawing and change color if mouse is at bottom. While MouseY() > 590 ; bDraw = 0 If MouseHit(1) Then clrint = SelectTools() If clrint = 1 Color( 255, 0, 0 ) EndIf If clrint = 2 Color( 255, 128, 0 ) EndIf If clrint = 3 Color( 255, 255, 0 ) EndIf If clrint = 4 Color( 0, 255, 0 ) EndIf If clrint = 5 Color( 0, 0, 255 ) EndIf If clrint = 6 Color( 128, 0, 128 ) EndIf If clrint = 7 Color( 255, 255, 255 ) EndIf EndIf Wend ; bDraw = nRestore If KeyDown(23) ;Stop InvertColors() EndIf While KeyHit(29) If KeyDown(31) SaveWork() EndIf Wend If bDirty Flip bDirty = 0 EndIf Wend Function DrawTools() Color( 255, 0, 0 ) Rect( 0*wScreen/nColors, 590, wScreen/nColors - 1, 10 ) Color( 255, 128, 0 ) Rect( 1*wScreen/nColors, 590, wScreen/nColors - 1, 10 ) Color( 255, 255, 0 ) Rect( 2*wScreen/nColors, 590, wScreen/nColors - 1, 10 ) Color( 0, 255, 0 ) Rect( 3*wScreen/nColors, 590, wScreen/nColors - 1, 10 ) Color( 0, 0, 255 ) Rect( 4*wScreen/nColors, 590, wScreen/nColors - 1, 10 ) Color( 128, 0, 128 ) Rect( 5*wScreen/nColors, 590, wScreen/nColors - 1, 10 ) Color( 255, 255, 255 ) Rect( 6*wScreen/nColors, 590, wScreen/nColors - 1, 10 ) Flip End Function Function SelectTools() colorchoice = MouseX() If colorchoice < wScreen/nColors Return(1) EndIf If colorchoice < 2*wScreen/nColors And colorchoice > 1*wScreen/nColors Return(2) EndIf If colorchoice < 3*wScreen/nColors And colorchoice > 2*wScreen/nColors Return(3) EndIf If colorchoice < 4*wScreen/nColors And colorchoice > 3*wScreen/nColors Return(4) EndIf If colorchoice < 5*wScreen/nColors And colorchoice > 4*wScreen/nColors Return(5) EndIf If colorchoice < 6*wScreen/nColors And colorchoice > 5*wScreen/nColors Return(6) EndIf If colorchoice > 6*wScreen/nColors Return(7) EndIf End Function Function InvertColors() LockBuffer BackBuffer() ; Stop For i = 1 To GraphicsWidth() For j = 1 To GraphicsHeight() - 11 screen(i,j) = ReadPixelFast( i, j, BackBuffer() ) WritePixelFast( i, j, screen(i,j) Xor ( $FFFFFF ), BackBuffer() ) Next Next UnlockBuffer BackBuffer() ;If bDirty Flip bDirty = 0 ;EndIf End Function Function SaveWork() SetBuffer FrontBuffer() Print("what do you want to call this?") Flip name$ = Input$ SaveBuffer( BackBuffer(), name$ ) End Function End