Allocates memory for the pixels of the PNM image.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(format_pnm), | intent(inout) | :: | this |
elemental pure subroutine allocate_pixels(this) class(format_pnm), intent(inout) :: this select case(this%magic_number) case('P1') if (.not.allocated(this%pixels)) allocate(this%pixels(this%height, this%width)) case('P2') if (.not.allocated(this%pixels)) allocate(this%pixels(this%height, this%width)) case('P3') if (.not.allocated(this%pixels)) allocate(this%pixels(this%height, 3*this%width)) case('P4') if (.not.allocated(this%pixels)) allocate(this%pixels(this%height, this%width)) case('P5') if (.not.allocated(this%pixels)) allocate(this%pixels(this%height, this%width)) case('P6') if (.not.allocated(this%pixels)) allocate(this%pixels(this%height, 3*this%width)) end select end subroutine allocate_pixels