Bitmap/Write a PPM file: Difference between revisions
Content added Content deleted
No edit summary |
(fortran) |
||
Line 64: | Line 64: | ||
test over write-ppm |
test over write-ppm |
||
close-file throw |
close-file throw |
||
=={{header|Fortran}}== |
|||
{{works with|Fortran|90 and later}} |
|||
It loads <code>RCImageBasic</code> module, which is defined [[Basic bitmap storage#Fortran|here]]. |
|||
<lang fortran>module RCImageIO |
|||
use RCImageBasic |
|||
contains |
|||
subroutine output_ppm(u, img) |
|||
integer, intent(in) :: u |
|||
type(rgbimage), intent(in) :: img |
|||
integer :: i, j |
|||
write(u, '(A2)') 'P6' |
|||
write(u, '(I0,'' '',I0)') img%width, img%height |
|||
write(u, '(A)') '255' |
|||
do j=1, img%height |
|||
do i=1, img%width |
|||
write(u, '(3A1)', advance='no') achar(img%red(i,j)), achar(img%green(i,j)), & |
|||
achar(img%blue(i,j)) |
|||
end do |
|||
end do |
|||
end subroutine output_ppm |
|||
end module RCImageIO</lang> |
|||
== {{Header|OCaml}} == |
== {{Header|OCaml}} == |