From 86b1e9e01102c35c59c24faf4811e44bd23b7ee4 Mon Sep 17 00:00:00 2001 From: tTh Date: Fri, 2 Jun 2023 19:29:36 +0200 Subject: [PATCH] trying a new picture noiser --- GrafAnim/go.sh | 10 +++----- GrafAnim/noisepic.f90 | 59 ++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 60 insertions(+), 9 deletions(-) diff --git a/GrafAnim/go.sh b/GrafAnim/go.sh index a9c0672..6495a77 100755 --- a/GrafAnim/go.sh +++ b/GrafAnim/go.sh @@ -2,16 +2,14 @@ set -e -make essai +make noisepic for foo in $(seq 0 89) do - ./essai $foo > a.scratch - fname=$(printf "F/%04d.tga" $foo) - echo $fname - genplot2 -s 640x480 a.scratch $fname + + ./noisepic $foo done -convert -delay 10 F/????.tga foo.gif +convert -delay 10 F/np/*.pnm foo.gif diff --git a/GrafAnim/noisepic.f90 b/GrafAnim/noisepic.f90 index 55b3c69..7f36696 100644 --- a/GrafAnim/noisepic.f90 +++ b/GrafAnim/noisepic.f90 @@ -6,9 +6,9 @@ program noisepic integer :: numframe = 0 - integer :: nbarg + integer :: nbarg, nbre character(len=256) :: arg - + integer :: ranges(6) nbarg = IARGC() if (nbarg .GT. 0) then @@ -17,7 +17,11 @@ program noisepic read (arg, *) numframe endif - call make_noise_color_pic(numframe) + ranges(0) = 10 ; ranges(2) = 90 + ranges(3) = 110 ; ranges(4) = 166 + ranges(5) = 205 ; ranges(6) = 230 + nbre = 1000+(numframe*555) + call make_noise_color_range_pic(numframe, ranges, nbre) contains !-- ------------------------------------------------------------------ @@ -111,6 +115,55 @@ subroutine plot_noise_color_pic(prgb, nbre) enddo +end subroutine +!-- ------------------------------------------------------------------ +!- +!- Colorized with range +!- +subroutine plot_noise_color_range_pic(prgb, nbre) + implicit none + type(t_pixrgb), dimension(:,:), intent(inout) :: prgb + integer, intent(in) :: nbre + integer :: quux, ix, iy, width, height + + width = ubound(prgb, 1) ; height = ubound(prgb, 2) + + do quux=1, nbre + ix = 1 + mod ( irand(), width ) + iy = 1 + mod ( irand(), height ) + prgb(ix, iy)%r = 64 + mod ( irand(), 127 ) + prgb(ix, iy)%g = 64 + mod ( irand(), 127 ) + prgb(ix, iy)%b = 64 + mod ( irand(), 127 ) + enddo + +end subroutine +!-- ------------------------------------------------------------------ + +subroutine make_noise_color_range_pic (value, rngs, nbre) + implicit none + integer, intent(in) :: value, nbre + integer, intent(in) :: rngs(6) + + integer :: foo + type(t_pixrgb), allocatable :: pix(:,:) + character (len=280) :: filename + + allocate(pix(320, 240)) + call rgbpix_set_to_rgb(pix, 0, 0, 0) + + call srand(value+34) + foo = irand() + print *, 'color_range: val=', value, 'rnd=', foo, 'nbre=', nbre + + write (filename, "(a, i5.5, a)") "./F/np/", value, ".pnm" + print *, 'filename: ', trim(filename) + + call plot_noise_color_range_pic(pix, nbre) + + call rgbpix_spit_as_pnm_8(pix, trim(filename)) + + deallocate(pix) + end subroutine !-- ------------------------------------------------------------------