Flips the image horizontally.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(format_pnm), | intent(inout) | :: | this |
elemental pure subroutine flip_horizontal(this) class(format_pnm), intent(inout) :: this select case (this%file_format) case ('pbm', 'pgm') this%pixels(:,:) = this%pixels(:, this%width:1:-1) call this%check_pixel_range(this%pixels) case ('ppm') this%pixels(:, 1:size(this%pixels, 2):3) = this%pixels(:, size(this%pixels, 2)-2:1:-3) this%pixels(:, 2:size(this%pixels, 2):3) = this%pixels(:, size(this%pixels, 2)-1:2:-3) this%pixels(:, 3:size(this%pixels, 2):3) = this%pixels(:, size(this%pixels, 2) :3:-3) call this%check_pixel_range(this%pixels) end select call this%set_height(size(this%pixels,1)) select case (this%file_format) case ('pbm', 'pgm') call this%set_width(size(this%pixels,2)) case ('ppm') call this%set_width(size(this%pixels,2)/3) end select end subroutine flip_horizontal