Image noise: Difference between revisions
Content added Content deleted
m (moved Categorys to top / Category:Raster graphics operations) |
|||
Line 1,590: | Line 1,590: | ||
=={{header|MAXScript}}== |
=={{header|MAXScript}}== |
||
<lang MAXScript> |
|||
try destroydialog testRollout catch () |
try destroydialog testRollout catch () |
||
fn randomBitmap width height = |
fn randomBitmap width height = |
||
( |
( |
||
local newBmp = bitmap width height |
local newBmp = bitmap width height |
||
for row = 0 to (height-1) do |
for row = 0 to (height-1) do |
||
( |
( |
||
local pixels = for i in 1 to width collect ( |
local pixels = for i in 1 to width collect (white*random 0 1) |
||
for index = 1 to pixels.count do |
|||
( |
|||
pixels[index].value = 255*(random 0 1) |
|||
) |
|||
setpixels newBmp [0,row] pixels |
setpixels newBmp [0,row] pixels |
||
) |
) |
||
return newBmp |
return newBmp |
||
) |
) |
||
rollout testRollout "Test" width:320 height:240 |
rollout testRollout "Test" width:320 height:240 |
||
( |
( |
||
bitmap image width:320 height:240 pos:[0,0] |
bitmap image width:320 height:240 pos:[0,0] |
||
timer updateTimer interval:1 active:true |
timer updateTimer interval:1 active:true |
||
on updateTimer tick do |
on updateTimer tick do |
||
( |
( |
||
Line 1,621: | Line 1,616: | ||
local endTime = timestamp() |
local endTime = timestamp() |
||
local fps = ((endTime-startTime)/1000.0)*60.0 |
local fps = ((endTime-startTime)/1000.0)*60.0 |
||
if mod updatetimer.ticks 10 == 0 do (testRollout.title = ("Test (FPS: "+fps as string+")")) |
if mod updatetimer.ticks 10 == 0 do (testRollout.title = ("Test (FPS: "+fps as string+")")) |
||
) |
) |
||
) |
) |
||
createdialog testrollout |
createdialog testrollout |
||
</lang> |
</lang> |