trying to use the new rgb pixels module

This commit is contained in:
tTh
2022-12-16 20:37:52 +01:00
parent fc03c70454
commit e780a79273
3 changed files with 19 additions and 14 deletions

View File

@@ -4,8 +4,9 @@
!-
!-----------------------------------------------------------------------
program essai
use realfield
use spitpgm ! XXX
use realfield
use spitpgm ! XXX
use pixrgb
implicit none
@@ -23,17 +24,17 @@ contains
subroutine essai_near_planet(nbplanets, szfield)
integer, intent(in) :: nbplanets, szfield
integer, dimension(:,:), allocatable :: map
integer :: ix, iy
real :: fx, fy, dx, dy
integer :: near, ipl, errcode
real :: curdist, smalldist
type(massbody) :: planets(nbplanets)
type(t_pixrgb), dimension(:,:), allocatable :: cmap
integer :: ix, iy
real :: fx, fy, dx, dy
integer :: near, ipl, errcode
real :: curdist, smalldist
type(massbody) :: planets(nbplanets)
print *, "near planets test", nbplanets, szfield
allocate(map(szfield, szfield), stat=errcode)
map = -1
allocate(cmap(szfield, szfield), stat=errcode)
! map = -1
! create some random bodies
do ipl=1, nbplanets
@@ -63,7 +64,9 @@ subroutine essai_near_planet(nbplanets, szfield)
endif
end do ! loop on ipl
map(ix, iy) = mod(near, 255)
cmap(ix, iy)%r = mod(near*2, 255)
cmap(ix, iy)%g = mod(near*3, 255)
cmap(ix, iy)%b = mod(near*4, 255)
enddo
@@ -71,7 +74,7 @@ subroutine essai_near_planet(nbplanets, szfield)
enddo
call spit_as_pgm_8(map, "nearest.pgm")
call rgbpix_spit_as_pnm(cmap, "rgb.pnm")
end subroutine
!-----------------------------------------------------------------------