decode_binary_pbm_pixels Subroutine

private pure subroutine decode_binary_pbm_pixels(this, buffer)

Unpacks binary data from a character buffer into the image's pixel array.

Arguments

Type IntentOptional Attributes Name
class(format_pnm), intent(inout) :: this
character(len=1), intent(in) :: buffer(:)

Called by

proc~~decode_binary_pbm_pixels~~CalledByGraph proc~decode_binary_pbm_pixels decode_binary_pbm_pixels proc~import_pnm format_pnm%import_pnm proc~import_pnm->proc~decode_binary_pbm_pixels program~demo_ppm demo_ppm program~demo_ppm->proc~import_pnm program~test10 test10 program~test10->proc~import_pnm program~test11 test11 program~test11->proc~import_pnm program~test12 test12 program~test12->proc~import_pnm program~test13 test13 program~test13->proc~import_pnm program~test14 test14 program~test14->proc~import_pnm program~test7 test7 program~test7->proc~import_pnm program~test8 test8 program~test8->proc~import_pnm program~test9 test9 program~test9->proc~import_pnm

Source Code

   pure subroutine decode_binary_pbm_pixels(this, buffer)
      class(format_pnm), intent(inout) :: this
      character(len=1), intent(in) :: buffer(:)
      integer :: row, col, nbytes

      nbytes = (this%width+7)/8
      do concurrent (row = 0:this%height-1, col = 0:this%width-1)
         this%pixels(row+1, col+1) = ibits(ichar(buffer(row*nbytes+col/8+1)), 7-mod(col, 8), 1)
      end do
   end subroutine decode_binary_pbm_pixels