Anonymous user
Bitmap/Write a PPM file: Difference between revisions
→{{header|Fortran}}: rewrote rgbimage module
(+Stata) |
(→{{header|Fortran}}: rewrote rgbimage module) |
||
Line 427:
=={{header|Fortran}}==
{{works with|Fortran|90 and later}}
It loads <code>
<lang fortran>
use rgbimage_m
implicit none
▲ type(rgbimage), intent(in) :: img
▲ integer :: i, j
! init image of height nx, width ny
nx = 400
ny = 300
call im%init(nx, ny)
do j=1, img%height▼
! set some random pixel data
do i = 1, nx
call im%set_pixel(i, j, [(nint(rand()*255), k=1,3)])
end do▼
end do
! output image into file
call im%write('fig.ppm')
▲end module RCImageIO</lang>
=={{header|GAP}}==
<lang gap># Dirty implementation
|