Sets the pixel values of the PNM image.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(format_pnm), | intent(inout) | :: | this | |||
integer, | intent(in), | optional | :: | grey | ||
integer, | intent(in), | optional | :: | r | ||
integer, | intent(in), | optional | :: | g | ||
integer, | intent(in), | optional | :: | b | ||
integer, | intent(in) | :: | i | |||
integer, | intent(in) | :: | j |
elemental pure subroutine set_pixel(this, grey,r,g,b, i, j) class(format_pnm), intent(inout) :: this integer, intent(in), optional :: grey integer, intent(in), optional :: r, g, b integer, intent(in) :: i, j select case(this%magic_number) case('P1') this%pixels(i,j) = grey case('P2') this%pixels(i,j) = grey case('P3') this%pixels(i,3*j-2) = r this%pixels(i,3*j-1) = g this%pixels(i,3*j-0) = b end select end subroutine set_pixel