print_p6 Subroutine

public subroutine print_p6(filename)

NAME

print_p6(3f) - [M_pixel:PRINT] print pixel array as a ppm file
(LICENSE:PD)

SYNOPSIS

definition:

subroutine print_p6(filename)
character(len=*),intent(in) :: filename

DESCRIPTION

This driver makes an P6 PPM(portable pixmap) file. Any existing file will be replaced.

OPTIONS

FILENAME name of output file to create.

EXAMPLE

Sample program:

  program demo_print_p6
  use M_pixel, only : prefsize,vinit,ortho2,vexit
  use M_pixel, only : linewidth,circle,color
  use M_pixel, only : print_p6
  implicit none
     call prefsize(40,40)
     call vinit()
     call ortho2(-100.0,100.0,-100.0,100.0)
     call linewidth(400)
     call circle(0.0,0.0,45.0)
     call color(3)
     call circle(0.0,0.0,25.0)
     call print_p6('demo_print.p6')
     call vexit()
  end program demo_print_p6

AUTHOR

John S. Urban

LICENSE

Public Domain

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename

Contents

Source Code


Source Code

subroutine print_p6(filename)
! ident_36="@(#) M_pixel print_p6(3f) print pixel array as a P6 PPM file replacing any existing file"

character(len=*),intent(in) :: filename
integer                     :: lun,ios
character(len=4096)         :: message

   open(newunit=lun,file=filename, &
      & status='replace',          & !  STATUS    =  NEW        | REPLACE     | OLD    | SCRATCH | UNKNOWN
      & access='stream',           & !  ACCESS    =  SEQUENTIAL | DIRECT      | STREAM
      & action='write',            & !  ACTION    =  READ|WRITE | READWRITE
      & position='rewind',         & !  POSITION  =  ASIS       | REWIND      | APPEND
      & form='unformatted',        & !  FORM      =  FORMATTED  | UNFORMATTED
      & iostat=ios,                &
      & iomsg=message)
   if(ios.ne.0)then
       write(*,'(a)')'<ERROR>*p6out*: writing '//trim(filename)//':'//trim(message)
   else
      call output_ppm(lun)
   endif
end subroutine print_p6