diff --git a/Modules/.gitignore b/Modules/.gitignore index d1eaedc..1acb676 100644 --- a/Modules/.gitignore +++ b/Modules/.gitignore @@ -3,6 +3,7 @@ chkpixels twavm trnd t_centermag +demo_spitpgm datas/ diff --git a/Modules/Makefile b/Modules/Makefile index f320092..6acdde0 100644 --- a/Modules/Makefile +++ b/Modules/Makefile @@ -65,3 +65,6 @@ trnd: trnd.f90 Makefile libtth90modules.a twavm: twavm.f90 Makefile libtth90modules.a gfortran $(GFOPT) $< libtth90modules.a -o $@ +demo_spitpgm: demo_spitpgm.f90 Makefile libtth90modules.a + gfortran $(GFOPT) $< libtth90modules.a -o $@ + diff --git a/Modules/README.md b/Modules/README.md index e82a2a6..29221ce 100644 --- a/Modules/README.md +++ b/Modules/README.md @@ -11,7 +11,8 @@ This is just a [WIP](./wavmetrics.f90), see [twavm](./twavm.f90) for a no-use ca ### spitpgm -Write gray level 2d buffer (aka picture) to disk in the NetPNM format. +Some procedures to [write gray level](./SpitPGM.md) 2d buffer of integer +(aka picture) to disk in the *ascii* NetPNM format. ### pixrgb diff --git a/Modules/SpitPGM.md b/Modules/SpitPGM.md new file mode 100644 index 0000000..76b47ee --- /dev/null +++ b/Modules/SpitPGM.md @@ -0,0 +1,21 @@ +# SpitPGM + +What is a `.pgm` file ? And what we can do with this module ? + +You have a bi-dimensionnal array of integer and you want show those +fancy datas as a fancy picture ? So we have a few funcs for doing +that.. + +``` +subroutine spit_as_pgm_16(pic, fname) + integer, intent(in), dimension (:,:) :: pic + character (len=*), intent(in) :: fname +``` + +and + +``` +subroutine spit_as_pgm_16(pic, fname) + integer, intent(in), dimension (:,:) :: pic + character (len=*), intent(in) :: fname +``` diff --git a/Modules/demo_spitpgm.f90 b/Modules/demo_spitpgm.f90 new file mode 100644 index 0000000..bac588a --- /dev/null +++ b/Modules/demo_spitpgm.f90 @@ -0,0 +1,18 @@ +program demo_spitpgm + use spitpgm + + integer :: fancydatas(128, 128) + integer :: i, j + + fancydatas = 0 + + do i=1, 128 + do j=1, 128 + fancydatas(i,j) = mod(i*j, 65000) + enddo + enddo + + call spit_as_pgm_16(fancydatas, 'fancydatas.pgm') + +end program + diff --git a/Modules/trnd.f90 b/Modules/trnd.f90 index b049dc9..736c78e 100644 --- a/Modules/trnd.f90 +++ b/Modules/trnd.f90 @@ -8,7 +8,7 @@ program essai ! integer :: foo, bar - write(0, *) "----------------- essai -------------------" + write(0, *) "------------ essai random -------------" call init_random_seed() ! in module 'mathstuff' ! call test_noisepictures_rgb()