check_pixel_range Subroutine

private pure subroutine check_pixel_range(this, pixels)

Checks if the pixel values are within the valid range.

Type Bound

format_pnm

Arguments

Type IntentOptional Attributes Name
class(format_pnm), intent(inout) :: this
integer(kind=ik), intent(in), dimension(:,:) :: pixels

Called by

proc~~check_pixel_range~~CalledByGraph proc~check_pixel_range format_pnm%check_pixel_range proc~flip_horizontal format_pnm%flip_horizontal proc~flip_horizontal->proc~check_pixel_range proc~flip_vertical format_pnm%flip_vertical proc~flip_vertical->proc~check_pixel_range proc~greyscale format_pnm%greyscale proc~greyscale->proc~check_pixel_range proc~import_pnm format_pnm%import_pnm proc~import_pnm->proc~check_pixel_range proc~remove_channels format_pnm%remove_channels proc~remove_channels->proc~check_pixel_range proc~set_pixels format_pnm%set_pixels proc~set_pixels->proc~check_pixel_range proc~swap_channels format_pnm%swap_channels proc~swap_channels->proc~check_pixel_range proc~brighten format_pnm%brighten proc~brighten->proc~set_pixels proc~crop format_pnm%crop proc~crop->proc~set_pixels proc~negative format_pnm%negative proc~negative->proc~set_pixels proc~resize format_pnm%resize proc~resize->proc~set_pixels proc~rotate format_pnm%rotate proc~rotate->proc~set_pixels proc~set_pnm format_pnm%set_pnm proc~set_pnm->proc~set_pixels program~demo_ppm demo_ppm program~demo_ppm->proc~flip_horizontal program~demo_ppm->proc~flip_vertical program~demo_ppm->proc~greyscale program~demo_ppm->proc~import_pnm program~demo_ppm->proc~remove_channels program~demo_ppm->proc~swap_channels program~demo_ppm->proc~brighten program~demo_ppm->proc~crop program~demo_ppm->proc~negative program~demo_ppm->proc~resize program~demo_ppm->proc~rotate program~demo_ppm->proc~set_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~test19 test19 program~test19->proc~swap_channels program~test19->proc~set_pnm program~test20 test20 program~test20->proc~remove_channels program~test20->proc~set_pnm program~test21 test21 program~test21->proc~greyscale program~test21->proc~set_pnm program~test23 test23 program~test23->proc~flip_horizontal program~test23->proc~flip_vertical program~test23->proc~set_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 proc~save color%save proc~save->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~negative program~test17->proc~set_pnm program~test18 test18 program~test18->proc~brighten program~test18->proc~set_pnm program~test2 test2 program~test2->proc~set_pnm program~test22 test22 program~test22->proc~rotate program~test22->proc~set_pnm program~test24 test24 program~test24->proc~crop program~test24->proc~set_pnm program~test25 test25 program~test25->proc~resize 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 check_pixel_range(this, pixels)
      class(format_pnm),           intent(inout) :: this
      integer(ik), dimension(:,:), intent(in)    :: pixels

      ! Check if the pixel values are within the valid range
      select case (this%file_format)
       case ('pbm')
         if (maxval(pixels) > 1 .or. minval(pixels) < 0)&
         error stop 'set_pixels: Invalid pixel values. Valid values are 0 and 1.'
       case ('pgm')
         if (maxval(pixels) > this%max_color .or. minval(pixels) < 0)&
         error stop 'set_pixels: Invalid pixel values. Valid values are between 0 and max_color.'
       case ('ppm')
         if (maxval(pixels) > this%max_color .or. minval(pixels) < 0)&
         error stop 'set_pixels: Invalid pixel values. Valid values are between 0 and max_color.'
      end select
   end subroutine check_pixel_range