set_pnm Subroutine

private pure subroutine set_pnm(this, encoding, file_format, width, height, max_color, comment, pixels)

Sets the attributes of the PNM image.

Type Bound

format_pnm

Arguments

Type IntentOptional Attributes Name
class(format_pnm), intent(inout) :: this
character(len=*), intent(in) :: encoding
character(len=3), intent(in) :: file_format
integer, intent(in) :: width
integer, intent(in) :: height
integer, intent(in), optional :: max_color
character(len=*), intent(in) :: comment
integer(kind=ik), intent(in), dimension(:,:) :: pixels

Calls

proc~~set_pnm~~CallsGraph proc~set_pnm format_pnm%set_pnm proc~allocate_pixels format_pnm%allocate_pixels proc~set_pnm->proc~allocate_pixels proc~set_file_format format_pnm%set_file_format proc~set_pnm->proc~set_file_format proc~set_format format_pnm%set_format proc~set_pnm->proc~set_format proc~set_header format_pnm%set_header proc~set_pnm->proc~set_header proc~set_pixels format_pnm%set_pixels proc~set_pnm->proc~set_pixels proc~set_comment format_pnm%set_comment proc~set_header->proc~set_comment proc~set_height format_pnm%set_height proc~set_header->proc~set_height proc~set_magicnumber format_pnm%set_magicnumber proc~set_header->proc~set_magicnumber proc~set_max_color format_pnm%set_max_color proc~set_header->proc~set_max_color proc~set_width format_pnm%set_width proc~set_header->proc~set_width proc~check_pixel_range format_pnm%check_pixel_range proc~set_pixels->proc~check_pixel_range

Called by

proc~~set_pnm~~CalledByGraph proc~set_pnm format_pnm%set_pnm proc~save color%save proc~save->proc~set_pnm program~demo_ppm demo_ppm program~demo_ppm->proc~set_pnm program~test test program~test->proc~set_pnm program~test1 test1 program~test1->proc~set_pnm program~test17 test17 program~test17->proc~set_pnm program~test18 test18 program~test18->proc~set_pnm program~test19 test19 program~test19->proc~set_pnm program~test2 test2 program~test2->proc~set_pnm program~test20 test20 program~test20->proc~set_pnm program~test21 test21 program~test21->proc~set_pnm program~test22 test22 program~test22->proc~set_pnm program~test23 test23 program~test23->proc~set_pnm program~test24 test24 program~test24->proc~set_pnm program~test25 test25 program~test25->proc~set_pnm program~test3 test3 program~test3->proc~set_pnm program~test4 test4 program~test4->proc~set_pnm program~test6 test6 program~test6->proc~set_pnm

Source Code

   pure subroutine set_pnm(this, encoding, file_format,width,height,max_color,comment,pixels)
      class(format_pnm),           intent(inout) :: this
      integer,                     intent(in)    :: width
      integer,                     intent(in)    :: height
      character(*),                intent(in)    :: comment
      integer, optional,           intent(in)    :: max_color
      integer(ik), dimension(:,:), intent(in)    :: pixels
      character(*),                intent(in)    :: encoding
      character(3),                intent(in)    :: file_format
      character(2)                               :: magic_number

      call this%set_format(encoding)
      call this%set_file_format(file_format)

      select case (this%encoding)
       case ('ascii','plain')
         select case (this%file_format)
          case ('pbm')
            magic_number = 'P1'
          case ('pgm')
            magic_number = 'P2'
          case ('ppm')
            magic_number = 'P3'
         end select
       case ('binary','raw')
         select case (this%file_format)
          case ('pbm')
            magic_number = 'P4'
          case ('pgm')
            magic_number = 'P5'
          case ('ppm')
            magic_number = 'P6'
         end select
      end select

      call this%set_header(magic_number,width,height,comment,max_color)
      call this%allocate_pixels()
      call this%set_pixels(pixels)
   end subroutine set_pnm