'teken een cirkel (of een andere gesloten vorm)
GraphicsWindow.PenColor=GraphicsWindow.GetColorFromRGB(0,0,0)
GraphicsWindow.PenWidth=10
' de volgende drie regels zijn een bugfix
GraphicsWindow.BrushColor="white"
GraphicsWindow.FillRectangle(0,0,GraphicsWindow.Width,GraphicsWindow.Height)
GraphicsWindow.BrushColor="black"
GraphicsWindow.DrawEllipse(40,50,80,80)
'GraphicsWindow.DrawLine(20,120,120,20)
GraphicsWindow.MouseDown=OnMouseDown
'kies de startcoordinaat
x=95
y=90
punt[1]["x"]=x
punt[1]["y"]=y
aantalpunten=1
'doorloop nu alle punten in de lijst (in het begin 1 punt)
While aantalpunten>0
'doorloop de punten rond het laatste punt
'als ze niet niet zwart zijn
'1) vullen we ze met de kleur zwart
'2) en zetten we het punt in de lijst
' verwissel het laatste punt met een willekurig ander punt
' deze code zorgt ervoor dat de ruimte willekeurig gevuld wordt.
If aantalpunten>1 then
x=math.GetRandomNumber(aantalpunten-1)
temp=punt[x]
punt[x]=punt[aantalpunten]
punt[aantalpunten]=temp
endif
For dx=-1 To 1
For dy=-1 To 1
If (dx=0) And (dy=0) Then
'doe niets
Else
nx=x+dx
ny=y+dy
kleur=GraphicsWindow.GetPixel(nx,ny)
' aphicsWindow.ShowMessage(Text.GetLength(kleur),"")
If kleur="#000000" then
else
'graphicsWindow.ShowMessage(kleur,"")
'If kleur="white" then
gevonden=0
For i=1 to aantalpunten
If (punt[i]["x"]=nx) and (punt[i]["y"]=ny) then
gevonden=1
endif
EndFor
If gevonden=0 then
aantalpunten=aantalpunten+1
punt[aantalpunten]["x"]=nx
punt[aantalpunten]["y"]=ny
'GraphicsWindow.SetPixel(nx,ny,"black")
endif