Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -6,6 +6,7 @@
|
|||
{{omit from|MIRC Scripting Language}}
|
||||
{{omit from|ML/I}}
|
||||
{{omit from|Sed}}
|
||||
{{omit from|Batch File}}
|
||||
[[Category:Raster graphics operations]]
|
||||
Generate a random black and white 320x240 image continuously,
|
||||
showing FPS (frames per second).
|
||||
|
|
|
|||
|
|
@ -26,8 +26,10 @@ sub render {
|
|||
SDL_SetRenderDrawColor($renderer, 0, 0, 0, 0);
|
||||
SDL_RenderClear($renderer);
|
||||
SDL_SetRenderDrawColor($renderer, 255, 255, 255, 0);
|
||||
for ^$w X ^$h -> $i, $j {
|
||||
SDL_RenderDrawPoint( $renderer, $i, $j ) if rand < .5;
|
||||
loop (my int $i; $i < $w; $i = $i + 1) {
|
||||
loop (my int $j; $j < $h; $j = $j + 1) {
|
||||
SDL_RenderDrawPoint( $renderer, $i, $j ) if Bool.pick
|
||||
}
|
||||
}
|
||||
SDL_RenderPresent($renderer);
|
||||
}
|
||||
|
|
|
|||
23
Task/Image-noise/REXX/image-noise.rexx
Normal file
23
Task/Image-noise/REXX/image-noise.rexx
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/*REXX program times the generation of 100 frames of random black&white image.*/
|
||||
parse arg sw sd im . /*obtain optional args from the C.L. */
|
||||
if sw==',' | sw=='' then sw=320 /*SW specified? No, then use default.*/
|
||||
if sd==',' | sd=='' then sd=240 /*SD " " " " " */
|
||||
if im==',' | im=='' then im=100 /*IM " " " " " */
|
||||
call time 'R' /*reset the REXX elapsed (clock) timer.*/
|
||||
do frame=1 for im /*generate IM number of images. */
|
||||
call genFrame sw,sd /*generate single image of size SW x SD*/
|
||||
/* say frame */ /*do (or don't) display the frame num. */
|
||||
end /*frame*/ /*generate, but don't display the image*/
|
||||
/*measures ↓ elapsed time in seconds.*/
|
||||
say 'The average frames/second: ' format(im/time("E"),,2) /*show FPS stat.*/
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*────────────────────────────────────────────────────────────────────────────*/
|
||||
genFrame: parse arg x,y; @.0='ff000000'x /*hex: black. */
|
||||
@.1='ffffffff'x /*hex: white. */
|
||||
$= /*nullify image*/
|
||||
do y; _= /*nullify a row*/
|
||||
do x; ?=random(0,1); _=_ || @.? /*black │ white*/
|
||||
end /*x*/
|
||||
$=$ || _ /*append to $. */
|
||||
end /*y*/
|
||||
return
|
||||
Loading…
Add table
Add a link
Reference in a new issue