我试图在小型基础上创建噪声图像,但是,我无法让图像加载速度足够快以看起来很逼真。我尝试使用 ldarray 但它仍然不够快。
这是我正在使用的当前代码:
GraphicsWindow.Left = 0 'positions graph
GraphicsWindow.Top = 0
GraphicsWindow.Height = 240
GraphicsWindow.Width = 320
numpix = 320 * 240 'creates number of indices for ldarray
pixels = LDArray.Create(numpix) 'creates 1D array where color values will be stored
While 1=1
setcolor()
importcolor()
EndWhile
Sub setcolor
For h = 1 To numpix
randomcolor = Math.GetRandomNumber(2)
If randomcolor = 1 Then
ldarray.SetValue(pixels,h,"black") 'sets the pixel color to black or white
Else
ldarray.SetValue(pixels,h,"white")
EndIf
EndFor
EndSub
sub importcolor
'prints out the image
For h = 1 To 320
For w = 1 To 240
i = i + 1
color = LDArray.GetValue(pixels,i)
GraphicsWindow.SetPixel(h,w,color)
EndFor
EndFor
EndSub
您可以稍后格式化程序,方法是选择所有文本,然后单击“格式化程序”
另外,如果你能帮我写一个 fps 计数器,那将非常有帮助,因为我不知道从哪里开始。