How to resolve the algorithm Image noise step by step in the MAXScript programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Image noise step by step in the MAXScript programming language

Table of Contents

Problem Statement

Generate a random black and white   320x240   image continuously, showing FPS (frames per second).

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Image noise step by step in the MAXScript programming language

Source code in the maxscript programming language

try destroydialog testRollout catch ()
 
fn randomBitmap width height =
(
	local newBmp = bitmap width height
 
	for row = 0 to (height-1) do
	(
		local pixels =  for i in 1 to width collect (white*random 0 1)
		setpixels newBmp [0,row] pixels
	)
 
	return newBmp
)
 
rollout testRollout "Test" width:320 height:240
(
	bitmap image width:320 height:240 pos:[0,0]
	timer updateTimer interval:1 active:true
 
	on updateTimer tick do
	(
		local startTime = timestamp()
		image.bitmap = randomBitmap 320 240
		local endTime = timestamp()
		local fps = ((endTime-startTime)/1000.0)*60.0
 
		if mod updatetimer.ticks 10 == 0 do (testRollout.title = ("Test (FPS: "+fps as string+")"))
 
	)
)
 
createdialog testrollout

  

You may also check:How to resolve the algorithm Probabilistic choice step by step in the FutureBasic programming language
You may also check:How to resolve the algorithm Chowla numbers step by step in the Prolog programming language
You may also check:How to resolve the algorithm Loops/Do-while step by step in the Phix programming language
You may also check:How to resolve the algorithm Hofstadter-Conway $10,000 sequence step by step in the Nim programming language
You may also check:How to resolve the algorithm Sort disjoint sublist step by step in the Icon and Unicon programming language