From d76861a4e4356fc9d8401bb5cb25242604a65b5e Mon Sep 17 00:00:00 2001 From: tTh Date: Tue, 27 Feb 2024 01:22:18 +0100 Subject: [PATCH] first run of readpicz --- GrafAnim/.gitignore | 2 ++ GrafAnim/Makefile | 3 +++ GrafAnim/readpicz.f90 | 52 ++++++++++++++++++++++++++++++++++++++++++ GrafAnim/t_readpicz.sh | 7 ++++++ 4 files changed, 64 insertions(+) create mode 100644 GrafAnim/readpicz.f90 create mode 100755 GrafAnim/t_readpicz.sh diff --git a/GrafAnim/.gitignore b/GrafAnim/.gitignore index dca5806..e502fc7 100644 --- a/GrafAnim/.gitignore +++ b/GrafAnim/.gitignore @@ -6,6 +6,7 @@ trigofest noisepic geowaves soundscope +readpicz *.scratch *.genplot @@ -16,4 +17,5 @@ F/*.tga *.pgm *.data *.png +log.txt diff --git a/GrafAnim/Makefile b/GrafAnim/Makefile index acd6918..5156318 100644 --- a/GrafAnim/Makefile +++ b/GrafAnim/Makefile @@ -32,6 +32,9 @@ wavmetrics.o: wavmetrics.f90 Makefile soundscope: soundscope.f90 Makefile utils_ga.o gfortran $(GFOPT) $< $(MYLIB) utils_ga.o -o $@ +readpicz: readpicz.f90 Makefile utils_ga.o + gfortran $(GFOPT) $< $(MYLIB) utils_ga.o -o $@ + # ---- modules locaux ---- usegenplot.o: usegenplot.f90 Makefile diff --git a/GrafAnim/readpicz.f90 b/GrafAnim/readpicz.f90 new file mode 100644 index 0000000..3a72faa --- /dev/null +++ b/GrafAnim/readpicz.f90 @@ -0,0 +1,52 @@ +program readpicz + + use pixrgb + implicit none + + integer :: nbarg + integer :: param0 = 10 + character(len=256) :: arg + + ! integer :: foo, bar + + integer :: width = 640 + integer :: height = 480 + integer :: x, y, r, g, b + integer :: errcode + character (len=280) :: filename + type(t_pixrgb), allocatable :: pix(:,:) + + filename = "out.pnm" + + nbarg = IARGC() + if (nbarg .GT. 0) then + call GETARG(1, arg) + ! write (0, '(A40, A5)') "argument = ", arg + read (arg, *) param0 + endif + + allocate(pix(width, height)) + + do + !----- get a pixel + read(5, *, iostat=errcode) x, y, r, g, b + ! print *, x, y + if (0 .NE. errcode) then + write(0, *) "iostat", errcode + exit + endif + pix(x+1, y+1)%r = b * 200 + pix(x+1, y+1)%g = b * 200 + pix(x+1, y+1)%b = r * 200 + enddo + + call rgbpix_spit_as_pnm_16(pix, trim(filename)) + +contains +! ---------------------------------------------------------- + + +! ---------------------------------------------------------- + +end program + diff --git a/GrafAnim/t_readpicz.sh b/GrafAnim/t_readpicz.sh new file mode 100755 index 0000000..da9e059 --- /dev/null +++ b/GrafAnim/t_readpicz.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +tga_mires mircol0 mire.tga "Fortran Moderne" + +tga_to_text foo.tga | ./readpicz + +