brighten Subroutine

private pure elemental subroutine brighten(this, factor)

Brightens or darkens the image. Only supported for PGM and PPM images.

Type Bound

format_pnm

Arguments

Type IntentOptional Attributes Name
class(format_pnm), intent(inout) :: this
integer, intent(in) :: factor

Calls

proc~~brighten~~CallsGraph proc~brighten format_pnm%brighten proc~set_pixels format_pnm%set_pixels proc~brighten->proc~set_pixels proc~check_pixel_range format_pnm%check_pixel_range proc~set_pixels->proc~check_pixel_range

Called by

proc~~brighten~~CalledByGraph proc~brighten format_pnm%brighten program~demo_ppm demo_ppm program~demo_ppm->proc~brighten program~test18 test18 program~test18->proc~brighten

Source Code

   elemental pure subroutine brighten(this, factor)
      class(format_pnm), intent(inout) :: this
      integer,           intent(in)    :: factor

      select case (this%file_format)
       case ('pbm')
         error stop 'brighten: This function is not supported for pbm files.'
       case ('pgm', 'ppm')
         call this%set_pixels(min(this%max_color, max(0, this%pixels + factor)))
      end select
   end subroutine brighten