need more tuning ?

This commit is contained in:
tTh 2022-12-17 12:09:57 +01:00
parent 252ea6d764
commit c0d8ee443f
3 changed files with 30 additions and 4 deletions

View File

@ -39,7 +39,7 @@ contains
end do
end do
call rgbpix_spit_as_pnm(pixrgb, "rgb.pnm")
call rgbpix_spit_as_pnm_8(pixrgb, "rgb.pnm")
deallocate(pixrgb)

View File

@ -15,7 +15,7 @@ end type
contains
!-------------------------------------------------------------------
!-
subroutine rgbpix_spit_as_pnm(pic, fname)
subroutine rgbpix_spit_as_pnm_8(pic, fname)
type(t_pixrgb), intent(in) :: pic(:,:)
character (len=*), intent(in) :: fname
@ -24,14 +24,39 @@ subroutine rgbpix_spit_as_pnm(pic, fname)
open(newunit=io, file=fname)
write (io, '(a2)') "P3"
write (io, '("# spit_rgb_pnm")')
write (io, '("# rgbpix_spit_as_pnm_8")')
write (io, '(i0," ",i0)') size(pic, 1), size(pic, 2)
write (io, '(i0)') 255
do iy=1, ubound(pic, 2)
do ix=1, ubound(pic, 1)
write(io, "(3I7)") pic(ix, iy)%r, pic(ix, iy)%g, pic(ix, iy)%b
write(io, "(3I4)") pic(ix, iy)%r, pic(ix, iy)%g, pic(ix, iy)%b
enddo
enddo
close(unit=io)
end subroutine
!-------------------------------------------------------------------
!-
subroutine rgbpix_spit_as_pnm_16(pic, fname)
type(t_pixrgb), intent(in) :: pic(:,:)
character (len=*), intent(in) :: fname
integer :: io, ix, iy
open(newunit=io, file=fname)
write (io, '(a2)') "P3"
write (io, '("# rgbpix_spit_as_pnm_16")')
write (io, '(i0," ",i0)') size(pic, 1), size(pic, 2)
write (io, '(i0)') 65535
do iy=1, ubound(pic, 2)
do ix=1, ubound(pic, 1)
write(io, "(3I6)") pic(ix, iy)%r, pic(ix, iy)%g, pic(ix, iy)%b
enddo
enddo

View File

@ -87,6 +87,7 @@ subroutine spit_as_pgm_8(pic, fname)
! XXX print *, " max = ", foo
open(newunit=io, file=fname)
write (io, '(a2)') "P2"
write (io, '(A)') "# spit_as_pgm_8"
write (io, '(i0," ",i0)') size(pic, 1), size(pic, 2)
write (io, '(i0)') 255