Sets the attributes of the PNM image.
Type | Intent | Optional | 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 |
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